From edfd3bc4c1057be0b5553b5789a44f1b77bb2b45 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Sun, 17 Feb 2013 16:42:46 +0100 Subject: tar: format 'ustar' cannot support UID/GID longer than 21 bits See automake bug#8343 and bug#13588. POSIX 1988 'ustar' format is defined with *fixed-size* fields. There is notably a 21 bits limit (2097151) for the UID and the GID. Tom Rini tom_rini@mentor.com says (in bug#8343): When the user has a UID or GID that is larger than the ustar format supports, pax does not error out gracefully in some cases (FC13). Marc Herbert adds (in bug#8343): When "configure" is run by a user with an UID bigger than 21 bits, BSD pax 3.4 aborts when trying to create the 'conftest.tar' test archive and leaves an empty or corrupted conftest.tar file behind. In the next step, pax tries to extract this incomplete or corrupted archive and this *** hangs the whole ./configure script ***. Note: GNU cpio 2.9 pretends to pass the test but it is a LIE: it silently truncates any big UID to its lower 21 bits. I don't know what can be the consequences of this lie. I think there is currently a design issue in automake/m4/tar.m4 considering that a ustar archive should should *never* succeed when ./configure is run from a big user ID. Months later, Petr Hracek reports a similar issue (in bug#13588) for Fedora 17: I am trying to solve problem in case a user is created with big UID and during configuration pax hangs with message ATTENTION! pax archive volume change required. Ready for archive volume: 1 Input archive name or "." to quit pax. Archive name > and needs user interaction. Reference: Time to fix this issue, on the line of a preliminary patch provided by Petr Hracek in bug#13588. The final patch ended up being remarkably different from that original proposition, though. * m4/tar.m4 (_AM_PROG_TAR): If the UID or GID of the current user is too high (> 2097151), the 'ustar' format cannot work. Adjust checks accordingly. Some related code reordering and clean-up. * t/tar-ustar-id-too-high.sh: New test. * t/list-of-tests.mk: Add it. * t/tar.sh: While at it, tweak and enhance a little. * t/tar2.sh: Likewise. * t/tar3.sh: Likewise. * t/tar-override.sh: Likewise. * NEWS: Update. * THANKS: Likewise. Helped-by: Pavel Raiskup Helped-by: Petr Hracek Helped-by: Marc Herbert Helped-by: Tom Rini Signed-off-by: Stefano Lattarini --- t/tar-override.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 't/tar-override.sh') diff --git a/t/tar-override.sh b/t/tar-override.sh index 863b9ab11..bbf3fbb86 100755 --- a/t/tar-override.sh +++ b/t/tar-override.sh @@ -16,8 +16,8 @@ # Check that the user can override the tar program used by "make dist" # at runtime, by redefining the 'TAR' environment variable. -# FIXME: currently this works only when the tar format used is 'v7' -# FIXME: (which is the default one). +# NOTE: currently this works only when the tar format used is 'v7' +# (which is the default one). . test-init.sh @@ -35,6 +35,7 @@ chmod a+x am--tar cat > Makefile.am <<'END' check-local: dist + ls -l ;: For debugging. test -f am--tar-has-run CLEANFILES = am--tar-has-run END @@ -44,22 +45,24 @@ $AUTOCONF $AUTOMAKE ./configure +clean_temp () { rm -f *.tar.* *has-run*; } + $MAKE dist -test -f $me-1.0.tar.gz +test -f $distdir.tar.gz ls | grep has-run && exit 1 -rm -f *.tar.* *has-run* +clean_temp TAR="$cwd/am--tar foo" $MAKE distcheck -test -f $me-1.0.tar.gz +test -f $distdir.tar.gz test "$(cat am--tar-has-run)" = foo -rm -f *.tar.* *has-run* +clean_temp TAR=; unset TAR # Creative use of eval to pacify maintainer checks. eval \$'MAKE dist "TAR=./am--tar mu"' -test -f $me-1.0.tar.gz +test -f $distdir.tar.gz test "$(cat am--tar-has-run)" = mu : -- cgit v1.2.1