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

Bug 74803

Summary: portage can't find cut
Product: Portage Development Reporter: John Richard Moser <nigelenki>
Component: SandboxAssignee: Portage team <dev-portage>
Status: VERIFIED NEEDINFO    
Severity: normal CC: base-system, hardened, manuel
Priority: High    
Version: 2.0   
Hardware: All   
OS: All   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 81031    
Attachments: my /etc/profile
Environment that shows the problem with "cut" under the sandbox.

Description John Richard Moser 2004-12-17 19:03:20 UTC
>>> emerge (2 of 10) net-fs/samba-3.0.10 to /
/sbin/functions.sh: line 730: cut: command not found
>>> root -sandbox(clean)


Portage 2.0.51-r8 (hardened/amd64, gcc-3.4.3, glibc-2.3.4.20041102-r0, 2.6.9-pax x86_64)
=================================================================
System uname: 2.6.9-pax x86_64 AMD Athlon(tm) 64 Processor 2800+
Gentoo Base System version 1.6.8
Python:              dev-lang/python-2.3.4 [2.3.4 (#1, Oct 21 2004, 18:39:55)]
ccache version 2.3 [disabled]
dev-lang/python:     2.3.4
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.5, 1.4_p6, 1.6.3, 1.9.3, 1.7.9, 1.8.5-r2
sys-devel/binutils:  2.15.92.0.2-r2
sys-devel/libtool:   1.5.10-r2
virtual/os-headers:  2.6.8.1-r1
ACCEPT_KEYWORDS="amd64 ~amd64"
AUTOCLEAN="yes"
CFLAGS="-march=athlon64 -O2 -pipe -ftracer  -fweb -funit-at-a-time -fomit-frame-pointer -mfpmath=387 -mno-sse   -fno-stack-protector-all -fstack-protector"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=athlon64 -O2 -pipe -ftracer  -fweb -funit-at-a-time -fomit-frame-pointer -mfpmath=387 -mno-sse   -fno-stack-protector-all -fstack-protector"
DISTDIR="/home/shared/sysdirs//distfiles"
FEATURES="autoaddcvs buildpkg distlocks sandbox"
GENTOO_MIRRORS="http://open-systems.ufl.edu/mirrors/gentoo http://gentoo.mirrors.pair.com/ ftp://ftp.tu-clausthal.de/pub/linux/gentoo/"
MAKEOPTS="-j2"
PKGDIR="/home/shared/sysdirs//packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/olay64 /usr/local/portage/common /usr/local/portage/bmg-gnome /usr/local/portage/bmg"
SYNC="rsync://rsync.us.gentoo.org/gentoo-portage"
USE="3ds X aalib acl acpi alsa amd64 apm avi berkdb bitmap-fonts bmp bootsplash caps cdr composite crypt cups dlloader dmx dri dvd esd f77 fam flac gcj gdbm gif gimpprint gnome gpm gstreamer gtk gtk2 gtkhtml hal hardened imagemagick imlib ipv6 ithreads java jbig jpeg justify lcms ldap libwww lzw-tiff mad mikmod mmap mng motif mozilla moznocompose moznoirc moznomail mpeg multilib mysql ncurses nls nptl objc offensive oggvorbis openal opengl oss pam perl pic pie png ppds python quicktime readline samba sdl slang speex spell ssl tcltk tcpd theora threads tiff truetype unstable-meta usb videos wmf xchatdccserver xml xml2 xprint xv zlib"
Comment 1 Daniel Black (RETIRED) gentoo-dev 2004-12-18 04:54:38 UTC
which version of baselayout do you have installed.
Comment 2 John Richard Moser 2004-12-18 13:15:10 UTC
1.11.8

the binaries for cut are in /bin; there's a symlink to ../../bin/cut in /usr/bin/cut
Comment 3 SpanKY gentoo-dev 2004-12-18 18:38:27 UTC
what version of coreutils ?
does `cut --help` work ?
Comment 4 John Richard Moser 2005-01-05 10:55:52 UTC
Perhaps this needs clarification.

my shell can find cut.  I can run cut.  if I run emerge, it complains it can't find cut, even though I just ran it successfully.  Picture something like this:

--cut here--
#!/bin/sh
# foo.sh
ls
--cut here--

Imagine this script working like this:

$ ls
foo.sh
$ ./foo.sh
foo.sh: line 3: ls: command not found

This is the scenario going on with portage here.  cut is in my path, portage is probably clobbering the path.
Comment 5 SpanKY gentoo-dev 2005-01-05 15:19:11 UTC
well, you still havent said WHERE your cut is located

what does `which cut` show
Comment 6 John Richard Moser 2005-01-14 19:19:18 UTC
icebox ~ # which cut
/usr/bin/cut

cut is /bin/cut and /usr/bin/cut -> /bin/cut (for some odd reason).

It works if I ctrl+Z emerge and try 'cut' or 'which cut'

icebox ~ # cut
cut: you must specify a list of bytes, characters, or fields
Try `cut --help' for more information.
icebox ~ # echo "1:2" | cut -d : -f 2
2
Comment 7 John Richard Moser 2005-01-17 11:47:29 UTC
I added "echo $PATH" above line 730 in functions.sh


icebox ~ # echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/3.4.3:/usr/X11R6/bin:/opt/blackdown-jdk-1.4.2.01/bin:/opt/blackdown-jdk-1.4.2.01/jre/bin
icebox ~ # emerge portage
Calculating dependencies ...done!
>>> emerge (1 of 1) sys-apps/portage-2.0.51-r13 to /
/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/3.4.3:/usr/X11R6/bin:/opt/blackdown-jdk-1.4.2.01/bin:/opt/blackdown-jdk-1.4.2.01/jre/bin:/usr/games/bin:/opt/insight/bin


There's my path, and the path portage knows.
Comment 8 SpanKY gentoo-dev 2005-01-17 15:25:00 UTC
portage guys: any idea ?
Comment 9 Jason Stubbs (RETIRED) gentoo-dev 2005-01-29 19:49:45 UTC
Hacking of /etc/profile?
Comment 10 John Richard Moser 2005-01-30 23:39:14 UTC
Created attachment 50031 [details]
my /etc/profile

hacking of /etc/profile ?
Comment 11 John Richard Moser 2005-01-30 23:46:52 UTC
set -x at the top of ebuild.sh:


icebox ~ # emerge libsafe
Calculating dependencies ...done!
>>> emerge (1 of 1) sys-libs/libsafe-2.0_p16-r1 to /
+ export SANDBOX_PREDICT=:/proc/self/maps:/dev/console:/usr/lib/portage/pym:/dev/random
+ SANDBOX_PREDICT=:/proc/self/maps:/dev/console:/usr/lib/portage/pym:/dev/random
+ export SANDBOX_WRITE=:/dev/shm:/var/tmp
+ SANDBOX_WRITE=:/dev/shm:/var/tmp
+ export SANDBOX_READ=:/dev/shm:/var/tmp
+ SANDBOX_READ=:/dev/shm:/var/tmp
+ '[' '!' -z '' ']'
+ '[' clean '!=' depend ']'
+ '[' clean '!=' clean ']'
+ '[' -n 1 ']'
+ ARGS=clean
+ declare -rx EBUILD_PHASE=clean
+ unalias -a
+ unset GZIP BZIP BZIP2 CDPATH GREP_OPTIONS GREP_COLOR GLOBIGNORE
+ shopt -s expand_aliases
+ alias 'die=diefunc "$FUNCNAME" "$LINENO" "$?"'
+ alias 'assert=_pipestatus="${PIPESTATUS[*]}"; [[ "${_pipestatus// /}" -eq 0 ]] || diefunc "$FUNCNAME" "$LINENO"
"$_pipestatus"'
+ alias 'save_IFS=[ "${IFS:-unset}" != "unset" ] && old_IFS="${IFS}"'
+ alias 'restore_IFS=if [ "${old_IFS:-unset}" != "unset" ]; then IFS="${old_IFS}"; unset old_IFS; else unset IFS;
fi'
+ OCC=
+ OCXX=
+ '[' GNU == GNU ']'
+ source /etc/profile.env
+ '[' -f /etc/portage/bashrc ']'
+ source /etc/portage/bashrc
++ alias usev=useq
++ '[' /usr/lib/portage/bin/ebuild.sh = /usr/lib/portage/bin/ebuild.sh -o /usr/lib/portage/bin/ebuild.sh = /usr/lib/portage/bin/ebuild-daemon.sh ']'
++ source /sbin/functions.sh
+++ RC_GOT_FUNCTIONS=yes
+++ SVCDIR=/var/lib/supervise
+++ svcdir=/var/lib/init.d
+++ svclib=/lib/rcscripts
+++ svcmount=no
+++ svcfstype=tmpfs
+++ svcsize=1024
+++ deptypes='need use'
+++ ordtypes='before after'
+++ RC_QUIET_STDOUT=no
+++ RC_VERBOSE=no
+++ RC_NOCOLOR=no
+++ RC_ENDCOL=yes
+++ RC_TTY_NUMBER=11
+++ RC_NET_STRICT_CHECKING=no
+++ RC_PARALLEL_STARTUP=no
+++ RC_USE_CONFIG_PROFILE=yes
+++ RC_INDENTATION=
+++ RC_DEFAULT_INDENT=3
+++ RC_DOT_PATTERN=
+++ '[' -f /etc/conf.d/rc ']'
+++ source /etc/conf.d/rc
++++ RC_TTY_NUMBER=11
++++ RC_PARALLEL_STARTUP=yes
++++ RC_NET_STRICT_CHECKING=no
++++ RC_USE_FSTAB=no
++++ RC_DEVICES=auto
++++ RC_DEVICE_TARBALL=no
++++ RC_RETRY_KILL=yes
++++ RC_RETRY_TIMEOUT=1
++++ RC_RETRY_COUNT=5
++++ RC_FAIL_ON_ZOMBIE=no
++++ svcdir=/var/lib/init.d
++++ svcmount=yes
++++ svcfstype=tmpfs
++++ svcsize=4096
+++ '[' -f /sbin/splash-functions.sh ']'
+++ source /sbin/splash-functions.sh
+++ NET_FS_LIST='afs cifs coda ncpfs nfs nfs4 shfs smbfs'
+++ '[' -z /usr/portage/sys-libs/libsafe/libsafe-2.0_p16-r1.ebuild ']'
+++ [[ clean != *depend* ]]
++++ portageq envvar NOCOLOR
+++ RC_NOCOLOR=
+++ '[' '' = true ']'
+++ COLS=0
+++ ((  COLS == 0  ))
++++ stty size
++++ cut '-d ' -f2
/sbin/functions.sh: line 730: cut: command not found
+++ COLS=

Comment 12 Jason Stubbs (RETIRED) gentoo-dev 2005-01-31 00:04:03 UTC
Try executing /bin/cut. I'm thinking you'll get "command not found". Then try running file /bin/cut and see if anything looks unusual. Whether it does or doesn't, if you do get "command not found" grab a binpkg of coreutils and merge that.
Comment 13 John Richard Moser 2005-01-31 11:35:02 UTC
Re c12:
  http://bugs.gentoo.org/show_bug.cgi?id=74803#c6
Comment 14 Jason Stubbs (RETIRED) gentoo-dev 2005-01-31 16:01:34 UTC
Any ideas on this guys?
Comment 15 SpanKY gentoo-dev 2005-02-06 15:32:16 UTC
could you try making sure your env is sane ?

# env -i $SHELL
# source /etc/profile
# emerge blah
Comment 16 fctk86 2005-02-10 08:54:05 UTC
Portage 2.0.51-r15 (default-linux/x86/2004.3, gcc-3.4.3, glibc-2.3.4.20041102-r0, 2.6.10-gentoo-r6 i686)
=================================================================
System uname: 2.6.10-gentoo-r6 i686 AMD Athlon(tm) XP 1800+
Gentoo Base System version 1.6.9
Python:              dev-lang/python-2.3.4-r1 [2.3.4 (#1, Feb  9 2005, 21:19:48)]
ccache version 2.3 [enabled]
dev-lang/python:     2.3.4-r1
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.5, 1.7.9-r1, 1.9.4, 1.6.3, 1.8.5-r3, 1.4_p6
sys-devel/binutils:  2.15.92.0.2-r2
sys-devel/libtool:   1.5.10-r4
virtual/os-headers:  2.6.8.1-r2
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-Os -march=athlon-xp -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-Os -march=athlon-xp -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms"
GENTOO_MIRRORS="ftp://ftp.wh2.tu-dresden.de/pub/mirrors/gentoo ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ ftp://212.219.56.152/sites/www.ibiblio.org/gentoo/ http://mirrors.sec.informatik.tu-darmstadt.de/gentoo/"
LANG="it_IT.utf8"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 3dnow 3dnowex X aalib alsa apm avi bash-completion berkdb bitmap-fonts cdr crypt cups encode f77 fam flac font-server foomaticdb fortran gdbm gif gpm gtk gtk2 guile imagemagick imlib java jpeg libg++ libwww mad mikmod mmx mmx2 motif mp3 mpeg ncurses nls nptl oggvorbis opengl pdflib perl png ppds python qt quicktime readline scanner sdl slang spell sse ssl svga tcltk tcpd tiff truetype truetype-fonts type1-fonts unicode usb xml xml2 xv zlib"
Unset:  ASFLAGS, CBUILD, CTARGET, LC_ALL, LDFLAGS

i often get this when portage is emerging something:
/usr/portage/eclass/gcc.eclass: line 31: [: : integer expression expected
Comment 17 Jason Stubbs (RETIRED) gentoo-dev 2005-02-10 09:29:08 UTC
if [ "$(${CC} -dumpversion | cut -f1 -d.)" -ne 3 ] && [ "${WANT_GCC_3}" = "yes" ]
^^^ line 31

It looks like cut is failing in this case too.
Comment 18 Jason Stubbs (RETIRED) gentoo-dev 2005-03-19 20:48:51 UTC
Is everybody that is having problems using LANG="XX.UTF-8"?
Comment 19 Chris White (RETIRED) gentoo-dev 2005-03-19 20:50:01 UTC
*** Bug 85949 has been marked as a duplicate of this bug. ***
Comment 20 Manuel McLure 2005-03-19 21:08:31 UTC
In my case (see bug 85949) I'm using LANG=en_US.UTF-8.
Also, I found that if set up an evironment with the same variables that are set when the ebuild is running, cut executes but returns an empty string. With either LANG, LD_PRELOAD, or SANDBOX_ACTIVE unset, cut returns the right value:

manuel@ulthar ~ $ . /tmp/ebuild.env
manuel@ulthar MPlayer-1.0pre6a $ echo 3.3.5 | cut -f1,2 -d.

manuel@ulthar MPlayer-1.0pre6a $ unset SANDBOX_ACTIVE
manuel@ulthar MPlayer-1.0pre6a $ echo 3.3.5 | cut -f1,2 -d.
3.3

(/tmp/ebuild.env sets the environment that matches the one in the failed ebuild - I have attached it to the bug).
Comment 21 Manuel McLure 2005-03-19 21:10:33 UTC
Created attachment 53912 [details]
Environment that shows the problem with "cut" under the sandbox.
Comment 22 Manuel McLure 2005-03-24 09:40:34 UTC
Can we raise the priority/severity on this one? It struck again, this time while emerging firefox - due to the "cut" failure it failed to detect a valid version of pango, thus screwing up all my fonts.

At the moment, the sandbox is useless to me - I have to turn it off to be able to trust any of my emerges.
Comment 23 Manuel McLure 2005-03-24 16:55:01 UTC
I've had some friends try this out - it seems that if glibc and coreutils are built without the nls USE flag this is not a problem. It seems like the NLS stuff doesn't run well under the sandbox.
Comment 24 Manuel McLure 2005-03-24 21:34:01 UTC
This may be a GCC bug. If I build coreutils with -O2 instead of -Os, then the problem does not occur. Either compiler bug or bad code in "cut" that's tweaked by optimizations.
Comment 25 Juraj Ziegler 2005-04-07 02:08:58 UTC
Just to confirm the situation
I tried to emerge mplayer. Version mplayer-1.0_pre5-r5 was chosen as the last stable by emerge

It failed with the following:

 * Applying mplayer-1.0_pre5-gcc_detection.patch ...                      [ ok ]>>> Source unpacked.
 * No LINGUAS given, defaulting to English
Detected operating system: Linux
Detected host architecture: i386
Checking for cc version ... v. ?.??, bad
Checking for gcc version ... v. ?.??, bad
Checking for gcc-3.3 version ... v. ?.??, bad
Checking for gcc-3.2 version ... v. ?.??, bad
Checking for gcc-3.1 version ... v. ?.??, bad
Checking for gcc3 version ... v. ?.??, bad
Checking for gcc-3.0 version ... v. ?.??, bad
Checking for cc version ... v. ?.??, bad

*** Please downgrade/upgrade C compiler to version gcc-2.95.x or gcc-3.x! ***

Gcc is of correct version:

dwarf / # gcc --version
gcc (GCC) 3.3.5  (Gentoo Linux 3.3.5-r1, ssp-3.3.2-3, pie-8.7.7.1)


LANG was set to:
dwarf / # env |grep LANG
LANG=en_US.UTF-8


After unsetting LANG, mplayer is emerging fine (went past the configure part already)


My system has been built from stage 1 with the following CFLAGS and USE:
CFLAGS="-Os -march=pentium3 -pipe"
USE="-oss -arts -fortran -f77 -kde -gnome -qt -motif -svga dvd alsa esd apm bluetooth cdparanoia dvdread hal maildir offensive pcmcia truetype vorbis win32codecs wifi xvid ffmpeg unicode"


/bin/cut does exist and can be run:
dwarf portage # /bin/cut
/bin/cut: you must specify a list of bytes, characters, or fields


Note the following however. Though USE includes "unicode", I only added it after reading the Gentoo-UTF8-howto. At that time, I was already at stage 3 and not willing to go back and rebuild everything from scratch (pentium3, 600MHz machine). Following the howto, I did:

emerge --oneshot --verbose --ask sys-libs/ncurses sys-libs/slang
revdep-rebuild --soname libncurses.so.5
revdep-rebuild --soname libslang.so.1


Funny thing is, when I run gcc manually (normal shell environment), the version number is readable and cut seems to work:
dwarf portage # env |grep LANG
LANG=en_US.UTF-8
dwarf portage # gcc --version
gcc (GCC) 3.3.5  (Gentoo Linux 3.3.5-r1, ssp-3.3.2-3, pie-8.7.7.1)
dwarf portage #  echo 3.3.5 | cut -f1,2 -d.
3.3
Comment 26 Jason Stubbs (RETIRED) gentoo-dev 2005-04-28 00:07:08 UTC
Still an issue with the new sandbox?
Comment 27 Jason Stubbs (RETIRED) gentoo-dev 2005-07-31 03:44:41 UTC
Apparently, this is not a portage bug. sandbox? gcc? coreutils?  
Comment 28 Martin Schlemmer (RETIRED) gentoo-dev 2005-08-05 12:55:45 UTC
Rebuild coreutils with sandbox-1.2.12 installed.  If it is still an issue,
please reopen.
Comment 29 Marius Mauch (RETIRED) gentoo-dev 2007-01-11 11:01:20 UTC
Closing due to old age