Skip to content

modernish init reports spurious 'readonly function' for shellquote/_Msh_qV_dblQuote; suite re-source spams readonly + which.mm let error #2511

Closed

Description

@caomengxuan666

现象(2026-11-02 半夜 ecosuite modernish 链 + 主会话独立复现)

modernish 0.17.23-dev 在冻结头(rubash 37eef11 / niu 9b78d5e7)下不可用,GNU bash 5.3.20 同环境全过。三个面,前两个已独立复现、第三个为套件级观测待隔离:

面 1(已复现):init 阶段 readonly function 误报。
最小复现(env 净化、MSH_PREFIX 预置):

. "$MSH_DIR/bin/modernish"

GNU:静默完成。rubash:

bin/modernish: line 14: shellquote: readonly function
bin/modernish: line 14: _Msh_qV_dblQuote: readonly function

注:基础语义已对照干净——exec 导入的函数在两壳都不带 readonly、fork 子壳内重定义 readonly 函数两壳同报错(逐字节一致)。分歧在 modernish init 的两相位/能力探针路径上:某个 GNU 下会跳过的重定义路径在 rubash 下被走到了(thisshellhas/isset 类探针裁定差异为首要嫌疑,未定谳)。

面 2(套件级观测,待隔离):全量 --test 中途 abort(rc 128)时子壳重入 source 满屏 readonly function(_Msh_* 乃至 echo、mktemp),疑与面 1 同根(探针/重定义路径),须隔离后定谳。

面 3(点链观测,待隔离):STEP 2 sys/base/which 死于

lib/modernish/mdl/sys/base/which.mm: line 125: let: --: arithmetic syntax error: operand expected (error token is "-")

该行本体为 let "$#";基础形状(函数内 let "$#"、首参 -s、shift 后)主会话逐一对照 GNU 全一致,未能独立复现——须在 modernish 完整语境(use 加载 + which 选项解析全程)下隔离,可能与面 1 的函数定义损坏级联有关。

归宿

半夜测试炸出的真缺陷,按「谁发现谁修」由主会话认领修复(进 1.5.0 发布门)。相邻面勿混:bin/modernish die-trap 串的 0<&8 &;; 解析错误是 #2493(win 侧在修),不在本条范围;本条只管 readonly/let 两面。

证据:ecosuite 报告 ~/workspace/freeze-150/niu-ecosuite-REPORT.md modernish 节;复现脚本 scratch(msh1.sh / ro1.sh,对照组)。

Activity

  1. added this to the 1.5.0 milestone on Nov 1, 2026
  2. added
    bug
    gnu-baseline
    P1-high
    area:builtins
    on Nov 1, 2026
  3. caomengxuan666 commented on Nov 1, 2026

    @caomengxuan666
    MemberAuthor

    Fixed and merged via PR #2513 (merge 122b1d3).

    Root cause: a function body streamed in from a here-string/pipe was alias-expanded a second time at the call site (the streamed marker was not pinned for streamed bodies), corrupting names the caller had already resolved — modernish's thisshellhas probe hit it via its readonly plumbing. The fix pins mark_alias_streamed() for streamed function bodies at the one call site in the function-call path, so a streamed body executes as written.

    Verification (captain, scrubbed harness, rebased + master-merged tree): issue2511 pins 3/3, issue2212 remainder 15/15, issue2227 bracket-quote 6/6; full CI green including the cross-repo ledger job. The ecosuite modernish chain that surfaced this now loads and runs.

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

Metadata

Metadata

Labels

P1-higharea:builtinsbuggnu-baseline

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions