Skip to content

fix(executor): non-CBSDQUOTE backslash inside dq alternate span is data (Refs #3117) - #3691

Merged
caomengxuan666 merged 1 commit into
masterfrom
fix/3117-dq-span-backslash
Nov 15, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
fix/3117-dq-span-backslash

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Summary

tests/issue3117_alternate_dq_span_backslash.rs was 11/24 after #3684: inside a double-quoted span of an unquoted alternate word, a backslash is special only before CBSDQUOTE ($\ backtick quote newline — syntax.h:58, subst.c:11671-11674); before any other character both bytes are literal data. The walk dropped the span boundary so the trailing unescape removed the backslash (${x:-"a\qb"} → aqb).

The protect_ifs && protect_data arm now carries non-CBSDQUOTE pairs via ASSIGN_EXPANSION_BACKSLASH (+IFS_GLUE before whitespace), same carrier family as the live escapes from #3116.

Legs

Generated with Devin

…ta (Refs #3117)

Inside a double-quoted span of an unquoted alternate word, a backslash
is special only before the CBSDQUOTE set ($ ` " \ newline —
syntax.h:58, subst.c:11671-11674 in expand_word_internal); before any
other character both bytes are literal data. The walk lost the span
boundary, so the trailing unquoted-unescape pass stripped the
backslash anyway (${x:-"a\qb"} -> aqb instead of a\qb).

The protect_ifs&&protect_data arm now consumes the next character on a
non-CBSDQUOTE pair and emits ASSIGN_EXPANSION_BACKSLASH (plus IFS_GLUE
ahead of whitespace), carrying the literal backslash through the later
pass like the live-escape carriers from #3116.

GNU: subst.c:11229 expand_word_internal backslash arm (11614-11678,
CBSDQUOTE-only special set in dq context), syntax.h:58.

tests/issue3117_alternate_dq_span_backslash.rs: 24/24 (was 11/24).

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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