Hi!

Thanks for the test-case, I've commited it as t-dir-leftover-deadlock,
and added a new t-dir-leftover-parents which is what I thought you
were trying to solve initially, given your bug report. So I think these
two issues should be detangled, and I'll be applying my revised patch
to fix the -parents case. For a fix for t-dir-leftover-deadlock then
it's not as straight forward as it might seem and I'd recommend reading
Raphaël's summary in:

  <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=316521#39>

On Wed, 2011-05-11 at 11:28:20 +0200, Ondřej Surý wrote:
> your patch doesn't fix the problem, and even introduces more problems,
> because as it is written it leaves all directories which have
> conffiles on the disk.

That's not correct, it behaves as it should be, but that's not changed
by my patch, that's the current behaviour already. If a directory
contains conffiles then they need to be tracked so that they can be
removed on purge.

> This section:
> 
> static void
> removal_bulk_remove_files(struct pkginfo *pkg)
> {
> [...]
>     if (namenode->flags & fnnf_old_conff) {
>       push_leftover(&leftover,namenode);
>       continue;
>     }
> 
> causes every conffile to be added to leftover list triggering
> dir_is_used_by_pkg for every parent directory of the conffile.

No, that's already handled by dir_has_conffiles() currently. It keeps
any directory containing a conffile either directly or as part of any
subdrirectories. The only case were dir_is_used_by_pkg() will trigger
is when a package S has a shared directory hierarchy:

  /a/b/

And another package C has a not shared leaf directory containing
a configuration file (or any other maintainer script or run time
generated files):

  /a/b/c/file

When we remove C, dpkg will try to rmdir /a/b/c, because it's not
shared with S, but it will fail because it's not empty. Then currently
it will lose track of /a/b and /a because they are shared. When S gets
purged dpkg loses track of /a/b and /a, and then when C is purged it
only tries to remove /a/b/c, but not the other two.

That's because dir_is_used_by_pkg() needs one of its child directories
to be already tracked, or it will not match, and if any of its childs
is tracked then we *must* track the parent, or we might lose track of
it.

> However if you put back the logic to run the dir_is_used_by_pkg only
> if the file is used by others then it works correctly because the
> directory gets removed by last package owning the directory. (0001
> does that and works)

That's not possible, both your initial patch and my revision should
behave equally with the current code, my objection to your initial
patch was that it's not future proof, and it has a wrong assumption
on the check location. Anyway just to make extra sure, I've tested
your version (0001) and it only fixes t-dir-leftover-parents, as
expected, and not the -deadlock one.

> Another option would be to split the loops and add conffiles to
> leftover list after the first run (something like in the second
> attached patch).

And tested this one (0002) too and it also only fixes
t-dir-leftover-parents, and not t-dir-leftover-deadlock. In addition
it changes the order of the .list file, and in general I don't really
see what it's trying to solve, the issues at hand are related to
configuration files not conffiles.

> > It would be nice to have a
> > test case for our functional test-suite too. :)
> >
> >  <http://git.debian.org/?p=dpkg/pkg-tests.git>
> 
> Test case is attached.

The empty directories were missing, I've added them with a hidden file
so that git preserves them.

regards,
guillem




--
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