Skip to content

fix(executor): drop the transport prefix before splitting indexed words (#621) - #660

Merged
caomengxuan666 merged 1 commit into
masterfrom
fix/issue621-leading-split
Oct 16, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
fix/issue621-leading-split

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

fix(executor): drop the transport prefix before splitting indexed words (#621)

What

v=' 1 '; plain=($v) produced 2 elements (["","1"]) where GNU
produces 1. The field-split transport prefixes the word with a
bookkeeping marker; the indexed consumer left it in the accumulator, so
a leading separator pushed a marker-only first part decoding to a phantom
"". GNU strips leading IFS whitespace (subst.c:3142 list_string).

Fix

Two lines (both copies: executor split_indexed_tagged_token + declare
storage twin): consume the transport prefix up front. The post-split map
re-adds the prefix per part, so downstream bytes are unchanged for all
previously-correct shapes (verified: trailing-only, interior,
all-whitespace→empty, quoted-kept, assoc readback, IFS=: leading-empty
kept, IFS= unsplit). Assoc path untouched (already correct, different
decode).

Verification

  • New 30-case GNU differential battery: 11/30 on master → 30/30
    (spaces/tabs/mix, scalar/assoc/indexed sources, literal/var
    subscripts, declare -a path, multi-word, IFS variants).
  • The issue's named test
    compound_assignment_splits_unquoted_associative_array_element
    flips fail→pass in the full gate (DISAPPEARED from the failing set).
  • New tests/issue621_leading_split.rs (11 tests).
  • Focused suites green (parity, compound-quote, fieldsplit ×2,
    bracket-glob, assoc-transform, declare/nameref); the one failure
    (issue298 positionals) fails identically on baseline (Android env).
    Full serial failure-set gate vs master: target sets identical
    (NEW=0/DISAPPEARED=0); test-level 1 NEW / 3 DISAPPEARED — the
    DISAPPEARED includes the issue's named test (fail→pass), the rest are
    the known-nondeterministic part_080 family (pass in isolation).
  • niubash product A/B (niubash pinned 6295367, only rubash [patch]
    switched): failure sets byte-identical (49=49).

GNU owners: subst.c:3119 list_string (:3142 leading strip),
arrayfunc.c:610 expand_words_no_vars.

…ds (#621)

v=' 1 '; plain=($v) produced 2 elements (["","1"]) where GNU produces 1.
The field-split transport prefixes the word with a bookkeeping marker;
the indexed consumer left it in the accumulator, so a leading separator
pushed a marker-only first part decoding to a phantom "". GNU strips
leading IFS whitespace (subst.c:3142 list_string).

Two lines (both copies: executor split_indexed_tagged_token + declare
storage twin): consume the transport prefix up front. The post-split map
re-adds the prefix per part, so downstream bytes are unchanged for all
previously-correct shapes. Assoc path untouched (already correct).

Verification: new 30-case GNU differential 11/30 -> 30/30; the issue's
named test flips fail->pass in the full gate; new
tests/issue621_leading_split.rs (11 tests); focused suites green (the one
failure fails identically on baseline); full serial failure-set gate vs
master identical targets (NEW=0/DISAPPEARED=0; 1/3 coproc flake passing
in isolation); niubash A/B byte-identical (49=49).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant