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

Bug#739671: phppear check randomly checks one binary



On 2014-02-22 17:40, Mathieu Parent wrote:
> 2014-02-22 8:09 GMT+01:00 Niels Thykier <niels@thykier.net>:
>> >
>> > Hi,
> Hi Niels,
> 
>> > The result is "unordered" because it is the result of a "keys %{...}"
>> > operation and the order of hash keys are "undefined" in Perl (between
>> > runs at least).  It would be simple to get a "defined" order by simply
>> > sorting the keys before returning, but I guess you want the order from
>> > the d/control file?
>> >
>> > To do that you would need to patch _load_ctrl to store a reference to
>> > @control_data on $self and then fetch/use that from from the "binaries"
>> > sub.  The return-statement would become something like:
>> >   return @{ self->{...} };
> Thanks for your pointer. I attached a patch following your advice.
> 
> Regards
> 
> -- Mathieu
> 

Hi,

Thanks for working on it; find my comments below:

> 
> 0001-Ensure-Lintian-Collect-Source-binaries-are-ordered.patch
> 
> 
> From 77533593dd983ae85baa6874ec6be1d0f1f9a214 Mon Sep 17 00:00:00 2001
> From: Mathieu Parent <math.parent@gmail.com>
> Date: Sat, 22 Feb 2014 17:39:04 +0100
> Subject: [PATCH] Ensure Lintian::Collect::Source::binaries are ordered
> 
> This is needed by the phppear check to get the main (i.e. the first) package.
> 
> Closes: #739671
> ---
>  lib/Lintian/Collect/Source.pm | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/Lintian/Collect/Source.pm b/lib/Lintian/Collect/Source.pm
> index e468a15..4d023ec 100644
> --- a/lib/Lintian/Collect/Source.pm
> +++ b/lib/Lintian/Collect/Source.pm
> [...]
>  
>  =item binary_package_type (BINARY)
> @@ -369,6 +369,7 @@ sub _load_dctrl {
>          $ok = 1 if -e $dctrl;
>      }
>  
> +    $self->{binary_names} = ();

I think you need to use "[]" instead of "()" here (to get a list ref)

>      unless ($ok) {
>          # Bad file, assume the package and field does not exist.
>          $self->{binary_field} = {};
> @@ -396,6 +397,7 @@ sub _load_dctrl {
>          my $pkg = $binary->{'package'};
>          next unless defined($pkg) and $pkg =~ m{\A $PKGNAME_REGEX \Z}xsmo;
>          $packages{$pkg} = $binary;
> +        push $self->{binary_names}, $pkg;

Likewise, you need "push(@{$self->{binary_names} }, $pkg);" here.

Technically, I believe this one will work with "very recent" versions of
Perl (possibly as an experimental feature), but I doubt it works with
the version in stable.

>      }
>      $self->{binary_field} = \%packages;

Alternatively, I believe you can replace those two lines with:
      $self->{binary_names} = \@control_data;

>  
> -- 1.8.5.3
> 

~Niels


Reply to: