diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2022-12-11 01:08:51 +0000 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2022-12-11 15:02:11 +0000 |
commit | 9edccace4330e71b6cc3abe3231a50647c14ef5d (patch) | |
tree | 15a9d59f3e5e555dbe3c68a7699b233f8c0d2a62 /dgit | |
parent | 2b8b7003bf82afe17e188709e4a4a878617390e8 (diff) |
dgit: handle debian/source/include-binaries in quilt fixup
Oh my god.
Writeup here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1024233#10
Closes: #1024233
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'dgit')
-rwxr-xr-x | dgit | 43 |
1 files changed, 43 insertions, 0 deletions
@@ -6182,6 +6182,49 @@ END next unless stat_exists "$maindir/$maybe"; push @files, $maybe; } + if (open IB, "$maindir/debian/source/include-binaries") { + BFILE: while (<IB>) { + s{^[ \t]*}{}; + s{[ \t\n]*$}{}; + next if m{^\#}; + next unless length; + our $include_binaries_warning; + $include_binaries_warning++ or + print STDERR __ + "warning: package uses dpkg-source include-binaries feature - not all changes are visible in patches!\n"; + + my @bpath; + my $bfile_in = $_; + my $bpath_chk; + foreach my $ent (split m{/}, $bfile_in) { + my $wrong = sub { + no warnings qw(exiting); + print STDERR f_ + "warning: ignoring bad include-binaries file %s: %s\n", $bfile_in, $_[0]; + next BFILE; + }; + $wrong->(f_ "forbidden path component '%s'", $ent) + if grep { $_ eq $ent } '', '.', '..'; + $wrong->(f_ "path starts with '%s'", $ent) + if !@bpath && grep { $_ eq $ent } qw(debian .git); + push @bpath, $ent; + $bpath_chk = join '/', @bpath; + if (!lstat "$maindir/$bpath_chk") { + confess "$maindir/$bpath_chk" unless $!==ENOENT; + next BFILE; + } elsif (-f _ || -d _) { + } else { + $wrong->(f_ "path to '%s' not a plain file or directory", + $bpath_chk); + } + }; + push @files, $bpath_chk; + } + IB->error and confess "$!"; + close IB; + } else { + $! == ENOENT || confess "$!"; + } my $debtar= srcfn $fakeversion,'.debian.tar'; runcmd qw(tar -cf), "./$debtar", qw(-C), $maindir, @files; |