#1065445 pristine-tar: fails if upstream tarball top directory name is capitalised

Package:
pristine-tar
Source:
pristine-tar
Description:
regenerate pristine tarballs
Submitter:
Julian Gilbey
Date:
2024-03-05 17:36:02 UTC
Severity:
normal
#1065445#5
Date:
2024-03-04 20:53:21 UTC
From:
To:
I discovered that a package I was trying to use with pristine-tar
failed to work.  The cause of the issue seems to be that the upstream
tarball's top directory name is capitalised, but pristine-tar
regenerates a tarball with the name lowercased.

Steps to reproduce using git-buildpackage:
1. Import the attached minimal working example into git using the command:
   gbp import-dsc --pristine-tar hello_1.0-1.dsc

2. Change into the build directory:
   cd hello

3. Regenerate the original tar ball using pristine-tar, for example:
   gbp buildpackage -S

4. Return to the parent directory, then:

$ tar ztf hello_1.0.orig.tar.gz
Hello-1.0/
Hello-1.0/Makefile
Hello-1.0/hello.c
$ tar ztf build-area/hello_1.0.orig.tar.gz
hello-1.0/
hello-1.0/Makefile
hello-1.0/hello.c

Note the capitalisation has changed.  Also:

$ ls -l hello_1.0.orig.tar.gz build-area/hello_1.0.orig.tar.gz
-rw-r--r-- 1 jdg jdg 256 Mar  4 20:46 build-area/hello_1.0.orig.tar.gz
-rw-r--r-- 1 jdg jdg 175 Mar  4 20:00 hello_1.0.orig.tar.gz

Best wishes,

   Julian

#1065445#10
Date:
2024-03-04 21:19:30 UTC
From:
To:
I forgot to attach the hello package; here it is.

   Julian

#1065445#15
Date:
2024-03-05 07:41:02 UTC
From:
To:
severity 1065445 important
retitle 1065445 pristine-tar: fails if original tarball top directory name is not <debianpackagename>-<debianuversion>
thanks
original tarball does not have a top directory named
<debianpackagename>-<debianupstreamversion>
then pristine-tar fails; it *always* creates a tarball with top
directory called this, rather than using the name used by the original
upstream tarball.  So pristine-tar fails on all such cases, including
cases where mk-origtargz has been used to exclude some files.

Attached is a minimal example, hello2.

   Julian

#1065445#20
Date:
2024-03-05 17:08:27 UTC
From:
To:
reassign 1065445 git-buildpackage
retitle 1065445 git-buildpackage: --pristine-tar fails if upstream tarball top directory name is not <debianpackagename>-<debianuversion>
thanks

(See below for explanation.)

I checked pristine-tar directly on these examples, and it turns out
that it can handle these situations with no problems.  The problem
only emerges when git-buildpackage is being used, as in the example I
gave in the original bug report.  I don't know how gbp
import-orig/import-dsc --pristine-tar calls pristine-tar, but somehow
it appears to forget the top directory name of the original tarball,
leading to this problem.

I have reported this as a severity "important" bug because it may
silently (or not so silently) affect many packages.

Best wishes,

   Julian