Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bugzilla DB migration completed. Please report issues to Infra team via email via infra@gentoo.org or IRC

Bug 342735

Summary: app-arch/tar-1.24{,-r1} fails to extract files when running in sandbox and -C option used
Product: Gentoo Linux Reporter: ferret <ferret-bgo>
Component: New packagesAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED FIXED    
Severity: major CC: Ikonta, itrombley, pappy_mcfae
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: http://lists.gnu.org/archive/html/bug-tar/2010-10/msg00036.html
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: tar-1.24-target-directory.patch

Description ferret 2010-10-26 10:17:18 UTC
app-arch/tar-1.24 fails to extract files when running in sandbox and -C option used.  It silently fails at the mkdir() stage.  sandbox DOESN'T print any errors.  cd'ing into the directory and then using tar makes it not fail.

Does not happen with tar-1.23-r4.  Discovered this because some strange code in portage-multilib started failing.  Obviously this is a serious issue though, who knows where tar -C might be used in ebuilds?  I would suggest MASKING this version of tar until this is fixed.

PLEASE NOTE ALSO bugs #342593 and #342681 which are also issues between this version of tar and sandbox.  The fix in the former of these only fixes a symptom of an underlying problem.  The issue I am describing is reproducable before and after the change introduced in that bug.

*** Steps to reproduce (confirmed on another gentoo system):  ***

ferret@jupiter ~/tmp $ sandbox
============================= Gentoo path sandbox ==============================
Detection of the support files.
Verification of the required files.
Setting up the required environment variables.
The protected environment has been started.
--------------------------------------------------------------------------------
Process being started in forked instance.

 * Loading sandboxed shell
 *  Log File:           /var/log/sandbox/sandbox-24246.log
 *  Debug Log File:     /var/log/sandbox/sandbox-debug-24246.log
 *  sandboxon:          turn sandbox on
 *  sandboxoff:         turn sandbox off
 *  addread <path>:     allow <path> to be read
 *  addwrite <path>:    allow <path> to be written
 *  adddeny <path>:     deny access to <path>
 *  addpredict <path>:  allow fake access to <path>

[s] ferret@jupiter ~/tmp $ mkdir foo
[s] ferret@jupiter ~/tmp $ touch foo/bar
[s] ferret@jupiter ~/tmp $ tar cf baz.tar foo/
[s] ferret@jupiter ~/tmp $ mkdir out
[s] ferret@jupiter ~/tmp $ tar xf baz.tar -C out/
tar: foo/bar: Cannot open: No such file or directory
tar: foo: Cannot utime: No such file or directory
tar: foo: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
[s] ferret@jupiter ~/tmp $

==========================

ferret@jupiter ~/tmp $ emerge --info
Portage 2.2_rc99-r1 (default/linux/amd64/10.0/desktop, gcc-4.4.5, glibc-2.12.1-r1, 2.6.35.2 x86_64)
=================================================================
System uname: Linux-2.6.35.2-x86_64-AMD_Turion-tm-_64_Mobile_ML-34-with-gentoo-2.0.1
Timestamp of tree: Mon, 25 Oct 2010 20:15:02 +0000
app-shells/bash:     4.1_p9
dev-java/java-config: 2.1.11
dev-lang/python:     2.6.6-r1, 3.1.2-r4
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.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.5
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 local multilib
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA ut2003 dlj-1.1 AdobeFlash-10.1 AdobeFlash-10"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=athlon64 -O2 -pipe -fomit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/portage /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="-march=athlon64 -O2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y"
FEATURES="assume-digests binpkg-logs buildpkg collision-protect distlocks fixlafiles fixpackages news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox"
GENTOO_MIRRORS="http://www.mirrorservice.org/sites/www.ibiblio.org/gentoo/ http://gentoo.mirror.sdv.fr http://ftp.heanet.ie/pub/gentoo/"
LANG="en_GB.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en_GB en"
MAKEOPTS="-j2"
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="/usr/local/portage/junk /usr/local/portage/multilib-overlay"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext X a52 aac aalib acpi alsa amd64 avi bash-completion berkdb bittorrent bluetooth branding bzip2 cairo cdparanoia cdr cleartype cli cracklib crypt curl cxx divx dri dvd dvdnav dvdr emboss encode exif expat fam fbcon ffmpeg firefox flac flash fontconfig ftp gdbm gif gmp gnutls gpm gtk gtk2 iconv id3 imap imlib java javascript jikes jpeg kpathsea lame lcms libcaca libnl libwww lua lzo mad mikmod mmx mmxext mng modules motif mp3 mp4 mpeg mudflap multilib multilib_abi_amd64 music ncurses nptl nptlonly nss ogg oggvorbis opengl openmp openssl pango pcre pdf pdflib perl png ppds python quicktime readline rtc samba sdl session sse sse2 ssl svg sysfs tcpd theora tiff truetype unicode usb videos vim-syntax vorbis win32 wmf x264 xcb xft xml xml2 xorg xosd xulrunner xv xvid zlib" ALSA_CARDS="atiixp" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev keyboard mouse" KERNEL="linux" LCD_DEVICES="ncurses text" LINGUAS="en_GB en" MULTILIB_ABIS="amd64 x86" PHP_TARGETS="php5-2" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="radeon vesa" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Lars Wendler (Polynomial-C) gentoo-dev 2010-10-26 11:18:41 UTC
See URL for a possible fix...
Comment 2 Samuli Suominen gentoo-dev 2010-10-26 11:34:22 UTC
=app-arch/tar-1.24 p.masked until this is solved, this breaks kde-base/* as the kde4 eclass makes use of tar in this way.
Comment 3 Lars Wendler (Polynomial-C) gentoo-dev 2010-10-26 11:39:22 UTC
Created attachment 252019 [details, diff]
tar-1.24-target-directory.patch

I just gave this patch a try on my test systems and it seems to work. 
Please be aware that this patch only fixes the -C switch. There are more changes necessary to make the test suite happy.
Comment 4 Samuli Suominen gentoo-dev 2010-10-26 15:45:39 UTC
*** Bug 342721 has been marked as a duplicate of this bug. ***
Comment 5 Samuli Suominen gentoo-dev 2010-10-26 16:26:08 UTC
Comment on attachment 252019 [details, diff]
tar-1.24-target-directory.patch

http://git.savannah.gnu.org/cgit/tar.git/patch/?id=acb77ac5bd4bf9248070c9c512525eee8258aebd
Comment 6 Samuli Suominen gentoo-dev 2010-10-27 18:20:09 UTC
+*tar-1.24-r1 (27 Oct 2010)
+
+  27 Oct 2010; Samuli Suominen <ssuominen@gentoo.org> +tar-1.24-r1.ebuild,
+  +files/tar-1.24-mkdirat.patch, +files/tar-1.24-transform.patch,
+  +files/tar-1.24-transform-2.patch:
+  Fix -C switch wrt #342735 by "ferret". Fix --transform switch wrt #342785.
Comment 7 Thomas Sachau gentoo-dev 2010-10-30 12:29:52 UTC
I can still reproduce this issue with tar-1.24-r1, so reopening the bug.
The tests and results as already reported by ferret do still apply here.
Comment 8 Thomas Sachau gentoo-dev 2010-10-30 12:32:20 UTC
emerge --info:

Portage 2.2.0_alpha2-r1 (hardened/linux/amd64/10.0, gcc-4.5.1, glibc-2.12.1-r1, 2.6.35-hardened-r5 x86_64)
=================================================================
System uname: Linux-2.6.35-hardened-r5-x86_64-Intel-R-_Core-TM-2_Quad_CPU_Q6600_@_2.40GHz-with-gentoo-2.0.1
Timestamp of tree: Sat Oct 30 07:39:20 CEST 2010
ccache version 2.4 [disabled]
app-shells/bash:     4.1_p9
dev-java/java-config: 2.1.11-r1
dev-lang/python:     2.6.6-r1, 2.7
dev-util/ccache:     2.4-r8
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.4_p6-r1, 1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.5, 4.5.1
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 java-overlay enlightenment hardened-dev science sunrise multilib Meins
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /var/lib/hsqldb"
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"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/home/thomas/daten/distfiles"
EMERGE_DEFAULT_OPTS="--keep-going --backtrack=6"
FEATURES="assume-digests binpkg-logs collision-protect distlocks fixlafiles fixpackages metadata-transfer news parallel-fetch preserve-libs protect-owned sandbox sfperms sign strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox"
GENTOO_MIRRORS="http://ftp.spline.inf.fu-berlin.de/mirrors/gentoo/ ftp://ftp.uni-erlangen.de/pub/mirrors/gentoo ftp://ftp.snt.utwente.nl/pub/os/linux/gentoo"
INSTALL_MASK="/usr/share/gtk-doc"
LANG="de_DE.UTF-8@euro"
LC_ALL="de_DE.UTF-8@euro"
LDFLAGS="-Wl,--as-needed -Wl,--hash-style=gnu"
LINGUAS="de"
MAKEOPTS="-j5 --load-average=8"
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="/usr/local/portage/layman/java-overlay /usr/local/portage/layman/enlightenment /usr/local/portage/layman/hardened-development /usr/local/portage/layman/science /usr/local/portage/layman/sunrise /usr/local/portage/layman/multilib /usr/local/portage"
SYNC="cvs://tommy@cvs.gentoo.org:/var/cvsroot"
USE="3dnow X alsa amd64 berkdb cli cracklib crypt cups custom-cflags custom-cxxflags custom-optimization cxx dri gpm hardened java5 java6 justify mmx modules mudflap multilib multilib_abi_amd64 multilib_abi_x86 ncurses nls nptl nptlonly nsplugin ogg opengl openmp pam pic pppd readline scanner session sse sse2 ssl sysfs tcpd unicode urandom vorbis xorg zlib" ALSA_CARDS="hda-intel" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="de" MULTILIB_ABIS="amd64 x86" PHP_TARGETS="php5-2" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 
Unset:  CPPFLAGS, CTARGET, FFLAGS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 9 Samuli Suominen gentoo-dev 2010-10-30 12:52:04 UTC
(In reply to comment #7)
> I can still reproduce this issue with tar-1.24-r1, so reopening the bug.
> The tests and results as already reported by ferret do still apply here.
> 

propably different issue, try the patch from 
http://bugs.gentoo.org/show_bug.cgi?id=342983#c3
Comment 10 Thomas Sachau gentoo-dev 2010-10-30 13:53:40 UTC
Ok, there seem to be 2 bugs with the same output, one in tar-1.24 and another one in sandbox-2.3. See https://bugs.gentoo.org/show_bug.cgi?id=342983#c3 for a patch against sandbox-2.3 for a patch against sandbox, which fixes the issue with tar-1.24-r1
Comment 11 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2010-12-10 18:06:01 UTC
*** Bug 343921 has been marked as a duplicate of this bug. ***