command line history broken in 11.0

Ernie Luzar luzar722 at
Tue Mar 21 20:51:07 UTC 2017

Igor R. wrote:
> It is not something that I've tried to do, but here is an idea:
>    "reboot & ; exit".
> The rational is that by doing this you would detach the standard output
> of the "reboot" process, and that will allow the exit to complete.
> If that doesn't help, you can think about redirecting the stdout
> (and as the next step, - stderr) in that command.
> HTH!
> PS. I just looked at the source code, and I suspect that the difference 
> in the behavior in 10.3 and 11.0 (or 11.0.1) might be related to these 
> changes:
> Just before 10.3 release, this change was introduced to /bin/csh:
> and then quickly reversed. by Revision 297204.
> You can see that revision 296976 had weird side effects:
> "causes strange effects like for example SIGTERM not
> being delivered to rc(8) scripts on shutdown albeit these use sh(1),
> if csh(1) or tcsh(1) are used as login shell of root."
> At the same time, soon after 10.3-release was split from HEAD, that 
> change was reversed in HEAD as well, but in addition to that (Revision 
> 297672) a different call (fork) was introduced:
> Maybe that change also had some side effects (like what you see), but 
> just less severe or less noticeable, - so it "worked" for 11.0*-release.
> Assuming my guess is correct, I'd recommend you filing a bug report (pr),
> so that it is documented - and that can bring it to the attention of the 
> core team.
> On Mon, 20 Mar 2017 14:05-0400, Ernie Luzar wrote:
>> On 10.3 I had the current session saving the command line history when 
>> issuing
>> the shutdown, halt, and reboot command by using these alias commands 
>> that I
>> added to the .cshrc file of my logged in user account.
>> alias sd    "exit && shutdown now"
>> alias sdp    "exit && shutdown -p now"
>> alias rboot     "exit && reboot"
>> alias stop      "exit && halt"
>> Now after doing a clean install of 11.0 and using the same .cshrc file 
>> the
>> rboot and stop alias commands no longer save the current history. They 
>> act
>> like the exit command is not getting executed. The sd and sdp alias 
>> commands
>> are working as expected.
>> When existing from a session terminal by issuing the exit command does 
>> still
>> save the current history.
>> Is there an alternate method I can use?

Thank you Igor.

Your reply hit the mail on the head. You have proved there is a reason 
for the different between 10.3 and 11.0. I now know its not me screwing 
something up.

I've been a Freebsd user since release 3.0. Over time I noticed that the 
  shell command line history was NEVER being updated so I would see the 
history from the previous session merged into the old .history file the 
next time I started the host. It was not existing the shell and logging 
on the next day, instead I would issue halt or shutdown -p now command.

During the 10.x series some time I posted a question to the questions 
list about this behavior. To make a long story short, the solution at 
that time was to do it this way and it was working fine.

   alias rboot     "exit && reboot"
   alias stop      "exit && halt"

Then along comes 11.0 and it stopped working, I tried many different 
combinations and nothing worked. It was Polytropon who gave me the 
pointer I needed. Even though I had reread the shutdown man page a few 
times, I never really understood what the meaning of the -o flag was 
really talking about. I recoded my alias commands like this

   alias sd        "shutdown -o now"
   alias sdp       "shutdown -po now"
   alias rboot     "shoutdown -ro now"
   alias stop      "shutdown -ho now"

Low and be hold, Now the shell is given a chance to close down normally 
which allows the shell .history file to be updated. My world is happy 
again. This also explains why sometimes at shutdown my database gets 

To my way of thinking this -o should be the default behavior instead of 
how it is now. This default behavior is now in violation of the original 
intention for using the shutdown command in the first place, which is to 
allow running tasks to close down cleanly saving databases from becoming 

It would be best if halt and reboot commands were deprecated and removed 
from the base system leaving the shutdown command the only way to bring 
down the system, aside from the power button. The shutdown -o mode 
should become the default mode. Then "shutdown -r now" becomes the 
replacement for the "reboot" command and "shutdown -h now" becomes the 
replacement for "halt" command. Their is never a technical need where 
it's necessary to just terminate everything thats running. This concept 
of terminating all running tasks is a legacy leftover from the first BSD 
version that now needs to be corrected. With todays powerful computers 
there is no noticeable lag in allowing tasks to shutdown cleanly.

To address people who may have reboot or halt inbedded in some scripts, 
the reboot command could be an alias for "shutdown -r now" and halt an 
alias for "shutdown -h now".

I think a PR is needed here to get this problem documented. It surely 
effects every user of FreeBSD.

Now if I have missed something or mis-understood something, I sure would 
like to hear about it before I submit a PR on this. Even an 
acknowledgment that I got it correct would be good to hear.

Thanks to everyone who replied.

More information about the freebsd-questions mailing list