[Bug 801863] New: bash: history is lost from time to time (after crash?)
https://bugzilla.novell.com/show_bug.cgi?id=801863 https://bugzilla.novell.com/show_bug.cgi?id=801863#c0 Summary: bash: history is lost from time to time (after crash?) Classification: openSUSE Product: openSUSE Factory Version: 12.3 Milestone 1 Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: P5 - None Component: Basesystem AssignedTo: bnc-team-screening@forge.provo.novell.com ReportedBy: jslaby@suse.com QAContact: qa-bugs@suse.de CC: werner@suse.com Found By: --- Blocker: ---
From time to time I lost some of my users' history completely. this means of root, of me or other user account I use. This indeed sucks a heap. I suspect it sometimes happens after a crash or hard powerdown occurs.
This started happening some time ago already. Some time after 12.2 was released I believe. I use bash in xterm. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=801863 https://bugzilla.novell.com/show_bug.cgi?id=801863#c1 --- Comment #1 from Jiri Slaby <jslaby@suse.com> 2013-02-02 19:31:12 UTC ---
users' history
I mean bash_history contents of course... -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=801863 https://bugzilla.novell.com/show_bug.cgi?id=801863#c2 Dr. Werner Fink <werner@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |NEEDINFO InfoProvider| |jslaby@suse.com --- Comment #2 from Dr. Werner Fink <werner@suse.com> 2013-02-04 08:14:07 UTC --- And what exactly should I do? If the bash opens ~/.bash_hsitory and tries to write out its history but then will be killed due to a crash the resulting history file is truncated. If you think this is a bug of the bash then use the command bashbug to report it upstream but I guess that even upstream can not perform some magic to resolve this. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=801863 https://bugzilla.novell.com/show_bug.cgi?id=801863#c3 Jiri Slaby <jslaby@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |NEW InfoProvider|jslaby@suse.com | --- Comment #3 from Jiri Slaby <jslaby@suse.com> 2013-02-04 08:48:09 UTC --- The thing is that it did not use to happen, it started happening even recently (as I wrote it started around switch to 12.3 -- I'm using factory all the time). Now, I don't understand from your description, why does bash open bash_history? If it is "killed" by instant poweroff or crash it should not open .bash_history at all, right? Sad is that I have no idea how to debug that, but the issue proper painfull. BTW. doesn't it open the file with O_APPEND? -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=801863 https://bugzilla.novell.com/show_bug.cgi?id=801863#c4 --- Comment #4 from Jiri Slaby <jslaby@suse.com> 2013-02-04 08:50:33 UTC --- Oh, it could be unrelated to crash/unclean poweroff, could switch to systemd cause that? I mean is the delay between TERM and KILL long enough in systemd? -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=801863 https://bugzilla.novell.com/show_bug.cgi?id=801863#c5 Dr. Werner Fink <werner@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fcrozat@suse.com --- Comment #5 from Dr. Werner Fink <werner@suse.com> 2013-02-04 09:30:59 UTC --- It does not open with O_APPEND every bash writes out a full ~/.bash_history as it may (re)sort the history, clearly locking is used for this. And this requires enough time if there are a lot of interactive bash programs are running. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=801863 https://bugzilla.novell.com/show_bug.cgi?id=801863#c6 --- Comment #6 from Frederic Crozat <fcrozat@suse.com> 2013-02-04 09:44:24 UTC --- a quick look at systemd shutdown code (http://cgit.freedesktop.org/systemd/systemd/tree/src/core/shutdown.c ) shows it will wait for applications to respond to TERM before KILL -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=801863 https://bugzilla.novell.com/show_bug.cgi?id=801863#c7 Dr. Werner Fink <werner@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |meissner@suse.com --- Comment #7 from Dr. Werner Fink <werner@suse.com> 2013-02-04 10:07:13 UTC --- (In reply to comment #6) ... all interactive shells do ignore SIGTERM but react on SIGHUP. Even upstream of systemd should know this fact;) The normal way is that if xterm is signaled by SIGTERM, it will signal the clients on the pseudo terminal line with SIGHUP that the terminal wll be closed. Maybe xterm has a bug (does not send SIGHUP for all clients on the terminal if a SIGTERM is catched) or systemd is ignoring this way. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=801863 https://bugzilla.novell.com/show_bug.cgi?id=801863#c8 --- Comment #8 from Frederic Crozat <fcrozat@suse.com> 2013-02-04 10:18:09 UTC --- hmm, the shutdown code of systemd (cf the url I gave earlier) is supposed to do a similar work to /etc/init.d/halt. I don't see in /etc/init.d/halt a call to SIGHUP -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=801863 https://bugzilla.novell.com/show_bug.cgi?id=801863#c9 --- Comment #9 from Dr. Werner Fink <werner@suse.com> 2013-02-04 10:41:29 UTC --- The SIGTERM send to XTerm should cause XTerm to send SIGHUP to the shell running on the XTerm's terminal line. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=801863 https://bugzilla.novell.com/show_bug.cgi?id=801863#c10 --- Comment #10 from Marcus Meissner <meissner@suse.com> 2013-02-05 13:31:10 UTC --- I just "kill -TERM xtermpid" xterm-287-1.1 and the underlying bash received a SIGHZUP signal. (12.3 beta 1) so probably xterm does not get a SIGTERM -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=801863 https://bugzilla.novell.com/show_bug.cgi?id=801863#c11 Dr. Werner Fink <werner@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |NEEDINFO InfoProvider| |fcrozat@suse.com --- Comment #11 from Dr. Werner Fink <werner@suse.com> 2013-02-05 14:02:44 UTC --- (In reply to comment #6) (In reply to comment #10) Indeed the lines log_info("Sending SIGTERM to remaining processes..."); broadcast_signal(SIGTERM, true); log_info("Sending SIGKILL to remaining processes..."); broadcast_signal(SIGKILL, true); in http://cgit.freedesktop.org/systemd/systemd/tree/src/core/shutdown.c seems to very hard, that is there is no sleep between SIGTERM and SIGKILL. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=801863 https://bugzilla.novell.com/show_bug.cgi?id=801863#c12 Frederic Crozat <fcrozat@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |NEW InfoProvider|fcrozat@suse.com | --- Comment #12 from Frederic Crozat <fcrozat@suse.com> 2013-02-05 14:39:04 UTC --- there is no sleep either in /etc/init.d/halt (just waiting for blogd and splash to terminate, which is not really a good hardcoded way, these days, I think). -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=801863 https://bugzilla.novell.com/show_bug.cgi?id=801863#c13 --- Comment #13 from Dr. Werner Fink <werner@suse.com> 2013-02-05 15:21:55 UTC --- (In reply to comment #12) there *is* a sleep: # Wait between last SIGTERM and the next SIGKILL # any argument specify a *path* of a process which # process identity should *not* be checked. rc_wait() { local -i etime=$SECONDS if test -f /fastboot ; then let etime+=2 else let etime+=6 fi [...] while test $SECONDS -lt $etime; do [...] done } from /etc/rc.status -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=801863 https://bugzilla.novell.com/show_bug.cgi?id=801863#c FeiXiang Zhang <fxzhang@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|bnc-team-screening@forge.pr |werner@suse.com |ovo.novell.com | -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=801863 https://bugzilla.novell.com/show_bug.cgi?id=801863#c14 Dr. Werner Fink <werner@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|werner@suse.com |meissner@suse.com --- Comment #14 from Dr. Werner Fink <werner@suse.com> 2013-04-08 11:47:10 UTC --- I can do nothing here, this happens is the bash is killed without SIGHUP and this shoulds not happen. @ Marcus: Please fix XTerm in such a way that bash is signaled with SIGHUP on closing the X connection. And please be aware that the bash might require some time to write out the history. Beside this I alos see this behaviour on 12.3 with tcsh as shell. Here also the close of the X connection causes XTerm to terminate/kill the shell(s) without using SIGHUP. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=801863 https://bugzilla.novell.com/show_bug.cgi?id=801863#c15 --- Comment #15 from Frederic Crozat <fcrozat@suse.com> 2013-04-08 12:03:46 UTC --- (In reply to comment #12)
there is no sleep either in /etc/init.d/halt (just waiting for blogd and splash to terminate, which is not really a good hardcoded way, these days, I think).
just for the record, I'm pushing an upstream patch in 12.3 maintenance update for systemd which should improve systemd behavior (correctly tracking processes which got a SIGTERM and waiting 10s before killing them) -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=801863 https://bugzilla.novell.com/show_bug.cgi?id=801863#c16 --- Comment #16 from Dr. Werner Fink <werner@suse.com> 2013-04-08 12:56:11 UTC --- Wow, ten seconds are much more than the five seconds with SysVinit. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=801863 https://bugzilla.novell.com/show_bug.cgi?id=801863#c17 --- Comment #17 from Frederic Crozat <fcrozat@suse.com> 2013-04-08 12:58:23 UTC --- (In reply to comment #16)
Wow, ten seconds are much more than the five seconds with SysVinit.
It used to be 5s, don't know why it was changed.. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com