Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 6361 - Portage 2.0.27 fails installing when the destination directory is a broken symlink
Summary: Portage 2.0.27 fails installing when the destination directory is a broken sy...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Unclassified (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Daniel Robbins (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-08-12 07:25 UTC by Geronimo Poppino
Modified: 2011-10-30 22:17 UTC (History)
2 users (show)

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


Attachments
This patch(suggestion)checks if the destination dir is a broken symlink. (broken_symlinks.diff,764 bytes, patch)
2002-08-12 07:31 UTC, Geronimo Poppino
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Geronimo Poppino 2002-08-12 07:25:38 UTC
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'
Comment 1 Geronimo Poppino 2002-08-12 07:31:34 UTC
Created attachment 3015 [details, diff]
This patch(suggestion)checks if the destination dir is a broken symlink.
Comment 2 Daniel Robbins (RETIRED) gentoo-dev 2002-08-18 19:33:40 UTC
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.

Comment 3 Geronimo Poppino 2002-08-27 13:32:38 UTC
 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. 
 
Comment 4 Nicholas Jones (RETIRED) gentoo-dev 2002-10-12 06:13:08 UTC
Fxied in cvs with access check at DIR creation time.