Gentoo Archives: gentoo-alt

From: Alan Hourihane <alanh@×××××××××××.uk>
To: gentoo-alt <gentoo-alt@l.g.o>
Subject: [gentoo-alt] unemerging causes a bad symlink removal
Date: Fri, 28 Aug 2009 03:39:28
Message-Id: 1251449325.19057.77.camel@jetpack.demon.co.uk
1 Hi,
2
3 I'm using an EPREFIX set to "/" and I have a symlink like so....
4
5 /usr -> /j/usr
6
7 Now, when I come to unemerging a package the code in vartree.py does
8 it's thing and when it gets to the above it removes my symlink /usr
9 which should point to /j/usr and everything breaks until I re-instate
10 it.
11
12 I think that even when EPREFIX is used normally then this problem could
13 arise. How many people unemerge something in prefix now ???
14
15 Anyway....
16
17 This is the code in vartree.py.....
18
19 try:
20 os.rmdir(obj)
21
22 I've changed the above to this....
23
24 try:
25 if not stat.S_ISLNK(os.lstat(obj).st_mode):
26 os.rmdir(obj)
27
28 And it works for now, but it's not foolproof as it could potentially not
29 remove symlinks when it should.
30
31 Does anyone have a better approach ??
32
33 Alan.

Replies

Subject Author
Re: [gentoo-alt] unemerging causes a bad symlink removal Fabian Groffen <grobian@g.o>