Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 74803 - portage can't find cut
Summary: portage can't find cut
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Sandbox (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Portage team
: 85949 (view as bug list)
Depends on:
Blocks: 81031
  Show dependency tree
Reported: 2004-12-17 19:03 UTC by John Richard Moser
Modified: 2007-01-11 11:01 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---

my /etc/profile (profile,2.08 KB, text/plain)
2005-01-30 23:39 UTC, John Richard Moser
Environment that shows the problem with "cut" under the sandbox. (ebuild.env,10.87 KB, text/plain)
2005-03-19 21:10 UTC, Manuel McLure

Note You need to log in before you can comment on or make changes to this bug.
Description John Richard Moser 2004-12-17 19:03:20 UTC
>>> emerge (2 of 10) net-fs/samba-3.0.10 to /
/sbin/ line 730: cut: command not found
>>> root -sandbox(clean)

Portage 2.0.51-r8 (hardened/amd64, gcc-3.4.3, glibc-, 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/libtool:   1.5.10-r2
ACCEPT_KEYWORDS="amd64 ~amd64"
CFLAGS="-march=athlon64 -O2 -pipe -ftracer  -fweb -funit-at-a-time -fomit-frame-pointer -mfpmath=387 -mno-sse   -fno-stack-protector-all -fstack-protector"
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"
FEATURES="autoaddcvs buildpkg distlocks sandbox"
PORTDIR_OVERLAY="/usr/local/portage/olay64 /usr/local/portage/common /usr/local/portage/bmg-gnome /usr/local/portage/bmg"
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

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--
--cut here--

Imagine this script working like this:

$ ls
$ ./ 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

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
Comment 7 John Richard Moser 2005-01-17 11:47:29 UTC
I added "echo $PATH" above line 730 in

icebox ~ # echo $PATH
icebox ~ # emerge portage
Calculating dependencies ...done!
>>> emerge (1 of 1) sys-apps/portage-2.0.51-r13 to /

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

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
+ shopt -s expand_aliases
+ alias 'die=diefunc "$FUNCNAME" "$LINENO" "$?"'
+ alias 'assert=_pipestatus="${PIPESTATUS[*]}"; [[ "${_pipestatus// /}" -eq 0 ]] || diefunc "$FUNCNAME" "$LINENO"
+ 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;
+ OCC=
+ '[' GNU == GNU ']'
+ source /etc/profile.env
+ '[' -f /etc/portage/bashrc ']'
+ source /etc/portage/bashrc
++ alias usev=useq
++ '[' /usr/lib/portage/bin/ = /usr/lib/portage/bin/ -o /usr/lib/portage/bin/ = /usr/lib/portage/bin/ ']'
++ source /sbin/
+++ 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_ENDCOL=yes
+++ '[' -f /etc/conf.d/rc ']'
+++ source /etc/conf.d/rc
++++ RC_USE_FSTAB=no
++++ RC_DEVICES=auto
++++ RC_RETRY_KILL=yes
++++ svcdir=/var/lib/init.d
++++ svcmount=yes
++++ svcfstype=tmpfs
++++ svcsize=4096
+++ '[' -f /sbin/ ']'
+++ source /sbin/
+++ 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
+++ '[' '' = true ']'
+++ COLS=0
+++ ((  COLS == 0  ))
++++ stty size
++++ cut '-d ' -f2
/sbin/ 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:
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.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/libtool:   1.5.10-r4
CFLAGS="-Os -march=athlon-xp -pipe -fomit-frame-pointer"
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"
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms"
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"

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.

(/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-

LANG was set to:
dwarf / # env |grep LANG

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
revdep-rebuild --soname

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
dwarf portage # gcc --version
gcc (GCC) 3.3.5  (Gentoo Linux 3.3.5-r1, ssp-3.3.2-3, pie-
dwarf portage #  echo 3.3.5 | cut -f1,2 -d.
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