Package: dpkg
Version: 1.18.10
Followup-For: Bug #787980
Dear Maintainer,
A newer version of this patch is attached.
We noticed that elsewhere dpkg uses the same function to pack a data.tar so
we added a bool flag to that function to distinguish the cases. To minimise
the code diff we're passing a "--mode=+" argument to tar which is a nop as can
be verified either manually or by checking `man chmod`.
X
-- System Information:
Debian Release: stretch/sid
APT prefers testing
APT policy: (990, 'testing'), (500, 'stable'), (300, 'unstable'), (200,
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.4.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages dpkg depends on:
ii libbz2-1.0 1.0.6-8
ii libc6 2.23-5
ii liblzma5 5.1.1alpha+20120614-2.1
ii libselinux1 2.5-3
ii tar 1.29b-1
ii zlib1g 1:1.2.8.dfsg-2+b1
dpkg recommends no packages.
Versions of packages dpkg suggests:
ii apt 1.3~rc4
-- no debconf information
diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c
index 655aa55..b15ab90 100644
--- a/dpkg-deb/build.c
+++ b/dpkg-deb/build.c
@@ -422,7 +422,7 @@ typedef void filenames_feed_func(const char *dir, int fd_out);
static void
tarball_pack(const char *dir, filenames_feed_func *tar_filenames_feeder,
time_t timestamp,
- struct compress_params *tar_compress_params, int fd_out)
+ struct compress_params *tar_compress_params, int fd_out, bool ctrl)
{
int pipe_filenames[2], pipe_tarball[2];
pid_t pid_tar, pid_comp;
@@ -448,6 +448,7 @@ tarball_pack(const char *dir, filenames_feed_func *tar_filenames_feeder,
execlp(TAR, "tar", "-cf", "-", "--format=gnu",
"--mtime", mtime, "--clamp-mtime",
+ ctrl ? "--mode=go=rX,u+rw,a-s" : "--mode=+",
"--null", "--no-unquote",
"--no-recursion", "-T", "-", NULL);
ohshite(_("unable to execute %s (%s)"), "tar -cf", TAR);
@@ -572,7 +573,7 @@ do_build(const char *const *argv)
/* Fork a tar to package the control-section of the package. */
tarball_pack(ctrldir, control_treewalk_feed, timestamp,
- &control_compress_params, gzfd);
+ &control_compress_params, gzfd, 1);
free(ctrldir);
@@ -633,7 +634,7 @@ do_build(const char *const *argv)
}
/* Pack the directory into a tarball, feeding files from the callback. */
- tarball_pack(dir, file_treewalk_feed, timestamp, &compress_params, gzfd);
+ tarball_pack(dir, file_treewalk_feed, timestamp, &compress_params, gzfd, 0);
/* Okay, we have data.tar as well now, add it to the ar wrapper. */
if (deb_format.major == 2) {