Darwin/OS X has no permissions for symlinks, therefore when portage attempts to lchown a symlink with a non-existant target (or simply the target hasn't been moved from ${D} yet) it raises Exception and stops the merge. lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID]) Is the statement that fails. No, I'm not attaching a patch yet, want to investigate a little more first, but wanted to start the bug in case a portage guru has a good, clean, quick fix =) Reproducible: Always Steps to Reproduce: 1. 2. 3. Portage 2.0.51.22-r1 (default-darwin/macos/progressive, gcc-3.3, libsystem-7.1-r0, 8.2.0 Power Macintosh) =============================================================== == System uname: 8.2.0 Power Macintosh powerpc Unknown Host Operating System dev-lang/python: 2.4.1 sys-apps/sandbox: [Not Present] sys-devel/autoconf: 2.13, 2.59-r6 sys-devel/automake: 1.4_p6, 1.5, 1.7.9-r1, 1.8.5-r3, 1.9.5 sys-devel/binutils: [Not Present] sys-devel/libtool: [Not Present] virtual/os-headers: 7.1 ACCEPT_KEYWORDS="ppc-macos ~ppc-macos" AUTOCLEAN="yes" CBUILD="powerpc-apple-darwin8" CFLAGS="-mcpu=G4 -O3 -pipe" CHOST="powerpc-apple-darwin8" CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/config /var/ qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d" CXXFLAGS="-O2 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoconfig buildpkg distlocks fakeroot sfperms strict userpriv" GENTOO_MIRRORS="http://gentoo.osuosl.org/ http://adelie.polymtl.ca/ http://distro.ibiblio.org/pub/ linux/distributions/gentoo/ http://cudlug.cudenver.edu/gentoo/" LC_ALL="" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="ppc bitmap-fonts dvd emboss gif jpeg ldap libwww nls pam png ppc-macos python readline truetype truetype-fonts type1-fonts unicode userland_Darwin kernel_Darwin elibc_Darwin" Unset: ASFLAGS, CTARGET, LANG, LDFLAGS, LINGUAS
Portage currently aliases lchown to chown on Darwin. It would make more sense for lchown be aliased to a noop. Does that work for you?
I'd be careful about aliasing to a noop. lchown isn't only used on symlinks.
Yeah, I think Marius is correct. Ideally it would only noop if the symlink target didn't exist, that way the symlinlk will just inherit perms from its parent.
Created attachment 63710 [details, diff] Replaces lchown with os.chown when target is not a symlink There's two case where lchown is used and the target is never a symlink; changed both of those to use os.chown. Then there's one case where it can be any type of file; converted that one to an if block based on stat information that has already been read.
Created attachment 63711 [details, diff] Turns lchown into a no-op on Darwin The problem with lchown being aliased to chown is that file merging becomes order dependent (and portage currently relies on it being not so). That is, the target will get the wrong permissions if the symlink has different ownership for some reason.
This looks good to me. thanks jstubbs.
ok, I spoke to soon. This still doesn't solve the problem of merging a symlink with a non-existant target. On line ~2800 of portage.py in movefile() there is another lchown I didn't see changed in your patch. If you change: lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID]) to: os.chown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID]) this will still raise: except Exception, e: print "!!! failed to properly create symlink:"
Fixed in 2.0.53