Bug#542915: pbuilder: removes data from bind-mounted directories

Jakub Wilk ubanus at users.sf.net
Mon Sep 21 14:40:38 UTC 2009


* Loïc Minier <lool at dooz.org>, 2009-09-21, 15:46:
>> First of all, you should not close a bug without a proper explanation.
>>
>> mount and rm does exactly what they are meant to do (and what is
>> documented). This is not true for your package.
>>
>> In fact, this bug is easily fixable:
>> - In most cases, `umount -a` called inside chroot does unmount
>> everything that should be unmounted.
>> - If it does not (i.e. if /proc/mounts contents changed during a
>> build), pbuilder should refrain from rm-Rf-ing the chroot.
>
> It seems pbuilder doesn't rm -r (it uses find -xdev to rm -f all
> non-directories and then rmdir on dirs; it could as well use rm
> --one-file-system IMO) see clean_subdirectories() in pbuilder-modules;

None of these methods are safe for bind-mounts:

# mkdir foo

# touch foo/foo1 foo/foo2

# mkdir -p bar/foo

# mount --bind foo bar/foo

# find bar -xdev
bar
bar/foo
bar/foo/foo1
bar/foo/foo2

# rm -Rf --one-file-system bar/
rm: cannot remove directory `bar/foo': Device or resource busy

# ls foo/ | wc -l
0

> it also has some logic to check for mounts not having been properly
> unmounted (seems_truly_unmounted() in pbuilder-modules).  

Yes, but these checks are only for things that were mounted by pbuilder 
itself (if I understand correctly).

> Perhaps you're hitting another rm such as the hooks one?

Nope, I'm using only C10shell.

-- 
Jakub Wilk





More information about the Pbuilder-maint mailing list