Portage 2.0.27 can't create the destination directory if it is a broken symlink and it has to merge a directory. It seems that os.lstat raise an exception on broken symlinks, treating them as non-existant files. This in turns causes portage to fail when it tries to make the destination directory on these broken symlinks. This problem could be solved using os.path.islink, before portage attempts to create a directory, to check for broken symlinks. Traceback: .... File "/usr/lib/python2.2/site-packages/portage.py", line 3680, in mergeme self.mergeme(srcroot,destroot,outfile,secondhand,offset+x+"/",cfgfiledict,thismtime) File "/usr/lib/python2.2/site-packages/portage.py", line 3674, in mergeme os.mkdir(mydest) OSError: [Errno 2] No such file or directory: '/opt/netscape/plugins'
Created attachment 3015 [details, diff] This patch(suggestion)checks if the destination dir is a broken symlink.
Your assumption about what is causing this bug doesn't seem correct: tmp $ ls -l meep lrwxrwxrwx 1 drobbins drobbins 4 Aug 18 23:21 meep -> foob tmp $ ls -l foop ls: foop: No such file or directory tmp $ python Python 2.2.1 (#1, Jul 15 2002, 17:05:14) [GCC 3.1] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> os.lstat("meep") (41471, 2187119L, 8L, 1, 1000, 1000, 4L, 1029734510, 1029734510, 1029734510) >>> from stat import * >>> a=os.lstat("meep") >>> S_ISLNK(a[ST_MODE]) 1 I can't fix the bug until I have enough information to identify what is actually causing the problem.
My assumption was wrong. I will try to explain the problem with a real case example: hooghly / # ls -l /opt lrwxrwxrwx 1 root root 13 Aug 13 11:23 /opt -> /mnt/data/opt hooghly / # ls -l /mnt/data/opt ls: /mnt/data/opt: No such file or directory hooghly / # emerge netscape-flash Calculating dependencies ...done! >>> emerge net-www/netscape-flash-5.0.50 to / >>> md5 ;-) netscape-flash-5.0.50.tar.gz >>> Unpacking source... >>> Unpacking netscape-flash-5.0.50.tar.gz >>> Source unpacked. >>> Install netscape-flash-5.0.50 into /usr/work/portage/netscape-flash-5.0.50/image/ category net-www strip: /usr/work/portage/netscape-flash-5.0.50/image/opt/netscape/plugins/libflashplayer.so >>> Completed installing into /usr/work/portage/netscape-flash-5.0.50/image/ >>> Merging net-www/netscape-flash-5.0.50 to / --- /opt/ Traceback (most recent call last): File "/usr/bin/emerge", line 1358, in ? mydepgraph.merge(mydepgraph.altlist()) File "/usr/bin/emerge", line 889, in merge retval=portage.doebuild(y,"merge",myroot,edebug) File "/usr/lib/python2.2/site-packages/portage.py", line 1188, in doebuild return merge(settings["CATEGORY"],settings["PF"],settings["D"],settings["BUILDDIR"]+"/build-info",myroot,myebuild=settings["EBUILD"]) File "/usr/lib/python2.2/site-packages/portage.py", line 1413, in merge mylink.merge(pkgloc,infloc,myroot,myebuild) File "/usr/lib/python2.2/site-packages/portage.py", line 3790, in merge self.treewalk(mergeroot,myroot,inforoot,myebuild) File "/usr/lib/python2.2/site-packages/portage.py", line 3520, in treewalk self.mergeme(srcroot,destroot,outfile,secondhand,"",cfgfiledict,mymtime) File "/usr/lib/python2.2/site-packages/portage.py", line 3680, in mergeme self.mergeme(srcroot,destroot,outfile,secondhand,offset+x+"/",cfgfiledict,thismtime) File "/usr/lib/python2.2/site-packages/portage.py", line 3674, in mergeme os.mkdir(mydest) OSError: [Errno 2] No such file or directory: '/opt/netscape' The problem seems to be that portage tries to create a new directory in a directory that does not exists.
Fxied in cvs with access check at DIR creation time.