Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 71799 - portage-2.0.51-r3: unpack as non-root causes tracback.
Summary: portage-2.0.51-r3: unpack as non-root causes tracback.
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Ebuild Support (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2004-11-19 15:01 UTC by Tuan Van (RETIRED)
Modified: 2005-07-14 06:58 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tuan Van (RETIRED) gentoo-dev 2004-11-19 15:01:51 UTC
$ groups
tty wheel cron audio games users portage
$ ebuild /usr/portage/mail-filter/maildrop/maildrop-1.7.0.20040907.ebuild unpack
Traceback (most recent call last):
  File "/usr/bin/ebuild", line 49, in ?
    a=portage.doebuild(pargs[0],x,getroot(),tmpsettings,debug=debug,cleanup=cleanup)
  File "/usr/lib/portage/pym/portage.py", line 2330, in doebuild
    os.chown(mysettings["BUILD_PREFIX"],portage_uid,portage_gid)
OSError: [Errno 1] Operation not permitted: '/var/tmp/portage'

$ emerge info
Portage 2.0.51-r3 (default-linux/x86/2004.2/gcc34/2.6, gcc-3.4.3, glibc-2.3.4.20041102-r0, 2.6.10-rc1 i686)
=================================================================
System uname: 2.6.10-rc1 i686 Intel(R) Pentium(R) 4 CPU 1.80GHz
Gentoo Base System version 1.6.6
distcc 2.18.2 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [enabled]
ccache version 2.3 [enabled]
Autoconf: sys-devel/autoconf-2.59-r5
Automake: sys-devel/automake-1.8.5-r1
Binutils: sys-devel/binutils-2.15.92.0.2-r1
Headers:  sys-kernel/linux26-headers-2.6.8.1-r1
Libtools: sys-devel/libtool-1.5.2-r7
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-O2 -march=pentium4 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
COMPILER=""
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/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/bind /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -march=pentium4 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache collision-protect cvs distcc distlocks parallel-fetch prelink sandbox sfperms sign strict userpriv usersandbox verify-rdepend"
GENTOO_MIRRORS="http://gentoo.osuosl.org"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/overlay"
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
USE="X apm arts avi berkdb bitmap-fonts crypt dba encode f77 fam foomaticdb fortran gd gd-external gdbm gif guile hal imlib java jpeg junit kde ldap libg++ libwww mikmod mmx mpeg ncurses nls pam pdflib perl png postgres python qt readline real samba sdl session slang spell sse ssl tcpd tiff truetype unicode x86 xml2 xmms xv zlib"
Comment 1 Nicholas Jones (RETIRED) gentoo-dev 2005-02-28 09:09:22 UTC
Still a problem?
Comment 2 Tuan Van (RETIRED) gentoo-dev 2005-02-28 09:12:05 UTC
yes.

tvan@localhost /usr/portage/mail-mta/postfix $ ebuild postfix-2.2_beta20050218.ebuild unpack
Traceback (most recent call last):
  File "/usr/bin/ebuild", line 49, in ?
    a=portage.doebuild(pargs[0],x,getroot(),tmpsettings,debug=debug,cleanup=cleanup)
  File "/usr/lib/portage/pym/portage.py", line 2407, in doebuild
    os.chown(mysettings["BUILD_PREFIX"],portage_uid,portage_gid)
OSError: [Errno 1] Operation not permitted: '/var/tmp/portage'
Comment 3 Alec Warner (RETIRED) archtester gentoo-dev Security 2005-05-21 14:27:54 UTC
interestingly it works great via the command line, but my little test script 
fails.

skyfw@kyoto skyfw $ ./test.py
Traceback (most recent call last):
  File "./test.py", line 4, in ?
    os.chown( "/var/tmp/portage",250,250)
OSError: [Errno 1] Operation not permitted: '/var/tmp/portage'
skyfw@kyoto skyfw $ chown portage:portage /var/tmp/portage
skyfw@kyoto skyfw $ ./test.py
Traceback (most recent call last):
  File "./test.py", line 4, in ?
    os.chown( "/var/tmp/portage",250,250)
OSError: [Errno 1] Operation not permitted: '/var/tmp/portage'
skyfw@kyoto skyfw $ cat test.py
#!/usr/bin/python
import os

os.chown( "/var/tmp/portage",250,250)
Comment 4 Alec Warner (RETIRED) archtester gentoo-dev Security 2005-05-21 14:50:50 UTC
Ah, found my mistake

the chown from the shell was failing silently.  a quickie C program turns up a 
OPERATION NOT PERMITTED return code.
Comment 5 Ian Leitch (RETIRED) gentoo-dev 2005-05-21 15:17:22 UTC
Alec, you need to wrap the os.chown around something. if os.getuid() == 0 should
be fine. 
Comment 6 Jason Stubbs (RETIRED) gentoo-dev 2005-05-21 17:08:45 UTC
Hmm.. Unsure if solar had a bug for this as well or not, so I won't bother  
searching for a dupe. This is working in 2.0.51.22 though.  
Comment 7 Alec Warner (RETIRED) archtester gentoo-dev Security 2005-05-22 08:04:06 UTC
Regression? it doesn't work in 2.0.51.22-r1

skyfw@kyoto skyfw $ cd /usr/portage/net-misc/zssh
skyfw@kyoto zssh $ ebuild zssh-1.5a.ebuild unpack
Traceback (most recent call last):
  File "/usr/bin/ebuild", line 50, in ?
    a=portage.doebuild(pargs[0],x,getroot(),tmpsettings,debug=debug,
cleanup=cleanup)
  File "/usr/lib/portage/pym/portage.py", line 2586, in doebuild
    os.chown(mysettings["BUILD_PREFIX"],portage_uid,portage_gid)
OSError: [Errno 1] Operation not permitted: '/var/tmp/portage'
skyfw@kyoto zssh $ groups
wheel cron audio video games users slocate portage
skyfw@kyoto zssh $ emerge info
find: /etc/lprng: Permission denied
________________________________________________________________________________

cfg-update 1.7.1 : Building checksum index... failed!
                   Permission denied : root only!
________________________________________________________________________________

Portage 2.0.51.22-r1 (default-linux/x86/2005.0, gcc-3.3.5-20050130, glibc-2.3.4.
20041102-r1, 2.6.10-gentoo-r6 i686)
=================================================================
System uname: 2.6.10-gentoo-r6 i686 AMD Athlon(tm) XP 1800+
Gentoo Base System version 1.4.16
distcc 2.16 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
dev-lang/python:     2.3.4-r1
sys-apps/sandbox:    1.1
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.4
sys-devel/binutils:  2.15.92.0.2-r7
sys-devel/libtool:   1.5.16
virtual/os-headers:  2.6.8.1-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="no"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-mcpu=athlon-xp -march=athlon-xp -O3 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.4/env /usr/kde/3.4/
share/config /usr/kde/3.4/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /
usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
CXXFLAGS="-mcpu=athlon-xp -march=athlon-xp -O3 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig buildpkg confcache digest distlocks parallel-fetch sandbox 
sfperms strict userpriv usersandbox"
GENTOO_MIRRORS="http://gentoo.chem.wisc.edu/gentoo ftp://gentoo.chem.wisc.edu/
gentoo"
MAKEOPTS="-j2"
PKGDIR="/home/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 3dnow X acpi alsa apm avi bash-completion berkdb bitmap-fonts bmp canna 
caps cdr cjk crypt curl dvd dvdr dvdread emboss encode esd ethereal fam 
foomaticdb fortran gdbm gif gpm gtk gtk2 imagemagick imap imlib ipv6 jpeg kde 
libg++ libwww lm_sensors mad maildir matroska mikmod mmx mono motif mp3 mpeg 
mysql ncurses nis nls nptl offensive ogg oggvorbis openal opengl pam pdflib perl 
png posix python qt quicktime readline real sdl spell sse ssl svg svga tcltk 
tcpd threads tiff truetype truetype-fonts type1-fonts vorbis wxwindows xml2 xmms 
xv zlib userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS

skyfw@kyoto zssh $ 
Comment 8 Jason Stubbs (RETIRED) gentoo-dev 2005-05-22 08:54:44 UTC
That shouldn't have caused a traceback. It is wrapped in a try/except. It 
would be nice if you could debug why it did. 
 
The code at that was attempting to change permissions on the wrong directory 
however, so I've fixed that. 
Comment 9 Jason Stubbs (RETIRED) gentoo-dev 2005-05-24 07:01:24 UTC
The try/except only catches ValueError. Fixing the incorrect directory 
reference fixed the bug. 
Comment 10 Jason Stubbs (RETIRED) gentoo-dev 2005-07-14 05:48:12 UTC
Fixed on or before 2.0.51.22-r1 
Comment 11 Jason Stubbs (RETIRED) gentoo-dev 2005-07-14 06:58:49 UTC
Looking through the batch of bugs, I'm not sure that some of these are 
actually fixed in stable. Others, the requirements have possibly changed after 
the initial fix was committed. 
 
If you think this bug has been closed incorrectly, please reopen or ask that 
it be reopened.