Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 342681

Summary: app-arch/tar-1.24 testsuite failures with FEATURES="sandbox"
Product: Gentoo Linux Reporter: Ryan Hill (RETIRED) <rhill>
Component: New packagesAssignee: Sandbox Maintainers <sandbox>
Status: RESOLVED FIXED    
Severity: normal CC: base-system, brant, kanelxake, krinpaus
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 342983    
Bug Blocks:    
Attachments: testsuite.log
$ tar -C out -xf archive.tar --exclude='*.txt' --warning=no-timestamp > sandbox-debug.log 2>&1

Description Ryan Hill (RETIRED) gentoo-dev 2010-10-26 00:59:15 UTC
20: exclude: long files in pax archives             FAILED (exclude06.at:29)
32: extracting symlinks to a read-only dir          FAILED (extrac07.at:30)
35: -C and delayed setting of metadata              FAILED (extrac10.at:30)

Portage 2.2.0_alpha1 (default/linux/amd64/10.0/developer, gcc-4.5.1, glibc-2.12.1-r1, 2.6.36-gentoo x86_64)
=================================================================
System uname: Linux-2.6.36-gentoo-x86_64-Intel-R-_Core-TM-2_Duo_CPU_T9300_@_2.50GHz-with-gentoo-2.0.1
Timestamp of tree: Tue, 26 Oct 2010 00:30:22 +0000
ccache version 3.0.1 [enabled]
app-shells/bash:     4.1_p9
dev-java/java-config: 2.1.11-r1
dev-lang/python:     2.5.4-r4, 2.6.6-r1, 2.7, 3.1.2-r4
dev-util/ccache:     3.0.1::halo-overlay
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.6.3
sys-apps/sandbox:    2.3-r1
sys-devel/autoconf:  2.13, 2.68
sys-devel/automake:  1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.51.0.11
sys-devel/gcc:       4.1.2, 4.3.5::dirtyepic, 4.4.5, 4.4.6_pre9999::toolchain, 4.5.1::dirtyepic, 4.5.2_pre9999::toolchain
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.10
sys-devel/make:      3.82
virtual/os-headers:  2.6.35 (sys-kernel/linux-headers)
Repositories: gentoo halo-overlay dirtyepic gcc-porting toolchain
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-unknown-linux-gnu"
CFLAGS="-O2 -march=core2 -msse4.1 -mcx16 -msahf --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=6144 -mtune=generic -pipe -ftree-vectorize"
CHOST="x86_64-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -march=core2 -msse4.1 -mcx16 -msahf --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=6144 -mtune=generic -pipe -ftree-vectorize"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y"
FEATURES="assume-digests binpkg-logs ccache distlocks fixlafiles fixpackages multilib-strict news parallel-fetch preserve-libs protect-owned sandbox sfperms sign split-log splitdebug strict test test-fail-continue unknown-features-warn unmerge-orphans userfetch userpriv usersandbox usersync"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distfiles.gentoo.org/"
LANG="en_US.utf8"
LC_ALL="en_US.utf8"
LDFLAGS="-Wl,--hash-style=gnu -Wl,-O1 -Wl,--as-needed"
LINGUAS="en en_US"
MAKEOPTS="-j3 V=1"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/home/dirtyepic/overlay /home/dirtyepic/svn/dirtyepic /home/dirtyepic/svn/gcc-porting /home/dirtyepic/svn/toolchain"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"

Unset:  CPPFLAGS, CTARGET, FFLAGS, INSTALL_MASK, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Ryan Hill (RETIRED) gentoo-dev 2010-10-26 01:01:09 UTC
Created attachment 251973 [details]
testsuite.log
Comment 2 Ryan Hill (RETIRED) gentoo-dev 2010-10-26 01:11:07 UTC
with manual make check as root 20 and 35 pass, 32 is skipped.
Comment 3 Ryan Hill (RETIRED) gentoo-dev 2010-10-26 01:21:19 UTC
All pass with FEATURES="-sandbox -usersandbox userpriv".
Comment 4 Brant Gurganus 2010-10-26 22:45:29 UTC
I tried looking into why sandbox was causing failures, but I was unable to figure it out. As far as I could tell, the tests aren't doing anything to violate the sandbox.

As far as
20: exclude: long files in pax archives             FAILED (exclude06.at:29)

I was able to manually go through the steps that Autotest runs and reproduce the issue. It creates the tar fine, but sandbox is causing a failure extracting it.
Comment 5 Xake 2010-10-27 07:34:38 UTC
Created attachment 252161 [details]
$ tar -C out -xf archive.tar --exclude='*.txt' --warning=no-timestamp > sandbox-debug.log 2>&1

This is a SANDBOX_DEBUG log of the offending command.

For some reason it seems like the mkdir function pokes around in the "<current directory>" instead of in "<current directory>/out" as it is supposed to.
Comment 6 Xake 2010-10-27 07:46:16 UTC
One other interesting aspect is that if you remove the "<current dir>/one" sandbox (or tar?) does not recurse down it, but creates the files fine inside of "<current dir>/out" as it should.

POC is the following patch which makes the testsuite pass:

diff --git a/tests/exclude06.at b/tests/exclude06.at
index b1c0da7..89c5b4d 100644
--- a/tests/exclude06.at
+++ b/tests/exclude06.at
@@ -32,6 +32,7 @@ genfile --length 20 -f test_base_dir[/1.txt]
 genfile --length 20 -f test_base_dir[/1.c]
 
 tar cf archive.tar test_base_dir
+rm -rf one
 mkdir out
 tar -C out -xf archive.tar --exclude='*.txt' --warning=no-timestamp
 find out -type f


So for some reason it recurs down the wrong path, but only if that path already exists.
Comment 7 Xake 2010-10-27 09:22:10 UTC
After some stracing it seems like without sandbox no matter if "<cwd>/one" exists or not you get:

openat(AT_FDCWD, "out", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 4
mkdirat(4, "one/two/three/four/five/six/seven/eight/nine/ten/eleven/twelve/thirteen/fourteen/fifteen/sixteen/seventeen", 0755) = -1 ENOENT (No such file or directory)


(observe the ENOENT which is the same when "<cwd>/one" exists and thus it seems like it looks inside "<cwd>/out")

While with running strace inside sandbox and "<cwd>/one" removed:

openat(AT_FDCWD, "out", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 4
getcwd("/home/xake/devel/tar/tests/testsuite.dir/020/pax", 8192) = 49
lstat("/home/xake/devel/tar/tests/testsuite.dir/020/pax", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/home/xake/devel/tar/tests/testsuite.dir/020/pax", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/home/xake/devel/tar/tests/testsuite.dir/020/pax/one/two/three/four/five/six/seven/eight/nine/ten/eleven/twelve/thirteen/fourteen/fifteen/sixteen/seventeen", 0x7deec45b9c90) = -1 ENOENT (No such file or directory)


(observe how with sandbox it looks inside "<cwd>/one" instead of "<cwd>/out/one")

When "<cwd>/one/..." exists it seems to confuse the hell out of sandbox, and for some reason every time it lstat "<cwd>/out/one" and fails it recurse with lstat down the path of "<cwd>/one/..." instead, while if you have removed "<cwd>/one" it only tries that directory that one time.
Comment 8 SpanKY gentoo-dev 2010-10-28 01:15:50 UTC
pretty much a dupe of Bug 342983, but i'll keep this open for now to avoid other people filing more dupes
Comment 9 SpanKY gentoo-dev 2010-11-26 22:22:42 UTC
should retest with sandbox-2.4 ...