Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15309 > unrolled thread

Re: History not saved when closing terminal while bash is sourcing a script

Started byTomas Janousek <tomi@nomi.cz>
First post2019-08-08 10:13 +0200
Last post2019-08-08 10:13 +0200
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: History not saved when closing terminal while bash is sourcing a script Tomas Janousek <tomi@nomi.cz> - 2019-08-08 10:13 +0200

#15309 — Re: History not saved when closing terminal while bash is sourcing a script

FromTomas Janousek <tomi@nomi.cz>
Date2019-08-08 10:13 +0200
SubjectRe: History not saved when closing terminal while bash is sourcing a script
Message-ID<mailman.1042.1565252025.1985.bug-bash@gnu.org>
Hi,

On Sun, Aug 04, 2019 at 01:42:12PM -0400, Chet Ramey wrote:
> On 8/3/19 11:05 AM, Tomas Janousek wrote:
> I don't have or use tmux, but I'm going to guess that `kill-window' sends
> a SIGHUP to the process group and follows it up with a SIGKILL. The
> `source' turns off saving to history -- the `source' gets saved in the
> history list, not the commands it runs -- and is still running when the
> SIGHUP arrives. The SIGHUP causes the shell to exit without saving the
> history because history is turned off when the signal handler runs.

So this means `source' shouldn't ever be used in interactive shells if one
cares about their shell history, right? I'll file an issue in the Midnight
Commander bug tracker to use a shell function instead. It might be worth
documenting the behaviour, though, as it is quite suprising -- shell functions
don't need to turn off saving to history, so why should `source'?

-- 
Tomáš Janoušek, a.k.a. Pivník, a.k.a. Liskni_si, http://work.lisk.in/

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web