Skip to content

#789 splitting rework: two field-splitting regressions vs GNU 5.3.0 (nested-quote guard + ${$+<nl>}) #795

Closed

Description

@caomengxuan666

#789 (merged as d9ab4c7) changed the field-splitting behavior of two
expansion shapes away from GNU bash 5.3.0. Both were verified against a
locally built bash-5.3.0(1)-release (2026-10-18); the failing Rust
regression tests were green at aa7225d (pre-#789) and are red at master.

Case 1 — ${a[@]+"\"${a[@]}\""} loses the nested-quote split

a=(p q)
for f in "${a[@]+\"${a[@]}\"}"; do echo "[$f]"; done
printf '<%s>' "${a[@]+\"${a[@]}\"}"; echo

GNU 5.3.0:

["p]
[q"]
<"p><q">

master:

["p q]
<"p q">

The nested-quoted idiom must still split into p / q fields with the
literal quote characters preserved per field. Failing test:
tests/arrdefault_quoted_array_default_regressions.rs
nested_quoted_guard_class.

Case 2 — ${$+<newline>} unquoted word is now split

echo Unquoted: H${$+
}H

GNU 5.3.0: Unquoted: H H (one field, no split of the embedded newline).
master: Unquoted: H + H (split). Failing test:
tests/executor_command_chaining/part_061.rs
test_parameter_plus_allows_newline_word.

Both smells point at splits_unquoted_expanded_word /
mark_literal_ifs_chars in command_prepare.rs from #789. Note the same
commit also shipped an out-of-bounds panic there (fixed in 5f3fb55) —
worth a close look at the raw-skip helpers' beyond-buffer sentinels.

Related fallout in the same wave (separate issues for traceability)

  • comsub-bearing assignment words store a dirty value (len 6 vs 5)
  • ${assoc[@]@K} prints a trailing space after the last pair
  • kill-then-wait prints a job-completion notice GNU does not print
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

    regression

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions