Skip to content

[bug] declare -r RO PID + coproc on readonly name: rubash leaves the _PID var visible to declare -p (GNU does not) #352

Closed

Description

@caomengxuan666

Found by gnusweep3 lane (orphan sub nameref11.sub — never referenced by any GNU suite; WSL GNU Bash 5.3.0 oracle, worktree 0fe8d0f).

Repro:

declare -r RO RO_PID
coproc RO { :; }
declare -p RO_PID
wait
declare -p RO RO_PID

GNU 5.3.0 stdout: declare -r RO (only RO listed at the end); rubash stdout: declare -r RO_PID + declare -r RO — rubash keeps RO_PID visible after the failed coproc, GNU's coproc cleanup leaves no RO_PID to list. Error lines also attach to different line numbers (GNU reports the cannot-unset at line 3, rubash at line 4 — artifacts attached).

GNU C owner: builtins/coproc.def (coproc setup/unset of the _PID companion) + builtins/declare.def declare -p listing path.
Artifacts: target/issue-suites/results/gnusweep3/orphan/case/nameref11.; minimal target/issue-suites/results/gnusweep3/probes/min/m19-coproc-readonly.

Activity

  1. added
    bug
    gnu-baseline
    on Sep 30, 2026
  2. added 2 commits that reference this issue on Sep 30, 2026
  3. caomengxuan666 commented on Sep 30, 2026

    @caomengxuan666
    MemberAuthor

    Locked and classified by wt21/resid21 (65a67c4c, master d5d6642): the issue's original repro is ALREADY byte-parity on current master (coproc_unset_vars port of execute_cmd.c:2450 landed earlier). The residual m5/m6 (immediate $X_PID after two coprocs) is a pure child-exit latency race — with both coprocs alive GNU also shows the pid (m8 agrees on both shells), and rubash polls at every GNU-equivalent point (eval.c:355 per command, the reap loop, the wait path); Windows ~30ms spawn latency loses the race. 5 regression tests lock the deterministic windows. Platform-bound timing, not a semantics gap.

  4. caomengxuan666 commented on Oct 2, 2026

    @caomengxuan666
    MemberAuthor

    Verified fixed on master (2026-10-02 full-rebaseline lane, dc3e799 worktree build). The issue's exact reproducer:

    declare -r RO RO_PID
    coproc RO { :; }
    declare -p RO_PID
    wait
    declare -p RO RO_PID

    rubash stdout is now byte-identical to WSL GNU Bash 5.3.0 (declare -r RO_PID from line 3; after wait only declare -r RO, with declare: RO_PID: not found on stderr), and the stderr line numbers match GNU exactly (line 2 RO: readonly variable, line 4 RO: cannot unset: readonly variable, line 5 declare: RO_PID: not found). rc 1 on both sides.

    Stability: 20/20 consecutive runs byte-identical to GNU — the RO_PID visibility race documented in COMPATIBILITY-STATUS (2026-09-25 nameref timing residual) no longer reproduces. The 2026-10-02 full ledger keeps a 5-line nameref residue from the same family (RO_PID appearing in a declare -r listing under timing pressure inside the suite), tracked there as the coproc-reap timing residual, not this issue's cross-suite divergence.

    Probe artifacts: target/issue-suites/results/wt42-verify/i352.{sh,gnu.out,gnu.err,rb.out,rb.err}. Closing as fixed.

  5. caomengxuan666 commented on Oct 2, 2026

    @caomengxuan666
    MemberAuthor

    Verified fixed on master by the wt42/rebaseline lane (20/20 stable, stdout/stderr/rc byte-identical to WSL GNU 5.3.0) — closing per the lane's verification (the fix had landed without the issue being closed).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggnu-baseline

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions