Skip to content

read -a: backslash-escaped delimiters are kept literal in array elements (GNU strips the escape and joins) #397

Closed

Description

@caomengxuan666

Summary

read -a (and combined -ea/-sa forms) does not apply backslash-escape processing when splitting the line into array elements: the backslash is kept literally. GNU strips the escape and joins the escaped delimiter into the element.

Reproducer (probe wt37-374 K044/K046-K050)

read -a arr <<< 'a\ b c'; echo ${#arr[@]} ${arr[@]}

WSL GNU Bash 5.3.0:

2 a b c

rubash CLI (target/debug/rubash.exe, same script file):

2 a\ b c

Same divergence with a custom IFS (IFS=, read -a arr <<< 'a\,b,c' -> GNU 2 a,b c, rubash 2 a\,b c) and for read -eaarr, read -ea arr, read -saarr, read -sa arr (7 executor_tests cases).

GNU owner

builtins/read.def (read_builtin, array splitting honors backslash escapes like the scalar path).

Artifacts

target/issue-suites/results/wt37-374/run/K044.* through K050.* (.gnu/.rub pairs, byte-compared)

Activity

  1. added
    bug
    on Oct 2, 2026
  2. added 3 commits that reference this issue on Oct 2, 2026
  3. caomengxuan666 commented on Oct 3, 2026

    @caomengxuan666
    MemberAuthor

    Landed on master through the wt38 pool recovery waves (CI green on the batch head); see the issueNNN regression suite and the lane matrices on the ticket trail. Carrier-domain #399 landed with the full true-baseline A/B held byte-identical.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions