[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#513663: [general] need infrastructure to check related packages



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 2011-01-07 04:38, Russ Allbery wrote:
> Niels Thykier <niels@thykier.net> writes:
>> [...]
>> My current effort in the infra-513663 branch has been to encapsulate
>> packages inside the lab and reduce the complexity of the "PACKAGE: foreach".
>>   I intend to let these Lab::Package instances take care of the
>> book-keeping inside its defined little space; my next goal is probably
>> to make collection book-keeping go in there as well (that is creation
>> and removal of the ".<script>-<version>" files).
>>   I think once that is done the "PACKAGE: foreach" will be much simpler
>> (at least a lot shorter).
> 
> Excellent!
> 

Alright, I need a second pair of eyes here.  In frontend/lintian there
is a piece of code[1].  This is about line 880ish in the infra-513663
branch.

I am almost certain there is something fishy going on within the if
body.  With a bit of "printf"-debugging I have concluded that $checks in
"if ($check_tags) {" part is A) a scalar and B) undefined yet it is
happily used as a hash!
  The else-part looks just as fishy!  It split $checks on /,/ (so it is
used as a scalar again), yet it also happily uses $checks as a hash just
a bit further down.

I am guessing that these $checks{...} maps should have been replaced by
(something like) $check_info{...}->{'requested-tags'}.  But I would like
this confirmed.

~Niels

[1]

# {{{ determine which checks have been requested
if ($action eq 'check') {
    if ($check_tags) {
	foreach my $t (split(/,/, $check_tags)) {
	    my $info = Lintian::Tag::Info->new($t);
	    fail("unknown tag specified: $t") unless defined($info);
	    my $script = $info->script;
	    next if $script eq 'lintian';
	    if ($check_info{$script}) {
		$checks{$script} = 1;
	    } else {
		# should never happen
		fail("no info for script $script");
	    }
	}
    } else {
	my %dont_check = map { $_ => 1 } (split m/,/, ...);
	$checks or ($checks = join(',',keys %check_info));
	for my $c (split(/,/,$checks)) {
	    if ($check_info{$c}) {
		if ($dont_check{$c}
		    || ($check_info{$c}->{'abbrev'}
			&& $dont_check{$check_info{$c}->{'abbrev'}})) {
		    #user requested not to run this check
		} elsif ($check_info{$c}->{'requested-tags'} == 0) {
		    #no need to run this check, no tags will be issued
		} else {
		    $checks{$c} = 1;
		}
	    } elsif (exists $check_abbrev{$c}) {
		#abbrevs only used when -C is given, ....
		$checks{$check_abbrev{$c}} = 1;
	    } else {
		fail("unknown check specified: $c");
	    }
	}
    }
    ...
}

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBCAAGBQJNKta8AAoJEAVLu599gGRCqa8P/RLg3PdQaxCuL2V2NZFXuMkn
ZNQOm8Tf3gm7bJKO3d3dK2cG6683TqODje6pxlOW1kieNLDCLC6T+qDJLxv2TRfT
JxcoJGhd/bMOEwKOFWsohy2rjPYEGupuabRLmU/PXkYwZgJmowM4GJZrBDeBRJZT
dJkur4BcEtY8wvUbUuroWk0t3KtkjPPMG7heonoqpan0/VG8/i9X0x8MfwMKQOqn
DikcsBPYWWjlqvKveTuc5I64G6pA8n4o+p7s+JvaoQOnP4Ak2DYMGg1jO3I5RunK
8PeuiHNM8eaEhQ0t1/4N6Rhfh41VVOrX+8AVaLiv3NwXdg/yukcfKb4Z9lH3lJs+
KGEOZyNMdWQfGRBX+NVvkQtkoQKtjjQFGcIuMitfxdsQ5f4oRSSpw2t/dmd/22e/
LLfBoXITmQmNq8mwaxHXf2qBYQfsLoncsYU9/V+BHf1op7gU0F2uhr9lrEQTOQB/
r32Qo4lUimB3PePc8KY4zQ9CAYQwvbfcwwyfrMiH0Z4qvCUTYdPl+JsVySLq8XSP
SF4wcoWxaiCmwICg6U5NBy8mzFpOdZbZ8Yy5kpLVsHxNIv2POMzV1YkkSGfzH65r
87gxbio0dA6UQ042tOn6/iXwhVVV+hhq9Lo52ccc7vslMJqtuqnZv9bfS0hfq5ds
hI0hecQf/2Fq6LuBNee8
=zZkG
-----END PGP SIGNATURE-----


Reply to: