Bug#1008267: pkg-perl-autopkgtest: use.t: reading debian/tests/pkg-perl/use-whitelist too restrained?

gregor herrmann gregoa at debian.org
Fri Mar 25 17:25:16 GMT 2022


Package: pkg-perl-autopkgtest
Version: 0.34
Severity: normal

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

I just had an issue with our use.t and
debian/tests/pkg-perl/use-whitelist, and after reading the code, it
seems to me that there is a bug (since forever). What I did was to
add a second warning I wanted to ignore to use-whitelist, and
autopkgtest still failed, so I added a few print statements to use.t
and found that it only had one word from the whitelist file.

Now I understand that this is used as a regexp, still this looks
fishy to me: Going back in the code:

The $whitelist variable as it's finally used:

 106     @out = grep { !/$whitelist/ } @out if defined $whitelist;

Here it's defined:

  85 my $whitelist = getwhitelist();

Which is

  76 sub getwhitelist {
  77     my $whitelist = 'debian/tests/pkg-perl/use-whitelist';
  78     my $ret;
  79     $ret = read_conffile($whitelist) if ( -f $whitelist );
  80     $ret;
  81 }

And in read_conffile (stripped down a bit):

  38         open(M, "<", $conffile)
  39             or BAIL_OUT("$conffile exists but can't be read");
  40         while (<M>) {
  41             chomp;
  42             next if /^\s*#/;
  43             /(\S+)/ and $ret = $1, last;
  44         }
  45         close M;
  46         BAIL_OUT("can't find anything in $conffile")
  47             if !defined $ret;
  48     }
  49     return $ret;


My reading of the while loop is that in the end $ret contains only
the first non-whitespace sequence in the first non-comment line.

Now even if only reading one line is ok, as this is used as a regexp
in line 106, /(\S+)/ seems a bit, hm, minimalistic.

Am I right in reading the code, and am I right that this is a bug?


Cheers,
gregor


-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEE0eExbpOnYKgQTYX6uzpoAYZJqgYFAmI9+vxfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEQx
RTEzMTZFOTNBNzYwQTgxMDREODVGQUJCM0E2ODAxODY0OUFBMDYACgkQuzpoAYZJ
qgaISBAAvWtD5L7XHK0pXqNao47O4pUmCeCqeWZbGesVwCgVdZGMdzN5VtgcFdpZ
uaV3Uh6q4jIeQDbk/kMO01FExVIUHaM5dH8bCKnmoZGkqWe233nT6tB3LSc6XUjt
oiL2S7u1JEosLeO5O/e26E6eOxsRGwX1UnRrdRU90OFAX1YphmHfY01tW8QSHg8/
g8bviUOxC8HlQ8IBP3i5opgQ2p0cg/Q5HWYpSlCQ9hd7zoK8YzvBmE97yqOOXEl8
Wvp40tGU1/UwyeoCryYa8rFGa460im0q1CQkcRfpWZm9DzteAFG/FI6qaDNxPShE
AuJ7Pmducdud5vya2nEAB26Tf3vEjf7JWRRpo1z8wmAWkFlysUadDyWib02e3kYw
dXKSnvgXCqEeoi30wlxFpUlgkOFdmPtrQulvGE8Xgx8MHfrwuNcxTEUOgDVeMF6j
ID58Amu1xPdv77jdlOXeFdjY2myp0cSHJSEaLLS/8fQTZZsa30JFA843BpGRLvuh
gfWZuJrD1DnnIzOk49Ggs6wRNiPWqUmIA1cE9wXpcI51AI4HcZPaGG3IkxPgYYuQ
MoiqtZ6Fi4a1bKFYAn5PyyL/uuQv1oaFLsWZtcLZUO6T37ZkChVKfWoH1jV+9fj0
pom0LMg2Er2qz+N24AESvpvBXSdB3ZDa+TXqi82bo3Rih8NMilg=
=2AVN
-----END PGP SIGNATURE-----



More information about the pkg-perl-maintainers mailing list