cvs commit: src/sys/kern vfs_syscalls.c

Matthew Dillon dillon at apollo.backplane.com
Fri Sep 22 10:17:31 PDT 2006


:I noticed that rebooting something like this
:
:$ cd ~
:$ su root -c reboot
:Password:
:
:can cause the warning to be printed for filesystems other than root,
:and my shell history is lost.  This hasn't been the case until recently.
:
:Cheers.

    The mount warning is almost certainly due to the fact that the
    current directory of the 'reboot' program itself is /home/blah when
    you reboot that way.   If you were to do 'su root -c 'cd /; reboot'
    I'll bet it won't complain.

    I think we can solve that problem by having the reboot/shutdown binaries
    chdir to / before making the system call, or by having the kernel's
    shutdown code reset the current directory for the calling process to /
    and close all of its descriptors before trying to unmount everything.

    Two things can be happenning if you are losing your history.  It depends
    whether you are losing the entire history or just the history for the
    calling session.  The shell doesn't write out its history until it 
    exits.  The kernel will SIGHUP it first, and then later kill -9 it.  If
    the shell is the one that called reboot there could be a race going on
    there.  There are also a number of 'savehist' options you can set.  I
    have mine set like this:

	set history = 1000
	set savehist = ( 1000 merge )

    If you don't have savehist set to merge, then you can easily lose the
    history from past sessions or other shells.  Of course, sometimes the
    merge doesn't merge right either due to races between multiple shells
    exiting at the same time.

					-Matt
					Matthew Dillon 
					<dillon at xxxxxxxxxxxxx>





More information about the Commits mailing list