Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 117781 - portage does not control GID of /usr/portage/distfiles/.locks directory
Summary: portage does not control GID of /usr/portage/distfiles/.locks directory
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: High blocker (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 115839
  Show dependency tree
 
Reported: 2006-01-04 13:21 UTC by Pawel Madej aka Nysander
Modified: 2006-09-18 12:33 UTC (History)
0 users

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


Attachments
portage-2.0.54-r1.ebuild (portage-2.0.54-r1.ebuild,3.76 KB, text/plain)
2006-01-04 14:11 UTC, Pawel Madej aka Nysander
Details
portage-2.1_pre3-r2.ebuild (portage-2.1_pre3-r2.ebuild,4.49 KB, text/plain)
2006-01-04 14:13 UTC, Pawel Madej aka Nysander
Details
add_group_perms.patch (add_group_perms.patch,3.80 KB, patch)
2006-01-05 05:22 UTC, Zac Medico
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pawel Madej aka Nysander 2006-01-04 13:21:22 UTC
Problem described below is present in portage 2.0.54 and 2.1_pre3.

I've found problem while trying to make digests of ebuild's situated in my PORTAGE_OVERLAY directory. Whenever i tried to do it from user which is in portage group i got such error:

for example:

$ ebuild /usr/local/www-apache/mod_cband/mod_cband-0.9.6.1_rc1.ebuild digest
!!! No write access to write to /usr/portage/distfiles.  Aborting.
/.locks

Resolution of this problem was suggested by Zac Medico:

# chown root:portage /usr/portage/distfiles/.locks
# chmod g+w /usr/portage/distfiles/.locks

Portage also should check if permistions are as given above.

Quote from Zac's email:
"It seems that portage automatically changes the group id on ${DISTDIR} (when run as root) but it neglects to change the group id on ${DISTDIR}/.locks (I'd consider it a bug)."
Comment 1 Brian Harring (RETIRED) gentoo-dev 2006-01-04 13:40:41 UTC
offhand... handling for DISTDIR should be forced gid=portage_gid for all access, and forced g+rw.

Zac- if you know where (fair bet it's doebuild), care to split a patch changing the chown'ing to what I stated above?
Comment 2 Pawel Madej aka Nysander 2006-01-04 14:11:10 UTC
Created attachment 76183 [details]
portage-2.0.54-r1.ebuild

This is my proposal of ebuild because I have very little knowledge about building ebuilds it could be broken, so please review it
Comment 3 Pawel Madej aka Nysander 2006-01-04 14:12:57 UTC
Comment on attachment 76183 [details]
portage-2.0.54-r1.ebuild

Added checking of the permissions of /usr/portage/distfiles/.locks directory

This is my proposal of ebuild because I have very little knowledge about building ebuilds it could be broken, so please review it
Comment 4 Pawel Madej aka Nysander 2006-01-04 14:13:48 UTC
Created attachment 76184 [details]
portage-2.1_pre3-r2.ebuild

Added checking of the permissions of /usr/portage/distfiles/.locks directory

This is my proposal of ebuild because I have very little knowledge about
building ebuilds it could be broken, so please review it
Comment 5 Zac Medico gentoo-dev 2006-01-04 16:33:14 UTC
(In reply to comment #4)
> Added checking of the permissions of /usr/portage/distfiles/.locks directory

That's not sufficient because we should ensure correct permissions whenever possible (every time portage does a fetch as root).  This will require a patch to portage.py.

> This is my proposal of ebuild because I have very little knowledge about
> building ebuilds it could be broken, so please review it

When possible, please post patches rather than complete files (though bug 117440 among other things makes ebuild changes questionable in this case).
Comment 6 Zac Medico gentoo-dev 2006-01-05 05:22:51 UTC
Created attachment 76232 [details, diff]
add_group_perms.patch

(In reply to comment #1)
> offhand... handling for DISTDIR should be forced gid=portage_gid for all
> access, and forced g+rw.

My patch (works for both 2.1_pre3 and 2.0.54) includes a reusable function to force permissions on both ${DISTDIR} and ${DISTDIR}/.locks (modifying only the required mode bits).
Comment 7 Zac Medico gentoo-dev 2006-01-05 13:50:54 UTC
While reviewing the patch I found a bug:

-	if not stat.S_IMODE(mystat.st_mode) & mybits:
+	if not stat.S_IMODE(mystat.st_mode) & mybits == mybits:

Feedback is appreciated, especially on the add_group_perms function and it's interface.
Comment 8 Brian Harring (RETIRED) gentoo-dev 2006-02-09 02:47:03 UTC
zac, that is a bug as you pointed out...
Comment 9 Zac Medico gentoo-dev 2006-02-09 12:31:50 UTC
I have committed a fix for release in 2.1_pre5.
Comment 10 Zac Medico gentoo-dev 2006-02-26 14:45:58 UTC
Released in 2.1_pre5.
Comment 11 nobody 2006-09-18 09:55:45 UTC
I have the exact same problem now :(

I'm using one computer (faramir) that export its directory
The other one (beleg) have it mount & its DISTDIR set to it.

But as soon as i use portage on faramir it will reset permissions to 775 witch prevent the other one writing on it.

faramir: chmod -R 777 /usr/portage/distfiles
beleg: emerge something -> works
faramir: emerge something -> works
beleg: emerge something -> fail, portage have set it back to 775 with "!!! No write access to /mnt/distfiles/ "

cat /etc/fstab | grep dist
faramir:/usr/portage/distfiles /mnt/distfiles nfs rw,user        0 0

cat /etc/exports | grep dist
/usr/portage/distfiles beleg(rw,sync)

emerge --info

Portage 2.1.1 (default-linux/x86/2006.0, gcc-4.1.1, glibc-2.4-r3, 2.6.16-gentoo- r7 i686)
=================================================================
System uname: 2.6.16-gentoo-r7 i686 Intel(R) Pentium(R) 4 CPU 1.80GHz
Gentoo Base System version 1.12.5
Last Sync: Sun, 17 Sep 2006 15:30:01 +0000
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [enabled ]
app-admin/eselect-compiler: [Not Present]
dev-java/java-config: 1.2.11
dev-lang/python:     2.3.5, 2.4.3-r1
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     [Not Present]
dev-util/confcache:  [Not Present]
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2
sys-devel/binutils:  2.16.1-r3
sys-devel/gcc-config: 1.3.13-r3
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.17-r1
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=pentium4 -mtune=pentium4 -O3 -pipe -msse -mfpmath=sse -mmmx -msse 2"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.1/share/config /usr/kde/3.2/share/config /usr/sh are/X11/xkb /var/bind /var/qmail/alias /var/qmail/control /var/vpopmail/domains /var/vpopmail/etc"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/terminfo"
CXXFLAGS="-march=pentium4 -mtune=pentium4 -O3 -pipe -msse -mfpmath=sse -mmmx -ms se2"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distcc distlocks metadata-transfer sandbox sfperms strict"
GENTOO_MIRRORS="ftp://ftp.uni-erlangen.de/pub/mirrors/gentoo http://gentoo.mirro r.sdv.fr/  http://gentoo.oregonstate.edu/ http://www.ibiblio.org/pub/Linux/distr ibutions/gentoo"
LANG="fr_FR@euro"
LC_ALL="fr_FR@euro"
LINGUAS=""
MAKEOPTS="-j6"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude='/d istfiles' --exclude='/local' --exclude='/packages'"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 X a52 alsa apache2 berkdb bitmap-fonts cli crypt cups dlloader dri eds elibc_glibc emboss encode esd foomaticdb fortran ftp gdbm gif gnome gpm gstreame r gtk gtk2 imap imlib input_devices_keyboard input_devices_mouse ipv6 isdnlog jp eg kernel_linux libcaca libg++ libwww mad maildir mikmod mjpeg mng motif moznoma il moznoxft mp3 mpeg mpeg4 mplayer ncurses nls nptl nptlonly ogg opengl oss pam pcre perl png pppd python qt3 qt4 quicktime readline reflection sdl session spel l spl sse sse2 ssl stream svg tcpd timidity truetype truetype-fonts type1-fonts udev unicode userland_GNU vcd video_cards_nvidia video_cards_vesa vorbis win32co decs wxwindows xinerama xml xmms xorg xosd xv xvid zlib"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, PORTAGE_RSYNC_EXTRA _OPTS, PORTDIR_OVERLAY


thx to have a look...
Comment 12 Zac Medico gentoo-dev 2006-09-18 12:33:37 UTC
(In reply to comment #11)
> I have the exact same problem now :(

Your problem is unrelated to this particular bug.  If necessary, please file a new bug.

> I'm using one computer (faramir) that export its directory
> The other one (beleg) have it mount & its DISTDIR set to it.
> 
> But as soon as i use portage on faramir it will reset permissions to 775 witch
> prevent the other one writing on it.
> 
> faramir: chmod -R 777 /usr/portage/distfiles

Those permissions are pretty loose.  If you're systems are configured properly, portage's 775 permissions should work for you.

> beleg: emerge something -> works
> faramir: emerge something -> works
> beleg: emerge something -> fail, portage have set it back to 775 with "!!! No
> write access to /mnt/distfiles/ "
> 
> cat /etc/fstab | grep dist
> faramir:/usr/portage/distfiles /mnt/distfiles nfs rw,user        0 0

Your problem is likely related to the "user" mount option.