Bug#929729: lintian: \n in filenames cause "md5sum: ...: No such file or directory"
Chris Lamb wrote:
> However, I can reproduce with your previously attached .deb:
>
> $ lintian ~/Downloads/newline_1_all.deb 2>&1 | head -n2
> md5sum: 'usr/share/newline/\n/etc/issue': No such file or directory
> command failed with error code 123 at
> /home/lamby/git/debian/lintian/lintian/lib/Lintian/Command.pm line 344.
The following "fixes" it:
diff --git a/collection/md5sums b/collection/md5sums
index 970eb0656..e8006ab10 100755
--- a/collection/md5sums
+++ b/collection/md5sums
@@ -53,7 +53,8 @@ sub collect {
foreach my $file ($info->sorted_index) {
next unless $file->is_file;
+ $file =~ s,\\n,\n,g;
printf {$opts{pipe_in}} "%s\0", $file;
}
close($opts{pipe_in});
diff --git a/lib/Lintian/Path.pm b/lib/Lintian/Path.pm
index 108a18ede..fb8048ed5 100644
--- a/lib/Lintian/Path.pm
+++ b/lib/Lintian/Path.pm
@@ -643,6 +643,7 @@ sub open {
$layer //= '';
my $opener = sub {
use autodie qw(open);
+ $_[0] =~ s,\\n,\n,g;
open(my $fd, "<${layer}", $_[0]);
return $fd;
};
… but this is clearly hacking around the problem and is likely
incomplete. Storing the newline literally in the internal structure
breaks other things that I can't immediately see/fix.
Regards,
--
,''`.
: :' : Chris Lamb
`. `'` lamby@debian.org 🍥 chris-lamb.co.uk
`-
Reply to: