Repository navigation
fix(executor): expand the coproc name before validating it (Refs #3032) - #3709
Merged
Merged
Conversation
GNU execute_cmd.c:2502-2513 execute_coproc runs
expand_string_unsplit_to_string on the explicit name and validates the
EXPANSION, then binds the fd array and _PID var under the expanded text.
When the word expands to zero fields (unquoted unset/empty $nv) the
expansion is NULL and err_invalidid (error.c:459-462) renders `(null)`;
a quoted word still yields one field, so `coproc "$nv"` reports `':.
Rubash validated the parser's literal token, so `coproc $nv { ...; }`
reported `` `$nv': not a valid identifier `` and rejected valid
expanded names like MYCP. Use name_metadata.raw (the source spelling),
expand it, treat an unquoted zero-field expansion as NULL, validate the
expanded name, and register the coproc under it.
Pin: tests/issue3032_coproc_name_expansion.rs (6 shapes: unset/empty ->
(null), invalid expanded -> expanded value, valid expanded -> named
coproc with fd array + PID, literal invalid -> literal, quoted empty ->
`':).
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.
Summary
execute_coprocvalidated the parser's literal name token before expansion —coproc $nv { ...; }reported`$nv'and rejected valid expanded namesexecute_cmd.c:2502-2513execute_coprocrunsexpand_string_unsplit_to_stringon the explicit name, then validates the expansion; zero-field (unquoted unset/empty) expansion is NULL →err_invalidid(error.c:459-462) prints(null); quoted empty is one field →`'name_metadata.raw, treat unquoted zero-field expansion as NULL, validate the expansion, bind the fd array /_PIDunder the expanded nameTest plan
tests/issue3032_coproc_name_expansion.rs— 6/6 pins green(null),9bad→9bad,MYCP→ named coproc,''/"$nv"→`')Generated with Devin