Repository navigation
fix7 history-eng: history -p rc (#1627), HISTFILE unset text/rc (#1633), untimestamped entries read-time (#1628), stdin non-recording (#1629) - #1670
Merged
Conversation
GNU builtins/history.def:457 expand_and_print_history() processes every operand in order, prints the successful expansions, and turns the overall result into EXECUTION_FAILURE when any history_expand call returns < 0. The Print arm printed the diagnostic and continued, then fell through to Ok(0), so `history -p '!999'` exited 0. Track any failure and return Ok(1) after the loop. Verified against GNU bash 5.3.20 (script file): mixed good/bad operands print the good ones and exit 1; `!999` and `^a^b^` failures exit 1; all-good and no-operand forms exit 0. Regression: tests/issue1627_history_print_rc_regressions.rs Fixes rubash#1627
GNU builtins/history.def:273 takes the -a/-n/-r/-w filename from the
operand or $HISTFILE; :280-282 reports a null filename by source —
"HISTFILE: parameter null or not set" when it came from $HISTFILE
(unset or empty), "empty filename" for an explicitly empty operand —
with EXECUTION_FAILURE in a non-interactive shell. The shared file
branch printed "filename not specified" and returned 2 for the unset
case, and the host-provider path in execute_history had the same
wrong wording. Both now follow GNU; the explicitly empty operand
gets its own diagnostic.
Verified against GNU bash 5.3.20 (script file): all four modes x
{unset, set-but-empty, empty operand}.
Regression: tests/issue1633_history_histfile_unset_regressions.rs
Fixes rubash#1633
Entries read from a history file without a `#<epoch>` line got an empty stamp, which the HISTTIMEFORMAT display rendered as epoch 0 (1970-01-01). GNU's histfile read path adds entries through add_history, and lib/readline/history.c:322 hist_inittime() stamps every added entry with the current time; a `#<epoch>` line overrides it for the following entry via histfile.c add_history_time(). load_file and read_new_file now push Self::now_stamp() when no saved timestamp precedes the line (record() uses the same helper). Verified against GNU bash 5.3.20: untimestamped lines display the read time, a `#1700000000` line still wins for its entry. Regression: tests/issue1628_history_read_timestamp_regressions.rs Fixes rubash#1628
run_stdin_script recorded every completed input group into the session history unconditionally. GNU gates recording on remember_on_history (bashhist.c:91, default 0; applied at bashhist.c:642-643 in pre_process_line) — the `history` set option, off by default in a non-interactive shell. Lines read from stdin now record only when __RUBASH_SETOPT_history is "1", the same gate the grouped reader and the exit-time save already use, so `history -s` entries still appear but input lines no longer enter the list. Verified against GNU bash 5.3.20 (piped stdin): the seed form lists only the -s entry; lines after a first history builtin stay unrecorded; `set -o history` mid-stream records only later lines. Regression: tests/issue1629_stdin_history_recording_regressions.rs Fixes rubash#1629
Member
Author
集成验证结果(master 6bedad9 + 本片 4 提交,树 tip a3c55bf)全部 cargo 经构建槽位、JOBS=1/debuginfo=0/净化环境。
四门全绿,可合并。合并时请留意:四条 issue 各有独立 |
This was referenced Oct 26, 2026
Closed
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix7 history-eng 片:history 内建四条 GNU 对齐修复
基线 master
6bedad97(含 perf-arrays #1615),cherry-pick 簇分支fix7/history-eng的 4 个提交,零冲突。Fixes #1627
Fixes #1628
Fixes #1629
Fixes #1633
逐条
history -p展开失败仍 rc=0:HistoryMode::Print臂累计any_failed,任一操作数展开失败返回 1(GNUbuiltins/history.defexpand_and_print_history语义:成功者照常打印、任一失败总结果 EXECUTION_FAILURE)。回归:tests/issue1627_history_print_rc_regressions.rs。history -a/-n/-r/-w文案与 rc 错:共享分支改 GNU 文案HISTFILE: parameter null or not set+ rc 1,显式空操作数补empty filenamerc 1;宿主 provider 路径(job_builtins.rs)同步。回归:tests/issue1633_history_histfile_unset_regressions.rs。load_file/read_new_file对无#<epoch>前缀条目改按读入时间盖戳(GNUadd_history_time仅覆盖有戳条目,无戳走hist_inittime当前时间模型)。回归:tests/issue1628_history_read_timestamp_regressions.rs。__RUBASH_SETOPT_history == "1"才记录,对齐 GNUremember_on_history非交互默认关)。回归:tests/issue1629_stdin_history_recording_regressions.rs。全部期望先经 GNU bash 5.3.20 oracle 脚本复现、再对照修复前二进制确认 bug 在位后才动手。
簇侧验证(基线 d15a02d)
--skip login_posix_env与 pristine d15a02d 同集(770/1/1,唯一失败为允许项ownership_unary_operators_check_existing_file)。src/lexer/continuation.rs未碰。集成验证(待回填)
集成树(master 6bedad9 + 本片 4 提交)验证进行中,结果将以评论回填:① 9 个历史 harness 定向;② lib 全量与当前 master 基线同集判据;③ diffcorpus 306 差分(本树不含 #1609 修复,期望稳定失败集 {gl08, ms10});④ rustfmt/CR/continuation.rs 复核。
已知残留(已另行立案 #1668/#1669,不在本片范围):损坏时间戳显示回退、stdin 模式
set -o history后仍不记录后续行。