Package: cowdancer
Version: 0.47~bpo40+1
Severity: normal

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



 -------- 8< ------ further test cases -------- 8< ------ 

Output (or lack of) from cowbuilder when connection is interrupted:

  ssh buildbox
  echo 'BINDMOUNTS="/var/cache/pbuilder/result"' > ~/.pbuilderrc
  touch /var/cache/pbuilder/result/foo
  cowbuilder --login | tee logfile
  (terminate the ssh connection with ~. or by unplugging cable etc)

  results: data loss!
    /var/cache/pbuilder/result/foo has disappeared and the bind mounts are
    still in place. Log file reads as follows:
        -> Running in no-targz mode
        -> copying local configuration
        -> mounting /proc filesystem
        -> mounting /dev/pts filesystem
        -> Mounting /var/cache/pbuilder/result
        -> policy-rc.d already exists
        Obtaining the cached apt archive contents
        -> entering the shell
   (note that there are no clean up messages)


Preventing all stdout and stderr from cowbuilder when connection is
interrupted:

  ssh buildbox
  echo 'BINDMOUNTS="/var/cache/pbuilder/result"' > ~/.pbuilderrc
  touch /var/cache/pbuilder/result/foo
  cowbuilder --login &> logfile
  (terminate the ssh connection with ~. or by unplugging cable etc)

  results: OK!
    /var/cache/pbuilder/result/foo is still there, bind mounts have
    been removed during cleanup. Log file reads:
         -> Running in no-targz mode
         -> copying local configuration
         -> mounting /proc filesystem
         -> mounting /dev/pts filesystem
        -> Mounting /var/cache/pbuilder/result
         -> policy-rc.d already exists
        Obtaining the cached apt archive contents
         -> entering the shell
        Hangup
        Copying back the cached apt archive contents
         -> unmounting /var/cache/pbuilder/result filesystem
         -> unmounting dev/pts filesystem
         -> unmounting proc filesystem
    (note cleanup messages present)


Sending signals while not running through ssh:

  echo 'BINDMOUNTS="/var/cache/pbuilder/result"' > ~/.pbuilderrc
  touch /var/cache/pbuilder/result/foo
  cowbuilder --login 
  (kill -1 $LOGIN_SHELL so that the tty disappears)

  result: data loss!
    same as before.



-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (900, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-6-686
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)

Versions of packages cowdancer depends on:
ii  libc6                  2.3.6.ds1-13etch8 GNU C Library: Shared libraries
ii  pbuilder               0.161             personal package builder for Debia

cowdancer recommends no packages.

-- no debconf information

(Note that the system informartion, above, is for an etch box using the
cowdancer from backports.org, but I have also verified this behaviour on
a lenny-only machine and a lenny machine with sid's cowdancer)



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

Reply via email to