package/tar: bump target version to 1.32 (host is kept at 1.31)
PATCH v4 1/1 package/tar: bump target version to 1.32 (host is kept at 1.31)
From: Luc Creti <[email protected]>
The host tar is used to create the archives in the VCS download backends (git, cvs, svn, hg...) and tar 1.30 and forward have changed the way they generate the archives.
So, all the archives that have been generated before 1.30 was released are not bit-for-bit reproducible (even though the extracted content would be), so the hashes we have for those archives would not match.
Hence host-tar requires a patch to restore reproducibility.
Since there is no tar-1.32.cpio.gz available we must keep host-tar at version 1.31.
---
Changes v0->v1:
- Commit message rewritten based on comment from Yann E. MORIN
Changes v1->v2:
- Title modified to enphasize that host-tar is kept at 1.29
Changes v2->v3
- Add a comment in the .mk file that explains why the host-tar package is kept at 1.29 and not bumped to any higher version
- Add missing spaces around '='
- Spell Author name as 'Luc Creti'
Changes v3->v4
- Bump host-tar to 1.31 and patch it to restore reproducibility.
--- .../0001-tar-fix-reproducibility-issue.patch | 42 +++++++++++++++++++ package/tar/tar.hash | 4 +- package/tar/tar.mk | 20 +++++++-- 3 files changed, 60 insertions(+), 6 deletions(-) create mode 100644 package/tar/host/0001-tar-fix-reproducibility-issue.patch
package/tar/host/0001-tar-fix-reproducibility-issue.patch new file +42 -0
@@ -0,0 +1,42 @@ +From e79e62e3e066545ba5319e2a905e62a0bb47e9e1 Mon Sep 17 00:00:00 2001 +From: Felix Fietkau <[email protected]> +Date: Mon, 19 Dec 2016 21:06:07 +0100 +Subject: [PATCH] tar: fix reproducibility issue + +Force root/root as names for uid0/gid0 instead of using the system +names. This helps make packed download tarballs more reproducible + +Signed-off-by: Felix Fietkau <[email protected]> +Signed-off-by: James Hilliard <[email protected]> +[James Hilliard: import patch from openwrt] +--- + src/create.c | 13 ++----------- + 1 file changed, 2 insertions(+), 11 deletions(-) + +diff --git a/src/create.c b/src/create.c +index bb9c115..1baee36 100644 +--- a/src/create.c ++++ b/src/create.c +@@ -543,17 +543,8 @@ write_gnu_long_link (struct tar_stat_info *st, const char *p, char type) + union block *header; + + header = start_private_header ("././@LongLink", size, 0); +- if (! numeric_owner_option) +- { +- static char *uname, *gname; +- if (!uname) +- { +- uid_to_uname (0, &uname); +- gid_to_gname (0, &gname); +- } +- UNAME_TO_CHARS (uname, header->header.uname); +- GNAME_TO_CHARS (gname, header->header.gname); +- } ++ UNAME_TO_CHARS ("root", header->header.uname); ++ GNAME_TO_CHARS ("root", header->header.gname); + + strcpy (header->buffer + offsetof (struct posix_header, magic), + OLDGNU_MAGIC); +-- +2.20.1 +
package/tar/tar.hash +2 -2
@@ -1,4 +1,4 @@ # Locally calculated after checking signature -sha256 402dcfd0022fd7a1f2c5611f5c61af1cd84910a760a44a688e18ddbff4e9f024 tar-1.29.tar.xz -sha256 9173f222464dd3676118408840da5990527062b5c7daf6487bed7c396c45bfb1 tar-1.29.cpio.gz +sha256 d0d3ae07f103323be809bc3eac0dcc386d52c5262499fe05511ac4788af1fdd8 tar-1.32.tar.xz +sha256 a50fd6eaf2a554930064c18ff5a1016707ab8af5b739dd0890dca04656e7c2aa tar-1.31.cpio.gz sha256 8ceb4b9ee5adedde47b31e975c1d90c73ad27b6b165a1dcd80c7c545eb65b903 COPYING
package/tar/tar.mk +16 -4
@@ -4,7 +4,10 @@ # ################################################################################ -TAR_VERSION = 1.29 +# Host tar is kept at 1.31 because there is no cpio.gz archive available for +# tar version 1.32 +HOST_TAR_VERSION = 1.31 +TAR_VERSION = 1.32 TAR_SOURCE = tar-$(TAR_VERSION).tar.xz TAR_SITE = $(BR2_GNU_MIRROR)/tar # busybox installs in /bin, so we need tar to install as well in /bin
@@ -31,13 +34,13 @@ $(eval $(autotools-package)) # host-tar: use cpio.gz instead of tar.gz to prevent chicken-egg problem # of needing tar to build tar. -HOST_TAR_SOURCE = tar-$(TAR_VERSION).cpio.gz +HOST_TAR_SOURCE = tar-$(HOST_TAR_VERSION).cpio.gz define HOST_TAR_EXTRACT_CMDS mkdir -p $(@D) cd $(@D) && \ $(call suitable-extractor,$(HOST_TAR_SOURCE)) $(TAR_DL_DIR)/$(HOST_TAR_SOURCE) | cpio -i --preserve-modification-time - mv $(@D)/tar-$(TAR_VERSION)/* $(@D) - rmdir $(@D)/tar-$(TAR_VERSION) + mv $(@D)/tar-$(HOST_TAR_VERSION)/* $(@D) + rmdir $(@D)/tar-$(HOST_TAR_VERSION) endef HOST_TAR_CONF_OPTS = --without-selinux
@@ -47,4 +50,13 @@ HOST_TAR_CONF_ENV = \ CC="$(HOSTCC_NOCCACHE)" \ CXX="$(HOSTCXX_NOCCACHE)" +# host-tar is used to create the archives in the VCS download backends and tar +# 1.30 and forward have changed the archive format. So archives generated with +# earlier versions are not bit-for-bit reproducible and the hashes would not +# match. We add a patch that restores the origional format to host-tar. +define HOST_TAR_APPLY_PATCHES + $(APPLY_PATCHES) $(@D) package/tar/host \*.patch +endef +HOST_TAR_POST_PATCH_HOOKS += HOST_TAR_APPLY_PATCHES + $(eval $(host-autotools-package))
Signature · 1 line
2.20.1
PATCH v4 1/1 package/tar: bump target version to 1.32 (host is kept at 1.31)
Quoted 7 lines · James Hilliard
From: Luc Creti <[email protected]>
The host tar is used to create the archives in the VCS download backends (git, cvs, svn, hg...) and tar 1.30 and forward have changed the way they generate the archives.
Quoted 8 lines
So, all the archives that have been generated before 1.30 was released are not bit-for-bit reproducible (even though the extracted content would be), so the hashes we have for those archives would not match.
Hence host-tar requires a patch to restore reproducibility.
Since there is no tar-1.32.cpio.gz available we must keep host-tar at version 1.31.
We don't actually need the cpio.gz file. We can use the installed tar, whatever it is, to extract the tar-1.32.tar.xz:
define HOST_TAR_EXTRACT_CMDS
mkdir -p $(@D)
cd $(@D) && \
$(call suitable-extractor,$(HOST_TAR_SOURCE))
$(TAR_DL_DIR)/$(HOST_TAR_SOURCE) \
| tar --strip-components=1 -xf -endef
Signature · 1 line
Carlos Santos <[email protected]>
PATCH v4 1/1 package/tar: bump target version to 1.32 (host is kept at 1.31)
Quoted 21 lines · Carlos Santos
Quoted 7 lines · James Hilliard
From: Luc Creti <[email protected]>
The host tar is used to create the archives in the VCS download backends (git, cvs, svn, hg...) and tar 1.30 and forward have changed the way they generate the archives.
Quoted 8 lines
So, all the archives that have been generated before 1.30 was released are not bit-for-bit reproducible (even though the extracted content would be), so the hashes we have for those archives would not match.
Hence host-tar requires a patch to restore reproducibility.
Since there is no tar-1.32.cpio.gz available we must keep host-tar at version 1.31.
We don't actually need the cpio.gz file. We can use the installed tar, whatever it is, to extract the tar-1.32.tar.xz:
Quoted 6 lines
define
HOST_TAR_EXTRACT_CMDSmkdir -p $(@D) cd $(@D) && \ $(call suitable-extractor,$(HOST_TAR_SOURCE)) $(TAR_DL_DIR)/$(HOST_TAR_SOURCE) \ | tar --strip-components=1 -xf -
IIRC, the original reason to have host-tar was because older tar didn't
understand --strip-components. That's why tar was downloaded as a cpio archive.
Later on we became fixed on one single version because newer tar would create
slightly different tarballs so the hash would be different.
Regards,
Arnout
Quoted 2 lines
endef
PATCH v4 1/1 package/tar: bump target version to 1.32 (host is kept at 1.31)
Quoted 32 lines · Arnout Vandecappelle
Quoted 21 lines · Carlos Santos
Quoted 7 lines · James Hilliard
From: Luc Creti <[email protected]>
The host tar is used to create the archives in the VCS download backends (git, cvs, svn, hg...) and tar 1.30 and forward have changed the way they generate the archives.
Quoted 8 lines
So, all the archives that have been generated before 1.30 was released are not bit-for-bit reproducible (even though the extracted content would be), so the hashes we have for those archives would not match.
Hence host-tar requires a patch to restore reproducibility.
Since there is no tar-1.32.cpio.gz available we must keep host-tar at version 1.31.
We don't actually need the cpio.gz file. We can use the installed tar, whatever it is, to extract the tar-1.32.tar.xz:
Quoted 6 lines
define
HOST_TAR_EXTRACT_CMDSmkdir -p $(@D) cd $(@D) && \ $(call suitable-extractor,$(HOST_TAR_SOURCE)) $(TAR_DL_DIR)/$(HOST_TAR_SOURCE) \ | tar --strip-components=1 -xf -
Quoted 5 lines
IIRC, the original reason to have host-tar was because older tar didn't
understand --strip-components. That's why tar was downloaded as a cpio archive.Later on we became fixed on one single version because newer tar would create
slightly different tarballs so the hash would be different.
$ cat /etc/redhat-release Red Hat Enterprise Linux Client release 5.11 (Tikanga)
$ tar --version tar (GNU tar) 1.15.1
$ MANWIDTH=72 man tar
--strip-components NUMBER, --strip-path NUMBER
strip NUMBER of leading components from file names
before extraction
(1) tar-1.14 uses --strip-path, tar-1.14.90+ uses
--strip-componentsThe old syntax (without "=") is supported by recent versions, so
tar --strip-components 1 -xf -
would work even on the venerable RHEL 5.11.
Signature · 1 line
Carlos Santos <[email protected]>
PATCH v4 1/1 package/tar: bump target version to 1.32 (host is kept at 1.31)
Quoted 54 lines · Carlos Santos
Quoted 32 lines · Arnout Vandecappelle
Quoted 21 lines · Carlos Santos
Quoted 7 lines · James Hilliard
From: Luc Creti <[email protected]>
The host tar is used to create the archives in the VCS download backends (git, cvs, svn, hg...) and tar 1.30 and forward have changed the way they generate the archives.
Quoted 8 lines
So, all the archives that have been generated before 1.30 was released are not bit-for-bit reproducible (even though the extracted content would be), so the hashes we have for those archives would not match.
Hence host-tar requires a patch to restore reproducibility.
Since there is no tar-1.32.cpio.gz available we must keep host-tar at version 1.31.
We don't actually need the cpio.gz file. We can use the installed tar, whatever it is, to extract the tar-1.32.tar.xz:
Quoted 6 lines
define
HOST_TAR_EXTRACT_CMDSmkdir -p $(@D) cd $(@D) && \ $(call suitable-extractor,$(HOST_TAR_SOURCE)) $(TAR_DL_DIR)/$(HOST_TAR_SOURCE) \ | tar --strip-components=1 -xf -Quoted 5 lines
IIRC, the original reason to have host-tar was because older tar didn't
understand --strip-components. That's why tar was downloaded as a cpio archive.Later on we became fixed on one single version because newer tar would create
slightly different tarballs so the hash would be different.$ cat /etc/redhat-release Red Hat Enterprise Linux Client release 5.11 (Tikanga)$ tar --version tar (GNU tar) 1.15.1$ MANWIDTH=72 man tar--strip-components NUMBER, --strip-path NUMBER strip NUMBER of leading components from file names before extraction (1) tar-1.14 uses --strip-path, tar-1.14.90+ uses --strip-components
Quoted 5 lines
The old syntax (without "=") is supported by recent versions, so
tar --strip-components 1 -xf -would work even on the venerable RHEL 5.11.
Sorry, it's not that the old tar doesn't understand it, it's that it doesn't
work correctly. From check-host-tar.sh:
# Minimal version = 1.27 (previous versions do not correctly unpack archives
# containing hard-links if the --strip-components option is used or create
Regards,
Arnout
PATCH v4 1/1 package/tar: bump target version to 1.32 (host is kept at 1.31)
Quoted 67 lines · Arnout Vandecappelle
Quoted 54 lines · Carlos Santos
Quoted 32 lines · Arnout Vandecappelle
Quoted 21 lines · Carlos Santos
Quoted 7 lines · James Hilliard
From: Luc Creti <[email protected]>
The host tar is used to create the archives in the VCS download backends (git, cvs, svn, hg...) and tar 1.30 and forward have changed the way they generate the archives.
Quoted 8 lines
So, all the archives that have been generated before 1.30 was released are not bit-for-bit reproducible (even though the extracted content would be), so the hashes we have for those archives would not match.
Hence host-tar requires a patch to restore reproducibility.
Since there is no tar-1.32.cpio.gz available we must keep host-tar at version 1.31.
We don't actually need the cpio.gz file. We can use the installed tar, whatever it is, to extract the tar-1.32.tar.xz:
Quoted 6 lines
define
HOST_TAR_EXTRACT_CMDSmkdir -p $(@D) cd $(@D) && \ $(call suitable-extractor,$(HOST_TAR_SOURCE)) $(TAR_DL_DIR)/$(HOST_TAR_SOURCE) \ | tar --strip-components=1 -xf -Quoted 5 lines
IIRC, the original reason to have host-tar was because older tar didn't
understand --strip-components. That's why tar was downloaded as a cpio archive.Later on we became fixed on one single version because newer tar would create
slightly different tarballs so the hash would be different.$ cat /etc/redhat-release Red Hat Enterprise Linux Client release 5.11 (Tikanga)$ tar --version tar (GNU tar) 1.15.1$ MANWIDTH=72 man tar--strip-components NUMBER, --strip-path NUMBER strip NUMBER of leading components from file names before extraction (1) tar-1.14 uses --strip-path, tar-1.14.90+ uses --strip-componentsQuoted 5 lines
The old syntax (without "=") is supported by recent versions, so
tar --strip-components 1 -xf -would work even on the venerable RHEL 5.11.
Sorry, it's not that the old tar doesn't understand it, it's that it doesn't
work correctly. Fromcheck-host-tar.sh:
Quoted 6 lines
# Minimal version = 1.27 (previous versions do not correctly unpack archives
# containing hard-links if the --strip-components option is used or createRegards,
Arnout
The hard link bug would not affect host-tar, since the tar source tarball does not contain hard links: I tested it on RHEL 5.11:
$ cat /etc/redhat-release Red Hat Enterprise Linux Client release 5.11 (Tikanga) $ tar --version tar (GNU tar) 1.15.1 $ xz --version xz (XZ Utils) 4.999.9beta liblzma 4.999.9beta $ mkdir host-tar-1.32 $ xz -dc tar-1.32.tar.xz | tar --strip-components 1 -xf - -C host-tar-1.32 $ ls --width=72 host-tar-1.32 ABOUT-NLS INSTALL README build-aux gnu scripts AUTHORS Make.rules THANKS config.h.in lib src COPYING Makefile.am TODO configure m4 tests ChangeLog Makefile.in acinclude.m4 configure.ac po ChangeLog.1 NEWS aclocal.m4 doc rmt
Sorry for the very late reply. I started composing it but forgot to send.
Signature · 1 line
Carlos Santos <[email protected]>