#512312 add minor safeguard against rm-rf of directories with bind-mounts.

Package:
cowdancer
Source:
cowdancer
Description:
Copy-on-write directory tree utility
Submitter:
Stuart Prescott
Date:
2015-11-03 08:48:08 UTC
Severity:
wishlist
#512312#5
Date:
2009-01-19 15:29:08 UTC
From:
To:
Hi!

If cowbuilder is invoked over ssh and the ssh connection is broken for
any reason (e.g. network failure, user closes terminal without logging
out of "cowbuilder --login" first) then the bind mounts are not released
prior to the chroot being cleaned up. The result of this is that any
data in any bind mounts will be lost.

I suspect that if a user logged out of their X session without first
logging out of any cowbuilders, then this would also happen, although I
have not tested this.

Steps to reproduce:

  ssh buildbox
  cowbuilder --create
  echo 'BINDMOUNTS="/var/cache/pbuilder/result"' > ~/.pbuilderrc
  touch /var/cache/pbuilder/result/foo
  cowbuilder --login
  (terminate the ssh connection with ~. , by unplugging cable, having
  the wireless connection drop out, etc)

  results: data loss!
    /var/cache/pbuilder/result/foo has disappeared and the bind mounts are
    still in place.


The problem seems to be related to output to the tty during the
cleanup phase as illustrated in the further test cases appended to this
bug report.

I have also checked this with the version of cowdancer in sid and the
behaviour is the same.

Obviously, running cowbuilder through screen is one way of preventing
this being a problem, but accidentally wiping out bind mounts is not a
good thing. Data loss would be justification for a "grave" severity for
this bug but I will leave it to others to decide whether it is enough of
a corner case to allow that to be ignored.

Please let me know if there is further information that I can provide.

cheers
Stuart

(Fortunately, I only had /var/cache/pbuilder/result and /tmp/.X11-unix
in the bind mounts so I lost nothing important and will just need to
restart X to allow me to start new programs in X; if I had $HOME in the
bind mounts too, then that would have been considerably more painful.)

#512312#10
Date:
2009-01-20 07:26:51 UTC
From:
To:
I think cowbuilder is missing SIGHUP handling.
Adding that might help.


At Mon, 19 Jan 2009 15:29:08 +0000,
Stuart Prescott wrote: