> If you are using whatver `close' button your window manager provides to > exit the shell rather than exit or ^D, it's possible that there is a signal > race condition involved here. Many window managers send SIGHUP/SIGKILL to > running processes on window close.
That's pretty much what happens. I use xinit, so when I exit it kills the X server. That closes the connections to the (typically 3-4) xterms, which IIRC then send SIGHUP to their child shells. > Bash-4.2 runs its handlers for terminating signals like SIGHUP immediately, > interrupting whatever is in progress. That, coupled with attempting to > save the history from interactive shells killed this way, could result in > zero-length files if the signals arrive at the right time. True, but "the right time" is pretty skinny. My typical behavior is to type "sync" (ancient habit that I doubt I'll ever break, dating back to the days of major unreliability) and then kill X. The net is that all my bash instances are idle at that point, sitting at the command prompt. So even if the signal handlers are calling the history-writing code directly, life should be OK unless a second SIGHUP arrives. (Does bash re-enable signals when the handler gets called? Seems unlikely, but...) -- Geoff Kuenning ge...@cs.hmc.edu http://www.cs.hmc.edu/~geoff/ The "M" in XML stands for _markup_. If you don't have anything outside the angle brackets, you probably shouldn't be using XML.