You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
history -w/-a/-r/-n with HISTFILE unset silently terminates the shell (rc 2, no diagnostic, rest of the script lost) #756
history with HISTFILE unset silently terminates the shell: rc 2, no diagnostic on either stream, and the rest of the script never runs.
Repro
unset HISTFILE
history -w
echo"reached the next line"
stdout
stderr
rc
GNU bash
reached the next line
an error naming HISTFILE
0
niu / rubash
(nothing)
(nothing)
2
In my run the shell died at history -w and five later test groups never executed — I only noticed because the probe's output stopped mid-file. -a, -r and -n behave the same way per the sweep that found this.
Why this is the severe kind
Silent: nothing on stdout or stderr.
Truncating: everything after it is lost, and the script otherwise reports a normal status for what it did run.
HISTFILE's default being a documented deferred item (docs/posix-mode-audit.mdRestore upstream PR gate #29) is deliberate and is not part of this issue.
Method
LF script file; niu (installed 1.4.0) vs WSL GNU bash 5.3.0; stdout and stderr captured to separate files; the truncation was confirmed by the absence of the following groups' output, not by an exit-status reading alone.
Substantively fixed on master — closing, with one residue
Re-measured with the regression catalogue harness (WSL GNU bash 5.3.0 oracle, both arms bounded, separate stdout/stderr, arm must reach the end of the script):
arm
unset HISTFILE; history -w; echo "reached the next line"
installed 1.4.0 (rubash e785c3c8f610)
dies at history -w: stdout empty, stderr empty, rc 2 — nothing after it runs, exactly as filed
master (engine 30aaf207, 2026-10-17)
reached the next line printed, rc 0, and one diagnostic on stderr
So the severe half — silent shell death that swallowed the rest of the script — is gone. Worth keeping the shape in mind though, because the fix left one residue:
GNU : ./probe.sh: line 2: history: HISTFILE: parameter null or not set
master: ./probe.sh: line 2: history: filename not specified
Same condition, different wording, and a different prefix (history: rather than the file: line: locator form used elsewhere). That is a message-text item, not a behaviour item, so I am not keeping this issue open for it — but it is the one thing a script that greps stderr would still see.
Closing as fixed; the wording mismatch is noted here for whoever touches that path next. The two related items from the same sweep (non-interactive sessions reading $HOME/.niubash_history while ignoring HISTFILE, and an interactive session with HISTFILE set to a scratch file loading/persisting nothing) are not re-measured here and should not be considered closed by this.
Activity
caomengxuan666 commentedon Oct 17, 2026
Substantively fixed on master — closing, with one residue
Re-measured with the regression catalogue harness (WSL GNU bash 5.3.0 oracle, both arms bounded, separate stdout/stderr, arm must reach the end of the script):
unset HISTFILE; history -w; echo "reached the next line"rubash e785c3c8f610)history -w: stdout empty, stderr empty, rc 2 — nothing after it runs, exactly as filed30aaf207, 2026-10-17)reached the next lineprinted, rc 0, and one diagnostic on stderrSo the severe half — silent shell death that swallowed the rest of the script — is gone. Worth keeping the shape in mind though, because the fix left one residue:
Same condition, different wording, and a different prefix (
history:rather than thefile: line:locator form used elsewhere). That is a message-text item, not a behaviour item, so I am not keeping this issue open for it — but it is the one thing a script that greps stderr would still see.Closing as fixed; the wording mismatch is noted here for whoever touches that path next. The two related items from the same sweep (non-interactive sessions reading
$HOME/.niubash_historywhile ignoringHISTFILE, and an interactive session withHISTFILEset to a scratch file loading/persisting nothing) are not re-measured here and should not be considered closed by this.