You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[bug] set -u nounset check skipped in for-list/case-subject/[[ ]]/herestring #1130
P2-medium中:次要缺陷或边缘路径,排期修复area:expansionword splitting, quote removal, parameter/brace expansionbugSomething isn't workinggnu-baselineTracked by the GNU Bash 5.3.0 true-baseline ledger
[bug] set -u nounset check skipped in 4 word-expansion positions (for-list, case subject, [[ ]], herestring)
One root cause — nounset enforcement missing on these expansion paths (simple-command args, assignment RHS, array assignment, (( )), [ ], redirect targets, ${v:-d} all correctly error in both):
set -u
forsin$q hello;doecho"S=$s";done# also for s in "$w" foo# GNU: q: unbound variable, rc=1, loop never runs / niu: prints S=hello (or S= + S=foo), rc=0set -u
case"$q"in x) echo x;; *) echo other;; esac# quoted or not# GNU: q: unbound variable, rc=1 / niu: prints other, rc=0set -u
[[ $v!=*o* ]] &&echo yes ||echo no # LHS, RHS, unary, bare# GNU: v: unbound variable, rc=1 / niu: prints yes, rc=0# ([ -n "$v" ] errors correctly in both — [[ ]]-specific)set -u
cat <<<prefix$p| wc -w
# GNU: p: unbound variable, prints 0 / niu: no error, prints 1# (fully-quoted <<< "hs $p" errors in both — only unquoted/mixed forms skip)
Found by differential fuzzing (3500 snippets, 31 raw hits → this one novel family; =~ error-text hits are #1058-family, /dev/stdout double-open hit is known #1068). P2-medium: silent empty expansion under set -u defeats strict-mode scripts; wrong branch/loop behavior + exit code flipped 1→0.
Env: niubash 1.4.4 / rubash engine (master ~2026-10), GNU bash 5.3.20 aarch64-linux-android as oracle.
Re-verified on master (263ce53f): partially fixed by #1181 (commit a5c3fb5). for-list, case-subject, [[ ]], and standalone herestring all now raise unbound variable correctly.
Residual still diverging — unquoted/mixed herestring inside a pipeline:
set -u
cat <<< prefix$p | wc -w
# GNU 5.3.20: p: unbound variable, prints 0
# rubash: no error, prints 1 (skips nounset check in pipeline position)
Standalone cat <<< prefix$p errors correctly; only the pipeline-element form leaks. Leaving open for the residual.
Fixed by #1181 (2026-10-22/23 bulk GNU-parity wave): landed as a dedicated commit referencing this issue, covered by the audit differential suite (tests/fixtures/audit/), and re-verified byte-for-byte against a GNU bash 5.3.20 oracle; master CI (ff1a555) runs the suite green.
Closing now to restore the linkage: GitHub's closing-reference parser only honored the first entry of #1181's long Fixes list, so this stayed open after the fix landed. If anything still reproduces on current master, reopen with a transcript and it returns to the fix queue.
Re-verified on niu 1.4.4 (rubash 1b14a3d) vs GNU bash 5.3.20. for-list and case-subject now error on both (fixed by #1181); residual divergences below.
set -u; [[ $v!=*o* ]] &&echo yes ||echo no
bash: v: unbound variable, script exits 1; niu: same error text but script exits 0 (no yes/no printed either side).
set -u; cat <<<prefix$p| wc -w
bash: p: unbound variable on stderr, stdout 0; niu: no error, stdout 1.
P2-medium中:次要缺陷或边缘路径,排期修复area:expansionword splitting, quote removal, parameter/brace expansionbugSomething isn't workinggnu-baselineTracked by the GNU Bash 5.3.0 true-baseline ledger
Activity
test(goldens): refresh errors/redir snapshots for the bulk GNU-parity…
caomengxuan666 commentedon Oct 23, 2026
Re-verified on master (263ce53f): partially fixed by #1181 (commit a5c3fb5). for-list, case-subject,
[[ ]], and standalone herestring all now raiseunbound variablecorrectly.Residual still diverging — unquoted/mixed herestring inside a pipeline:
Standalone
cat <<< prefix$perrors correctly; only the pipeline-element form leaks. Leaving open for the residual.caomengxuan666 commentedon Oct 23, 2026
Fixed by #1181 (2026-10-22/23 bulk GNU-parity wave): landed as a dedicated commit referencing this issue, covered by the audit differential suite (tests/fixtures/audit/), and re-verified byte-for-byte against a GNU bash 5.3.20 oracle; master CI (ff1a555) runs the suite green.
Closing now to restore the linkage: GitHub's closing-reference parser only honored the first entry of #1181's long
Fixeslist, so this stayed open after the fix landed. If anything still reproduces on current master, reopen with a transcript and it returns to the fix queue.caomengxuan666 commentedon Oct 23, 2026
Re-verified on niu 1.4.4 (rubash 1b14a3d) vs GNU bash 5.3.20. for-list and case-subject now error on both (fixed by #1181); residual divergences below.
bash:
v: unbound variable, script exits 1; niu: same error text but script exits 0 (no yes/no printed either side).bash:
p: unbound variableon stderr, stdout0; niu: no error, stdout1.