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

Bug 447638

Summary: Building packages as normal user with fakeroot sometimes fails due to tar complaining about "Too many levels of symbolic links"
Product: Portage Development Reporter: James C. Georgas <james.georgas>
Component: CoreAssignee: Portage team <dev-portage>
Severity: major CC: base-system
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Package list:
Runtime testing required: ---
Attachments: environment file for ebuild
build log for ebuild

Description James C. Georgas 2012-12-17 20:07:18 UTC
The following command fails when run as a normal user, with FEATURES="fakeroot":

        PKGDIR=/tmp/mypkg emerge -B gawk

tar complains about too many levels of symbolic links.

Reproducible: Always

Steps to Reproduce:
1. Add fakeroot to FEATURES in make.conf
2. mkdir /tmp/mypkg
3. PKGDIR=/tmp/mypkg emerge -B gawk
Actual Results:  
package phase of ebuild failed with tar error about too many levels of symbolic links.

Expected Results:  
successful binpkg creation.

emerge --info '=sys-apps/gawk-4.0.1':

Portage (default/linux/amd64/10.0/desktop/gnome, gcc-4.5.4, glibc-2.15-r3, 3.5.7-gentoo x86_64)
                         System Settings
System uname: Linux-3.5.7-gentoo-x86_64-AMD_Opteron-tm-_Processor_246-with-gentoo-2.1
Timestamp of tree: Sun, 16 Dec 2012 20:00:01 +0000
ld GNU ld (GNU Binutils) 2.22
app-shells/bash:          4.2_p37
dev-lang/python:          2.7.3-r2, 3.2.3
dev-util/cmake:           2.8.9
dev-util/pkgconfig:       0.27.1
sys-apps/baselayout:      2.1-r1
sys-apps/openrc:          0.11.8
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.11.6
sys-devel/binutils:       2.22-r1
sys-devel/gcc:            4.5.4
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.6 (virtual/os-headers)
sys-libs/glibc:           2.15-r3
Repositories: gentoo x-portage
CFLAGS="-march=opteron -O2 -pipe -fomit-frame-pointer"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /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="-march=opteron -O2 -pipe -fomit-frame-pointer"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fakeroot fixlafiles merge-sync news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -pipe"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
USE="3dnow 3dnowext X a52 aac acl acpi alsa amd64 bash-completion branding bzip2 cairo cdda cdr cjk cli colord consolekit cracklib crypt cups cxx dbus dri dts dvd dvdr eds emboss encode evo exif firefox flac fortran gdbm gif gnome gnome-keyring gnome-online-accounts gpm gstreamer gtk iconv ipv6 jpeg lcms libnotify lm_sensors mad mmx mmxext mng modules mp3 mp4 mpeg mudflap multilib nautilus ncurses nls nptl ogg opengl openmp pam pango pcre pdf png policykit ppds pppd readline sdl session socialweb spell sse sse2 ssl startup-notification svg tcpd tiff truetype udev udisks unicode upower usb vorbis wxwidgets x264 xcb xml xv xvid zlib" ALSA_CARDS="emu10k1 intel8x0 usb-audio" 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="authn_core authz_core socache_shmcb unixd 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" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" 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 evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" PHP_TARGETS="php5-3" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="fbdev r300 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"

                        Package Settings

sys-apps/gawk-4.0.1 was built with the following:
USE="(multilib) nls readline"

emerge -pqv '=sys-apps/gawk-4.0.1':

[ebuild   R   ] sys-apps/gawk-4.0.1  USE="nls readline"
Comment 1 James C. Georgas 2012-12-17 20:09:14 UTC
Created attachment 332594 [details]
environment file for ebuild
Comment 2 James C. Georgas 2012-12-17 20:10:04 UTC
Created attachment 332596 [details]
build log for ebuild
Comment 3 Zac Medico gentoo-dev 2012-12-18 02:06:13 UTC
It seems like it must be a bug in fakeroot, tar, or the interaction between them.
Comment 4 James C. Georgas 2012-12-18 03:09:40 UTC
My money's on fakeroot. Overriding syscalls is a bit heavyhanded. Perhaps some kind of FUSE/libarchive filesystem in the staging area would be better?
Comment 5 Doug Goldstein gentoo-dev 2012-12-18 15:19:36 UTC
I've seen this before when making my own chroot to compile things into. I forget exactly but for a while some of the utilities we had I believe 4 symlinks to get to the actual binary. If you copied that whole directory structure in for building you'd easily hit the Linux max of 5.

Not that this helps much, but it was something specific with our setup and I've been trying to get packages to not go that deep.
Comment 6 James C. Georgas 2012-12-18 16:38:37 UTC
The weird thing is that, for the gawk example cited here, there's another symlink in the same directory as the symlink that errored out, but it looks like that one tarred up just fine. I don't even know what to think about that.

Anyway, I've been looking at the FUSE tutorial, and it actually looks like it'll be pretty easy to code something up to do the same thing as fakeroot without messing with the system glibc or using symlinks.
Comment 7 SpanKY gentoo-dev 2012-12-18 19:05:57 UTC
i wonder how fakeroot interacts with sandbox
Comment 8 Zac Medico gentoo-dev 2012-12-18 19:12:05 UTC
(In reply to comment #7)
> i wonder how fakeroot interacts with sandbox

Currently, fakeroot disables sandbox inside the spawn function in pym/portage/package/ebuild/
Comment 9 Joakim Tjernlund 2014-07-21 13:53:01 UTC
Have a look at
Comment 10 Zac Medico gentoo-dev 2015-04-11 17:46:38 UTC

*** This bug has been marked as a duplicate of bug 489016 ***