Skip to content

printf -v 写 LC_ALL 不发 setlocale 失败警告(赋值通道有),funnel 旁路写残余面 #3009

Closed

Description

@caomengxuan666

现象

运行时给 LC_ALL 赋值若目标 locale 不存在,GNU 在所有写入通道都发 setlocale 警告;rubash 只在普通赋值通道发,printf -v LC_ALL 通道静默——与 #2979 修掉的「guard 不读」同属 funnel 旁路写家族的残余面(那次修的是数值 guard 链,本单是警告面)。

最小复现(队长在 PR #2996 复核二进制上亲测,GNU bash 5.3.20 对照;本机未装 de_DE.UTF-8)

printf -v LC_ALL de_DE.UTF-8; echo ok
  • GNU:stderr warning: setlocale: LC_ALL: cannot change locale (de_DE.UTF-8): No such file or directory,stdout ok,rc=0。
  • rubash:仅 ok,无警告,rc=0。

对照格(两边一致):普通赋值 LC_ALL=de_DE.UTF-8; echo ok 两边都发警告;环境进入(LC_ALL=de_DE.UTF-8 rubash -c …)两边都在启动时发警告。

定根方向

#2979 的修法把 LC_NUMERIC guard 链做成共享判定(locale::is_multi_byte_active() + 第二 guard 槽);setlocale 失败警告应同样收敛到 locale 变更的统一漏斗上——任何通道改 LC_ALL/LC_CTYPE/LANG 的生效值时都走同一次「尝试生效 + 失败警告」,不许各通道各写一份。修复须带以本单号命名的回归钉(printf -v 通道 + declare/赋值对照通道)。

归宿:Stage 3 长尾 / 自动派活队列。

Activity

  1. added
    bug
    gnu-baseline
    area:builtins
    on Nov 7, 2026
  2. caomengxuan666 commented on Nov 8, 2026

    @caomengxuan666
    MemberAuthor

    Closed by merged PR #3057 (squash merge 963f8a3a, 2026-11-08).

    Captain verification (head a7e9ad5f, true base e8a3d01f; full record in the captain review):

    • Regression pins on head: 8 passed / 0 failed; transplanted onto the base: 3 passed / 5 failed (fail-first holds).
    • Neighbours: issue1692 5/0, issue1531 1/0, issue2979 11/0, issue1870 5/0, issue2965 14/0.
    • Full lib: head 1197/0/4, base 1197/0/4 — identical.
    • RUSTFLAGS="-D warnings" rc=0; hygiene clean; fmt clean; CR zero.
    • CI on the merged head: 10 green + 1 skipping, mergeState CLEAN.

    Root cause: printf -v NAME binds never ran the locale funnel, so printf -v LC_ALL bogus bound silently where GNU warns. The fix runs the funnel at all three successful-store exits of assign_printf_output, keyed by the operand name — GNU's stupidly_hack_special_variables fires by the -v operand name, not the nameref-resolved target.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area:builtinsbuggnu-baseline

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions