On 6.5.2011, at 6:28, Guillem Jover <guil...@debian.org> wrote:

> Hi!
> 
> On Wed, 2011-05-04 at 11:11:10 +0200, Ondřej Surý wrote:
>> The attached patch keeps the directory in the <pkg>.list (aka add it
>> to the leftover) if the children directory is found on the leftover
>> list.
> 
> The problem is that the check is not correct, isdirectoryinuse (now
> dir_is_used_by_others) checks for the directory being referenced by
> other packages, and here we only care if it's owned by the package
> being acted on.

Right. But you only care in the case if the directory is used by others, 
because only in this case it's not added to leftover list if not removed, so 
you can save the check time for every directory used only by the package itself.

But although I think my patch was correct:-), I also think your patch is more 
readable for future readers, so no hard feelings.

>> There could be a slight modification to keep /. in the list as well to
>> be formally correct, but IMO it's not needed.
> 
> Right, and it actually needs to be ignored on removal or dpkg fails on
> non dpkg native systems (or fake environments), where the last package
> can be easily removed.
> 
> Anyway I'm attaching a modified version, but I've only build tested
> it. If you could test it that'd be nice. It would be nice to have a
> test case for our functional test-suite too. :)
> 
>  <http://git.debian.org/?p=dpkg/pkg-tests.git>

I'll do that over weekend.

>> If you want this fixed, just ping me, it's easy to add something like
>> "&& (....->name[namelen] == \0 or ...->name[namelen] == '/')", and
>> I'll fix it at both places.
> 
> Ah nice catch! I've pushed a fix for this (commit
> 2c9a342dc4e1ad3e9e58ac89957b9068664d1930). Thanks!

Cool. Also you're right that you don't need to check for \0 in 
dir_is_used_by_pkg, but I am unsure if you can do the same check (/foo not 
matching /foo in other package) is dir_is_used_by_others. In fact I think it's 
wrong... If two packages contains /var/foo/bar/ and both depend on this 
directory to run (f.e. creating files there on the first run or only when 
issuing 'dump' command, etc...), you will remove it on first package removal if 
it's empty thus breaking the second package.

O.
P.S.: Typed on iPhone, so excuse the typos.



--
To UNSUBSCRIBE, email to debian-dpkg-bugs-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to