From 4cddd70586f64530e41ccb3c4293c5e805ef840a Mon Sep 17 00:00:00 2001 From: Ananth Date: Sat, 17 Apr 2021 20:42:11 -0700 Subject: [PATCH 1/8] Always keep history --- bashhist.c | 2 ++ bashhist.h | 2 ++ builtins/set.def | 16 ++++++++-------- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/bashhist.c b/bashhist.c index 2a05a53..eb6471a 100644 --- a/bashhist.c +++ b/bashhist.c @@ -91,6 +91,8 @@ static struct ignorevar histignore = int remember_on_history = 0; int enable_history_list = -1; /* value for `set -o history' */ +int private_history_mode = 0; + /* The number of lines that Bash has added to this history session. The difference between the number of the top element in the history list (offset from history_base) and the number of lines in the history file. diff --git a/bashhist.h b/bashhist.h index 615f5d2..8061bac 100644 --- a/bashhist.h +++ b/bashhist.h @@ -39,6 +39,8 @@ # endif /* !HISTEXPAND_DEFAULT */ #endif +extern int private_history_mode; + extern int remember_on_history; extern int enable_history_list; /* value for `set -o history' */ extern int literal_history; /* controlled by `shopt lithist' */ diff --git a/builtins/set.def b/builtins/set.def index 8ee0165..150e153 100644 --- a/builtins/set.def +++ b/builtins/set.def @@ -395,7 +395,7 @@ set_ignoreeof (on_or_off, option_name) ignoreeof = on_or_off == FLAG_ON; unbind_variable_noref ("ignoreeof"); if (ignoreeof) - bind_variable ("IGNOREEOF", "10", 0); + bind_variable ("IGNOREEOF", "10", 0); else unbind_variable_noref ("IGNOREEOF"); sv_ignoreeof ("IGNOREEOF"); @@ -468,16 +468,16 @@ bash_set_history (on_or_off, option_name) { if (on_or_off == FLAG_ON) { - enable_history_list = 1; - bash_history_enable (); - if (history_lines_this_session == 0) - load_history (); + private_history_mode = 0; } else { - enable_history_list = 0; - bash_history_disable (); + private_history_mode = 1; } + enable_history_list = 1; + bash_history_enable (); + if (history_lines_this_session == 0) + load_history (); return (1 - enable_history_list); } #endif @@ -706,7 +706,7 @@ set_builtin (list) break; } } - + /* Do the set command. While the list consists of words starting with '-' or '+' treat them as flags, otherwise, start assigning them to $1 ... $n. */ -- 2.31.1