Repository navigation
printf locale faces read the guard; declare subscript operands unmarked (Refs #2979, #2980) - #2996
Merged
Merged
Conversation
byte_mode (%S/%C width and precision), the \u/\U encode gate, the %q/%Q quoting walks and decimal_point() read the process environment, while the character-constant face (rubash#2965) reads the dispatch guard's variable-table locale. A store that bypasses the assignment funnel (printf -v LC_ALL ...) left table and process env split, and the faces disagreed with each other and with GNU: GNU keeps one current locale per category via the sv_locale watchers (locale.c:185 set_locale_var, locale.c:345 get_locale_var). All printf multibyte reads now go through locale::is_multi_byte_active(); ShellLocaleGuard additionally carries the LC_NUMERIC category chain (LC_ALL > LC_NUMERIC > LANG) in a second slot, and decimal_point() resolves through it. The global is_utf8()/is_multi_byte() env reads are unchanged for non-builtin consumers. Pins: tests/issue2979_printf_locale_guard_faces_regressions.rs (fail-first 8 failed / 2 control passed; after: 11 passed / 0 failed).
Under set -a, declare arr[0]=x printed declare -ax while GNU prints declare -a, at top level and inside functions. The operand binds an element through assign_array_element, which never applies the mark_modified_vars mark; the mark belongs to whole-name bindings (variables.c:3211-3212). execute_declare's rubash#538 post-pass split the operand on '[' and marked the base name anyway. It now skips subscript operands, matching execute_local's post-pass, which already skipped them. Explicit declare -x arr[0]=x keeps -ax (the builtin's own attribute application, probed against GNU). Existing-pin audit before the change: no pin depended on the subscript -ax shape; every standing -ax expectation is a whole-name shape (issue2964 compound, issue2945, issue2944 -arx, issue2963 scalar binds) and is pinned as a control in the new stem. Pins: tests/issue2980_declare_subscript_allexport_regressions.rs (fail-first 7 failed / 1 control passed; after: 8 passed / 0 failed).
This was referenced Nov 7, 2026
caomengxuan666
marked this pull request as ready for review
November 7, 2026 17:13
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.
Lane delivery for two captain-filed residuals. One commit per issue; this PR stays draft for captain verification (UNVERIFIED-BY-CAPTAIN; full evidence in the lane REPORT).
Refs #2979
Refs #2980
printf locale faces (first commit)
printf's remaining locale faces read the process environment while the character-constant face reads the dispatch funnel's ShellLocaleGuard: byte_mode for %S/%C (value.rs), the \u/\U encode gate and the %q/%Q quoting walks (escape.rs), and decimal_point(). Plain in-script assignments mask the split because the assignment funnel mirrors the locale family into the process env (rubash#1531); a store-side write such as
printf -v LC_ALL Cbypasses the funnel and the faces diverge from GNU and from each other (%d "'é"said 195 while\u00e9still encoded UTF-8). All printf multibyte reads now sharelocale::is_multi_byte_active(); the guard carries a second slot with the LC_NUMERIC category chain (LC_ALL > LC_NUMERIC > LANG, GNU locale.c:345) and decimal_point() resolves through it. GNU anchors: locale.c:185 set_locale_var, printf.def:502/532, snprintf.c:442-443.declare subscript allexport mark (second commit)
Under
set -a,declare arr[0]=xprinteddeclare -ax; GNU prints-a. execute_declare's allexport post-pass derived the base name and marked it, but a subscript operand binds through assign_array_element, which never applies the mark_modified_vars mark (variables.c:3211-3212). The pass now skips subscript operands, matching execute_local's post-pass. Existing-pin audit: no pin depended on the subscript-axshape; all standing-axexpectations are whole-name shapes and stay pinned as controls.Self-verification (lane-run, captain to re-check)
No public API surface added (new locale helpers are pub(crate)); docs/api-ledger.md and src/lexer/continuation.rs untouched.