Skip to content

[bug] bind set silently accepts invalid bell-style/keymap values (no "could not set value" diagnostic) #2871

Closed

Description

@caomengxuan666

症状

bind 'set <var> <bogus>' 对枚举型 readline 变量 bell-style / keymap 给非法值时,rubash 静默接受、不报诊断;GNU 报 readline: <var>: could not set value to '<bogus>' 且保持原值。bell-style 的非法值还会被存下,bind -v 回读到非法值本身。

最小复现

bind 'set bell-style bogus' 2>&1; bind -v | grep bell-style
bind 'set keymap bogus' 2>&1; bind -v | grep keymap

GNU 期望(oracle:自编译 GNU bash 5.3.20)

readline: bell-style: could not set value to `bogus'
set bell-style audible
readline: keymap: could not set value to `bogus'
set keymap emacs

rubash 实际(master c703f2d)

set bell-style bogus
set keymap emacs

即:bell-style 无诊断且非法值被存下;keymap 值虽未改(仍 emacs),但诊断行丢失。两种情形 rc 均为 0(与 GNU 同)。

边界(均与 GNU 一致,不属本单)

  • bind 'set editing-mode bogus':两壳同报 readline: editing-mode: could not set value to 'bogus'(该变量的校验在 rubash 已有)。
  • bind 'set horizontal-scroll-mode bogus' / bind 'set completion-query-items bogus':两壳同静默(GNU 亦不诊断)。
  • 合法值 bell-style visible / keymap vi / editing-mode vi:两壳同;大写 BOGUS:GNU 仍诊断,rubash 仍静默。

GNU 法源

lib/readline/bind.c:2087 _rl_init_file_error ("%s: could not set value to %s'", name, value)`。

Regression seed:

bind 'set bell-style bogus' 2>&1; bind -v | grep bell-style
# GNU 期望:stderr 含 "readline: bell-style: could not set value to \`bogus'",且输出为 "set bell-style audible"
bind 'set keymap bogus' 2>&1; bind -v | grep keymap
# GNU 期望:stderr 含 "readline: keymap: could not set value to \`bogus'",且输出为 "set keymap emacs"

Activity

  1. added
    bug
    gnu-baseline
    area:interactive
    on Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area:interactivebuggnu-baseline

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions