Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 64417 - Portage fails to merge symlinks properly on FreeBSD
Summary: Portage fails to merge symlinks properly on FreeBSD
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2004-09-17 09:53 UTC by Stephen Bennett (RETIRED)
Modified: 2004-10-22 08:48 UTC (History)
1 user (show)

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 Stephen Bennett (RETIRED) gentoo-dev 2004-09-17 09:53:39 UTC
When merging a package on FreeBSD, Portage runs into trouble if it tries to merge a symlink before the file it points to. The problem lies in the use of os.chown() instead of os.lchown, so the call to lchown() in movefile (portage.py, ~line 2475 as of 2.0.51_rc1) fails if the target file isn't present, as os.chown tries to follow the broken link.

Suggested fix: modify portage_data.py to use os.lchown() instead of os.chown() on freebsd.
Comment 1 Nicholas Jones (RETIRED) gentoo-dev 2004-09-21 16:11:27 UTC
This was done explicitly for Mac and BSD...
Is this section of code in portage_data wrong? (2.0.51)

BSD people need to comment here.

If python has lchown, is there a reason to not use it?


if ostype=="Linux":
  userland="GNU"

  if "lchown" in dir(os):
    # Included in python-2.3
    lchown=os.lchown
  else:
    import missingos
    lchown=missingos.lchown

  os.environ["XARGS"]="xargs -r"
elif ostype in ["Darwin","FreeBSD","OpenBSD"]:
  userland="BSD"
  lchown=os.chown
  os.environ["XARGS"]="xargs"
else:
  writemsg(red("Operating system")+" \""+ostype+"\" "+red("currently unsupported
  sys.exit(1)
Comment 2 Aaron Walker (RETIRED) gentoo-dev 2004-09-22 07:22:19 UTC
IIRC, Stephen's latest portage/python snapshot includes python-2.3.4, so it should be safe to use os.lchown.

If you don't, then you get errors like these:

!!! failed to properly create symlink:
!!! /lib/libhistory.so -> libhistory.so.4.3 i
!!! [Errno 2] No such file or directory: '/lib/libhistory.so'
!!! Failed to move file.
!!! /lib/libhistory.so -> libhistory.so.4.3

This particular one is from sys-apps/readline-4.3-r5.  I have run into several others that fail because of this as well, so I think it should definitely be changed.
Comment 3 Nicholas Jones (RETIRED) gentoo-dev 2004-09-25 01:16:03 UTC
Does missingos compile on freebsd?
Comment 4 Aaron Walker (RETIRED) gentoo-dev 2004-09-25 10:02:03 UTC
carpaski, missingos builds fine and is installed.
Comment 5 Nicholas Jones (RETIRED) gentoo-dev 2004-09-29 17:20:58 UTC
This is taken care of for _rc7
Comment 6 Nicholas Jones (RETIRED) gentoo-dev 2004-10-22 08:48:06 UTC
Bug has been fixed and released in stable portages on or before 2.0.51-r2