Gentoo Archives: gentoo-alt

From: Alan Hourihane <alanh@×××××××××××.uk>
To: gentoo-alt@l.g.o
Subject: Re: [gentoo-alt] unemerging causes a bad symlink removal
Date: Tue, 08 Sep 2009 12:11:33
Message-Id: 1252411923.18688.43.camel@jetpack.demon.co.uk
In Reply to: Re: [gentoo-alt] unemerging causes a bad symlink removal by Fabian Groffen
1 On Sun, 2009-09-06 at 09:12 +0200, Fabian Groffen wrote:
2 > On 05-09-2009 21:45:27 +0100, Alan Hourihane wrote:
3 > > > looks like Portage already tries to avoid doing something wrong:
4 > > >
5 > > > if pkgfiles[objkey][0] == "dir":
6 > > > if statobj is None or not stat.S_ISDIR(statobj.st_mode):
7 > > > show_unmerge("---", unmerge_desc["!dir"], file_type, obj)
8 > > > continue
9 > > > mydirs.append(obj)
10 > > >
11 > > > it only removes directories that are in mydirs, and technically it
12 > > > should never find your /usr dir, so that seems to be the bug to me
13 > >
14 > > Yeah, I think it should be using lstatobj and not statobj because it'll
15 > > end up stating the symlinks pointer.
16 >
17 > right, I suspected something like that.
18
19 Confirmed...
20
21 Changing this line from....
22
23 if statobj is None or not stat.S_ISDIR(statobj.st_mode):
24
25 to
26
27 if lstatobj is None or not stat.S_ISDIR(lstatobj.st_mode):
28
29 Fixes the problem.
30
31 Alan.

Replies

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