[buildd-tools-devel] Bug#808560: Bug#808560: sbuild: Use of uninitialized value $_ in concatenation (.)

Johannes Schauer josch at debian.org
Tue Dec 22 06:48:11 UTC 2015


Control: tag -1 + patch

Hi Niko,

thanks a ton for having a look at this!

Quoting Niko Tyni (2015-12-21 23:43:24)
> My preliminary findings are that a change in Perl broke the sbuild parsing of
> .changes files, in lib/Sbuild/Build.pm:1865 or so.
> 
> This has different behaviour on 5.20 and 5.22:
> 
> perl -MData::Dumper -e '@a=(split( /\s+/, "foo"))[5]; print Dumper \@a'
> 
> which shows an empty array on 5.20 and an array of one undef element
> on 5.22.
> 
> I'm not yet sure if this is a regression in Perl or a bugfix.
> Will follow up later when I know more. Marking this as blocking the Perl
> transition to testing for now.

If the problem is this change of behaviour as you described it, then the fix is
a very simple one:

diff --git a/lib/Sbuild/Build.pm b/lib/Sbuild/Build.pm
index d03401c..cc5f3d6 100644
--- a/lib/Sbuild/Build.pm
+++ b/lib/Sbuild/Build.pm
@@ -1861,7 +1861,7 @@ sub build {
                            $_ = '        ' . substr ($_,$index+1);
                        }
                        $self->log($_);
-                       if (/^ [a-z0-9]{32}/) {
+                       if (/^ [a-z0-9]{32} /) {
                            push(@cfiles, (split( /\s+/, $_ ))[5] );
                        }
                    }


This just fixes the regex that is supposed to find a line in the Files section
of a .changes file to not also find lines from the Checksums-Sha1 and
Checksums-Sha256 which each do not have enough fields and are thus triggering
this problem.

On the other hand an even better fix would be to use Dpkg::Index for parsing
the changes file. The current way to "parse" it is just asking for being
disabled by unhandled corner-cases like this.

Thanks!

cheers, josch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: signature
URL: <http://lists.alioth.debian.org/pipermail/buildd-tools-devel/attachments/20151222/b794ceca/attachment.sig>


More information about the Buildd-tools-devel mailing list