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


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

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

Started byTomas Janousek <tomi@nomi.cz>
First post2019-08-03 17:05 +0200
Last post2019-08-03 17:05 +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

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

#15291 — History not saved when closing terminal while bash is sourcing a script

FromTomas Janousek <tomi@nomi.cz>
Date2019-08-03 17:05 +0200
SubjectHistory not saved when closing terminal while bash is sourcing a script
Message-ID<mailman.711.1564846128.1985.bug-bash@gnu.org>

[Multipart message — attachments visible in raw view] — view raw

Hello,

today I was wondering why I'm sometimes losing history entries and found out
that bash (5.0.3(1)-release, on Debian testing) won't save the history file
on closing the terminal window if it's currently sourcing something. I'm
attaching a script that uses tmux to simulate the scenario. On my system, only
"test 1" is printed, not "test 2" as expected. I think this is a bug.

A more realistic example (what actually caused my losing of history entries)
is Midnight Commander: many distros install the following file into
/etc/profile.d: https://github.com/MidnightCommander/mc/blob/master/contrib/mc.sh.in
which sources https://github.com/MidnightCommander/mc/blob/master/contrib/mc-wrapper.sh.in
so that when one exits mc, the outer shell chdirs to the last directory
browsed in mc. But this means one loses all history entries from the session
before invoking mc.

(Workaround for mc: invoke history -a before sourcing mc-wrapper. Or disable
this wrapper entirely.)

Regards,
-- 
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