Processed: Re: Bug#933031: pristine-tar: unable to unpack some deltas of version 2

2020-07-29 Thread Debian Bug Tracking System
Processing control commands:

> tags -1 +patch
Bug #933031 [pristine-tar] pristine-tar: unable to unpack some deltas of 
version 2
Added tag(s) patch.

-- 
933031: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=933031
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems



Bug#933031: pristine-tar: unable to unpack some deltas of version 2

2020-07-29 Thread Steve McIntyre
Control: tags -1 +patch

On Tue, Jul 28, 2020 at 04:17:08PM +0100, Steve McIntyre wrote:
>Control: severity -1 grave

...

>IMHO this has to be a grave bug - without reimporting this repo we
>can't get our older revisions back. Then I'm worried that this will
>break things if we need to go back and rebuild older versions (using
>older tooling). pristine-tar needs to be safe for data here. :-(
>
>I've done a git bisect of the pristine-tar repo to see where things
>broke, and that clearly tells me:
>
>...
>f287f10b48c3ca5a30db13dbf3ba918c47a943bb is the first bad commit
>commit f287f10b48c3ca5a30db13dbf3ba918c47a943bb
>Author: Tomasz Buchert 
>Date:   Fri Jan 13 23:28:04 2017 +0100
>
>fix #851286
>
>:100755 100755 1a34e953ba363ae1e284b97f83f63f6ef80ea544 
>3ba76f79d376d011451b8c572b20e185b715bed1 M  pristine-tar
>:04 04 84bc809be6b4dcf81cfce71f0550858957a3e92f 
>f8eb72beb458cbd9770f88f0f4efc00f0c75a299 M  test
>bisect run success
>...
>
>I hope that helps the maintainers - shout if you'd like more help debugging.

I've carried on and looked at the code. The attached patch makes
things work for me, at the expense of YA thing added to the @try
loop. But I'll take that over failure!

Having looked at this code a little, I'm now also a little concerned
about the way the fallbacks work, i.e. applied one at a time
independently. I'm thinking that there could well be cases where a
stored tarball might need more than one of the workaround/retry
options. Maybe I'm over-thinking it.

Also submitted this as an MR:

  https://salsa.debian.org/debian/pristine-tar/-/merge_requests/7

in case you'd prefer that.

-- 
Steve McIntyre, Cambridge, UK.st...@einval.com
< sladen> I actually stayed in a hotel and arrived to find a post-it
  note stuck to the mini-bar saying "Paul: This fridge and
  fittings are the correct way around and do not need altering"
diff --git a/pristine-tar b/pristine-tar
index 0fe132e..081dca1 100755
--- a/pristine-tar
+++ b/pristine-tar
@@ -560,6 +560,33 @@ sub recreatetarball_broken_numeric_owner {
   return recreatetarball_helper();
 }
 
+sub recreatetarball_broken_verbatim {
+  # To fix #851286, the option --verbatim-files-from was added by
+  # default. But now some older older stored tarballs won't reproduce
+  # (#933031). Try again *without* that option to tar.
+  my %options = @_;
+  my $tempdir = $recreatetarball_tempdir;
+
+  my $ret = "$tempdir/recreatetarball";
+  my @cmd = (
+$tar_program, "cf",
+$ret, "--owner",
+0,"--group",
+0,"--numeric-owner",
+"-C", "$tempdir/workdir",
+"--no-recursion", "--mode",
+"0644",
+"--files-from",   "$tempdir/manifest"
+  );
+  if (exists $options{tar_format}) {
+push @cmd, ("-H", $options{tar_format});
+  }
+
+  doit(@cmd);
+
+  return $ret;
+}
+
 sub gentar {
   my $deltafile = shift;
   my $tarball   = shift;
@@ -614,6 +641,7 @@ sub gentar {
   %opts
 );
   };
+  push @try, \_broken_verbatim;
   push @try, \_broken_numeric_owner;
 
   my $ok;


Processed: Re: Bug#933031: pristine-tar: unable to unpack some deltas of version 2

2020-07-28 Thread Debian Bug Tracking System
Processing control commands:

> severity -1 grave
Bug #933031 [pristine-tar] pristine-tar: unable to unpack some deltas of 
version 2
Severity set to 'grave' from 'important'

-- 
933031: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=933031
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems