Date: Sun, 26 Jan 2014 21:58:45 +0100 From: Yamagi Burmeister <lists@yamagi.org> To: amarat@li.ru Cc: stable@freebsd.org Subject: Re: 10.0, csh history merge broken? Message-ID: <20140126215845.3b62debf03dade433622e9ba@yamagi.org> In-Reply-To: <52E0E917.3060403@li.ru> References: <52E0E917.3060403@li.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
Hello, this is a long standing problem. There are no locks in the csh / tcsh history merging code, thus it's racy between several shell instances. When enough shells are closed at the same time and your machine is fast enough, chances are high that several merges occure at the same time and break your ~/.history. I have this code in my ~/.logout to create a backup: # Create a backup of the history cp ${histfile} ${histfile}.bak # Create a backup of the directory stack cp ${dirsfile} ${dirsfile}.bak Please note that it is only reliable when there's only one login-shell running. Otherwise you'll need some more magic. The root cause was fixes upstream in december last year by adding the new "lock" option. If it's set, the history merge is serialized between all shell instances. The commit is here: https://github.com/tcsh-org/tcsh/commit/bb6ea8e92179d3c1b574764977f6f5e2d2ecd1e0 You'll need this one too: https://github.com/tcsh-org/tcsh/commit/0684fcc55321f6f0fca5263a5071cbe64704f1fe Maybe it would be a good idea to cherry pick those two revisions and merge then into FreeBSD, until a new tcsh version is released. Regards, Yamagi On Thu, 23 Jan 2014 14:04:07 +0400 "Marat N.Afanasyev" <amarat@li.ru> wrote: > as root while several user csh were running, after reboot user .history > file was corrupted: > > #+1360668026 > less /etc/ma#+136066#+136cd /usr/grep KERB * > #+1360668067 > cd /usr/src/contrib/bind9/##+1360668073ggrep -i kerboros * > #+1360668076 > grep -iR kerboros * > #+1360704099 > cd /usr/ports/www/mod_pag#+136084#+136fetch -oman sudoers > #+1361372281 > cd /usr/ports/editors/openoffice-3-devel/ > #+1361690297 > telnet 19#+13617995m#+man uh#+1#+13617995m#+man xh#+1#+13617995a#+man ehci -- Homepage: www.yamagi.org XMPP: yamagi@yamagi.org GnuPG/GPG: 0xEFBCCBCB
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140126215845.3b62debf03dade433622e9ba>