tcsh: .history.lock prevents logout

The number of hanging logouts from tcsh login shells became annoying here on releng-11.2 systems.
The reason is in all events a remaining .history.lock.

I'm not sure, but I suspect that the file is a remaining from shutdowns where the file was not removed.

Who knows how to solve/avoid this by making sure no .history.lock is left over?
 
If you don't need locking the history file...
Well, actually I do need locking and there is in .tcshrc
Code:
set history = (1000)
set savehist = (1000 merge lock)
set histdup = erase
Without locking in .history corrupted entries occur.
 
There seem to be a bug in Tcsh as now it is for sure that ~/.history.lock persists shutdowns. Does the dot_unlock of Tcsh not work?

Or is it a non-graceful shutdown handling from the system?

There are always multiple ttys open when one of does a shutdown.
After booting and login a ~/.history.lock can be found which should not be the case.

Having looked into /usr/src/contrib/tcsh I admit that my knowledge of signal handling is poor. ;)
 
non-graceful shutdown handling from the system?
I think this could be it. When logged in to the same user account via ssh and console I have seen the problem..
So I have learned from this post that .history is locked.
But I too have seen this survive a reboot, more than once, so maybe shutting down in the middle of a ssh session that causes this.
I can confirm that I have seen this sporatic behaviour... I assumed it was something I was doing wrong.
So now I will keep an eye on ~/history.lock
 
Install fish or zsh and the problem will gone automatically.
 
Install fish or zsh and the problem will gone automatically.
This is one of the finest examples on how to avoid fixing problems.
This kind of "problem solving" is reserved to those who cannot better and it has it's root where deinstalling/reinstalling serves the dumbest.
 
This is one of the finest examples on how to avoid fixing problems.
This kind of "problem solving" is reserved to those who cannot better and it has it's root where deinstalling/reinstalling serves the dumbest.
Yes. I'm incompetent.
 
I was bitten by this on FreeBSD in the past and again today on raspberry OS (tcsh 6.20.00).
I haven't seen the problem on my FreeBSD boxen for a while now (FreeBSD 12.2p6 provides tcsh 6.21.00).

My hack/workaround until a newer tcsh package is available is to add a ~/.login file to remove any lock files at login.

Code:
# Hack: a left over ~/.history.lock can cause logout to hang (and ignore terminal interrupts!)
# see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=632892
if ( -e ~/.history.lock ) then
    echo "WARNING: removed ~/.history.lock (left over from previous reboot?)"
endif
rm -rf ~/.history.lock

Maxnix thanks for the link to the bug report 👍
 
Back
Top