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] inside guard reports SET for unset element; empty quoted element dropped in unquoted slice assignment c=( ${b[@]+"${b[@]:0:2}"} ) — liquidprompt test_array 2/3 fail #315
Two array-expansion divergences found by the ecosweep2 lane running liquidprompt's own shunit2 suite (tests/test_array.sh, 2 of 3 tests fail). Both live in the ${arr[@]+"…"}-guarded expansion family (residuals next to the closed #147 / #295 area):
1) ${a[2]+x} inside an ${a[@]+…} guard reports SET for an UNSET element.
typeset -a a
a[1]=1
[[ -n${a[@]+"${a[2]+x}"} ]] &&echo NONEMPTY ||echo EMPTY
GNU 5.3.0: EMPTY (element 2 is unset, +x yields nothing) — rubash @116b12aa: NONEMPTY.
This breaks the standard is-element-set idiom (test_array.sh:110: assertFalse '[[ -n ${array_a[@]+"${array_a[1]+x}"} ]]'-class assertions).
2) Empty element is dropped in an unquoted quoted-slice array assignment.
GNU: 2 and [/foobar] (elements "" and foobar survive; join with / gives leading separator) — rubash: 1 and [foobar] (the empty quoted element vanishes).
(test_array.sh:81-83 "concat empty string alt expected: but was:".)
GNU C source anchors (vendored third_party/bash)
subst.c:10348 case '+': in parameter_brace_expand() — the + alternate is produced only when the parameter (here: the subscripted element, via parameter_brace_expand_word subst.c:7663 call sites 7861/7955) is bound; an unset subscripted element yields no alternate.
Empty-element retention through the unquoted slice: subst.c:11229 expand_word_internal() — quoted elements of ${arr[@]:X:Y} expand with quoting flags that keep empty words until field splitting (subst.c:13219 expand_word_list_internal()); GNU keeps the empty field.
Reproducer
Script p-lparr.sh (both shells, script-file): rubash t1=NONEMPTY(bug) t2 count=1 t3 join=[foobar], GNU t1=EMPTY t2 count=2 t3 join=[/foobar]; rc 0/0.
Environment / artifacts
rubash release @116b12aa (wt13/ecosweep2); oracle WSL GNU bash 5.3.0
liquidprompt @afd7e83 suite outputs target/issue-suites/results/ecosweep2/lp/rb/test_array.sh.*; probes p-lparr.sh + rb-lparr.out/gnu-lparr.out
Fixed by wt13/sweepfix (faf83863, master 203c2b5): three consumers each lost word-list semantics - [[ ]] operands treated the QUOTED_NULL marker (U+E002, CTLNUL port) as a visible byte ([[ -n ]] true); the argv/for multiword check only recognized a literal [@]} tail so slices missed it and merged through the String path losing empties; the compound-assignment path had no word-list branch. All three fixed against subst.c:10348 (+ case), :7993/:8023-8027 (expand_string_for_rhs -> l->next /*qdollaratp), :8036-8044/:11940-11944 (QUOTED_NULL/W_HASQUOTEDNULL), cond.c cond_expand_word. 19-shape matrix byte-identical; liquidprompt test_array rc=1(failures=3) -> rc=0. One recorded residual ([[ ${b[@]+"${b[@]:0:2}"} == ... ]] conditional single-word join drops a leading empty - assignment context correct).
Activity
docs(corpus): ecosweep2 lane section — second-pass fine-grained corpu…
fix(#311): nounset pattern-operator false unbound - pre-operator refe…
fix(#315): array-guard alternate word lists - quoted-null strip, slic…
caomengxuan666 commentedon Sep 29, 2026
Fixed by wt13/sweepfix (faf83863, master 203c2b5): three consumers each lost word-list semantics - [[ ]] operands treated the QUOTED_NULL marker (U+E002, CTLNUL port) as a visible byte ([[ -n ]] true); the argv/for multiword check only recognized a literal [@]} tail so slices missed it and merged through the String path losing empties; the compound-assignment path had no word-list branch. All three fixed against subst.c:10348 (+ case), :7993/:8023-8027 (expand_string_for_rhs -> l->next /*qdollaratp), :8036-8044/:11940-11944 (QUOTED_NULL/W_HASQUOTEDNULL), cond.c cond_expand_word. 19-shape matrix byte-identical; liquidprompt test_array rc=1(failures=3) -> rc=0. One recorded residual ([[ ${b[@]+"${b[@]:0:2}"} == ... ]] conditional single-word join drops a leading empty - assignment context correct).