Portage 2.0.51-r2 fails when a file named "tee" is in the directory emerge is run. Error message: Traceback (most recent call last): File "/usr/bin/emerge", line 2991, in ? mydepgraph.merge(mydepgraph.altlist()) File "/usr/bin/emerge", line 1809, in merge retval=portage.doebuild(y,"package",myroot,self.pkgsettings,edebug) File "/usr/lib/portage/pym/portage.py", line 2550, in doebuild return spawnebuild(mydo,actionmap,mysettings,debug,logfile=logfile) File "/usr/lib/portage/pym/portage.py", line 2177, in spawnebuild retval=spawnebuild(actionmap[mydo]["dep"],actionmap,mysettings,debug,alwaysdep=alwaysdep,logfile=logfile) File "/usr/lib/portage/pym/portage.py", line 2177, in spawnebuild retval=spawnebuild(actionmap[mydo]["dep"],actionmap,mysettings,debug,alwaysdep=alwaysdep,logfile=logfile) File "/usr/lib/portage/pym/portage.py", line 2177, in spawnebuild retval=spawnebuild(actionmap[mydo]["dep"],actionmap,mysettings,debug,alwaysdep=alwaysdep,logfile=logfile) File "/usr/lib/portage/pym/portage.py", line 2177, in spawnebuild retval=spawnebuild(actionmap[mydo]["dep"],actionmap,mysettings,debug,alwaysdep=alwaysdep,logfile=logfile) File "/usr/lib/portage/pym/portage.py", line 2177, in spawnebuild retval=spawnebuild(actionmap[mydo]["dep"],actionmap,mysettings,debug,alwaysdep=alwaysdep,logfile=logfile) File "/usr/lib/portage/pym/portage.py", line 2193, in spawnebuild droppriv=actionmap[mydo]["args"][1],logfile=logfile) File "/usr/lib/portage/pym/portage.py", line 1507, in spawn return portage_exec.spawn_bash(mystring,env=env,**keywords) File "/usr/lib/portage/pym/portage_exec.py", line 44, in spawn_bash return spawn(args,env=env,opt_name=opt_name,**keywords) File "/usr/lib/portage/pym/portage_exec.py", line 86, in spawn mypid.extend(spawn(('tee','-i','-a',logfile),returnpid=True,fd_pipes={0:pr,1:1,2:2})) File "/usr/lib/portage/pym/portage_exec.py", line 167, in spawn raise str(e)+":\n "+myc+" "+string.join(myargs) [Errno 13] Permission denied: tee tee -i -a /var/log/portage/2161-genkernel-3.1.0a.log Reproducible: Always Steps to Reproduce: 1. Upgrade portage to latest (2.0.51-r2) 2. Create a file in the working directory named "tee" (touch tee) 3. Attempt to emerge anything (emerge -U world) Actual Results: Emerge produced the error log above, most notably the following: [Errno 13] Permission denied: tee tee -i -a /var/log/portage/(package being merged) Expected Results: Ignored the file in the current directory and executed /bin/tee Portage 2.0.51-r2 (default-x86-2004.0, gcc-3.3.4, glibc-2.3.4.20040808-r1, 2.4.26- gentoo-r9 i686) ================================================================= System uname: 2.4.26-gentoo-r9 i686 Mobile AMD Athlon(tm) XP 1500+ Gentoo Base System version 1.4.16 Autoconf: sys-devel/autoconf-2.59-r5 Automake: sys-devel/automake-1.8.5-r1 Binutils: sys-devel/binutils-2.14.90.0.8-r1 Headers: sys-kernel/linux-headers-2.4.21-r1 Libtools: sys-devel/libtool-1.5.2-r5 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CFLAGS="-mcpu=athlon-xp -O3 -pipe" CHOST="i686-pc-linux-gnu" COMPILER="" CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/share/config /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-mcpu=athlon-xp -O3 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs buildpkg ccache distcc distlocks notitles sandbox userpriv usersandbox" GENTOO_MIRRORS="ftp://gentoo.ccccom.com http://gentoo.ccccom.com http://mirrors.tds.net/gentoo ftp://mirrors.tds.net/gentoo" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="3dnow 3dnowext X acpi apm arts avi berkdb bitmap-fonts cdr crypt dvd encode esd f77 foomaticdb gdbm gif gtk2 imlib jpeg kde libg++ libwww mad mikmod mmx motifmpeg ncurses nls oggvorbis opengl oss pam pcmcia pdflib perl png python qt quicktime readline sdl slang spell sse ssl svga tcpd truetype x86 xml2 xmms xprint xv zlib"
I got the same error on my box. Please note that it not just fails, but tries to execute the file with root-permissions. I think this bug is also a security-issue. PS: Shouldn't the "Hardware"-field of this bug be changed from x86 to all?
Do either of you have PATH="." ?
No, '.' is not in PATH.
With portage-2.0.51.22-r2 I have to "chmod +x tee" in order to reproduce this error. There must be a subtle bug in portage_exec.find_binary().
Created attachment 64810 [details, diff] portage-2.0.51.22-spawn-path_lookup.patch This patch adds a test to see if myc is an absolute path or not. The problem is in this section at the beginning of portage_exec.spawn() where it can skip the path lookup if there is an executable file with the same name in the current directory. if not os.access(myc, os.X_OK): if not path_lookup: return None myc = find_binary(myc) if myc == None: return None
Fixed in 2.0.53