Package: debhelper
Version: 10.2.5
Severity: minor

I noticed this stackoverflow question: 
https://stackoverflow.com/questions/30185972/dh-md5sums-argument-list-too-long?rq=1

Looking at the code, it appears to still apply to debhelper/10.2.5:

"""
        # Check if we should exclude conffiles.
        my $exclude="";
        if (! $dh{INCLUDE_CONFFILES} && -r "$tmp/DEBIAN/conffiles") {
                # Generate exclude regexp.
                open(my $fd, '<', "$tmp/DEBIAN/conffiles")
                  or die("open $tmp/DEBIAN/conffiles failed: $!");
                while (<$fd>) {
                        chomp;
                        s/^\///;
                        $exclude.="! -path \"./$_\" ";
                }
                close($fd);
        }
        
        # See if we should exclude other files.
        if (defined($dh{EXCLUDE_FIND}) && $dh{EXCLUDE_FIND} ne '') {
                $exclude.="! \\( $dh{EXCLUDE_FIND} \\) ";
        }
        
        my $find="find . -type f $exclude ! -regex './DEBIAN/.*' -printf 
'%P\\0'";
        complex_doit("(cd $tmp >/dev/null ; $find | LC_ALL=C sort -z | xargs 
-r0 md5sum | " .
                  q{perl -pe 'if (s@^\\\\@@) { s/\\\\\\\\/\\\\/g; }' > 
DEBIAN/md5sums) >/dev/null});
"""

Imagine "$tmp/DEBIAN/conffiles" containing 1000 paths of 1000 bytes
each, then we end up with over a million bytes in $exclude[1].  This
is later shoved into a shell, which then chokes on it.

Thanks,
~Niels

[1] Admittedly, this can occur via -X as well, but it seems less
likely to be an issue as the caller of dh_md5sums would probably run
into the issue first.

Reply via email to