Hello! I issued shutdown -p now 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 I have savehist (1000 merge) set in user .cshrc I think that merging histories from different csh was broken somehow -- SY, Marat -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4228 bytes Desc: S/MIME Cryptographic Signature URL: <http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20140123/48ceb641/attachment.bin>
Marat N.Afanasyev wrote:> Hello! > > I issued > > shutdown -p now > > 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 > > I have > > savehist (1000 merge) > > set in user .cshrc > > I think that merging histories from different csh was broken somehow >I forgot to mention revision of 10.0: FreeBSD zealot.ksu.ru 10.0-PRERELEASE FreeBSD 10.0-PRERELEASE #0 r260903: Mon Jan 20 16:45:26 MSK 2014 root at zealot.ksu.ru:/mnt/ssdtmp/obj/mnt/mod_usr/10.0/sys/ZEALOT amd64 -- SY, Marat -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4231 bytes Desc: S/MIME Cryptographic Signature URL: <http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20140123/7ebe433a/attachment.bin>
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 at 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 at yamagi.org GnuPG/GPG: 0xEFBCCBCB