[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#762304: debootstrap doesn't unmount /proc and /sys if caught Ctrl-C



Cyril Brulebois <kibi@debian.org> (2014-09-21):
> Well, debootstrap mostly performs the initial bootstraping, so I don't
> think it would be introducing things like bind mounts which would then
> endanger the root filesystem.
> 
> While it probably isn't too difficult to catch signals and do some
> clean-up like unmounting filesystems, I don't think failing to do so
> is a serious bug (important at most), and I'm lowering the severity
> accordingly.

For the record, mounting is done through: umount_on_exit() which records
the specified filesystems to be unmounted in the UMOUNT_DIRS variable,
and adds the umount_exit_function() function to the list of things to
perform on exit, though an on_exit() call.

The following traps are put into place:

    trap "exit_function" 0
    trap "exit 129" 1
    trap "error 130 INTERRUPTED \"Interrupt caught ... exiting\"" 2
    trap "exit 131" 3

Then, exit_function() walks through the actions stored as EXIT_THING_*
by on_exit(), among which is the umount_exit_function() mentioned
earlier.

I'm not sure it would be reasonable to perform all EXIT_THING_* actions
in the interrupted case. I suspect a possible way to implement this
change would be to have an interrupt_function which would iterate over
items stored in UMOUNT_DIRS. If that's possible, that would still be a
bit unsatisfactory to have a direct call from there instead of a call
registered as done in the exit case, but that would avoid the need for
reimplementing the EXIT_THING_* handling…

Mraw,
KiBi.

Attachment: signature.asc
Description: Digital signature


Reply to: