Repository navigation
fix(executor): ${#@x} admits only valid @xform suffix (Refs #2711) - #3687
Merged
Merged
Conversation
GNU subst.c:8898-8922 valid_parameter_transform: the `@` operator in
${#@x} admits exactly one transform char from {a,A,K,k,E,P,Q,U,u,L};
subst.c:9931-9941 then requires the `#`-led name to consume the whole
body up to `}`, so `${#@: 2: 1}`, `${#@%b}` and `${#@:-2}`
are bad substitution while `${#@q}` is `$#` under the Q transform.
The length-remainder validator admitted `@` + anything; it now
requires exactly one valid transform char. `${#@}`/`${#*}`,
`${#arr[@]}`, `${#v}` controls unchanged.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This was referenced Nov 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
echo "<${#@: 2: 1}>",<${#@%b}>,<${#@:-2}>expanded to empty output where GNU reportsbad substitution(rc 1).${#*: 1}was already rejected.Root cause
For
${#<name>}where<name>is not a valid length operand, GNU treats#as the$#parameter and requires the remainder to be a parameter operator (parameter_brace_expand, subst.c:9931-9941: the#-led name must consume the whole body up to}). The@in that position is the transform operator, andvalid_parameter_transform(subst.c:8898-8922) admits EXACTLY one char from {a,A,K,k,E,P,Q,U,u,L} —${#@Q}is valid ('2'underset -- ab cd, WSL bash 5.3.20 probe),${#@:}/${#@%b}/${#@:-2}are not.Rubash's
is_length_operator_expressionadmitted@followed by ANY text, so those shapes passed the expansion-error pre-scan and silently produced nothing.Fix
is_length_operator_expressionnow requires the@remainder to be exactly one valid transform char. Controls${#@},${#*},${#arr[@]},${#v}unchanged (they never reached this arm).Test legs
cargo test --test issue2711_hash_at_operator_suffix: 8/8 green (was 5/8 on master; the 3 RED cells were${#@: 2: 1},${#@%b},${#@:-2})bad substitutionrc 1;${#@Q}→'2'rustfmt --edition 2021as sanctioned fallbackGenerated with Devin