Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shell: Nested command substitution syntax error in POSIX mode #19110

Closed
oskar-skog opened this issue May 28, 2023 · 1 comment · Fixed by #20279
Closed

Shell: Nested command substitution syntax error in POSIX mode #19110

oskar-skog opened this issue May 28, 2023 · 1 comment · Fixed by #20279
Labels
bug Something isn't working

Comments

@oskar-skog
Copy link
Contributor

oskar-skog commented May 28, 2023

Nested command substitution works as expected in the interactive shell.
But in /bin/sh scripts or with Shell --posix, it results in a syntax error.

Example:
echo $(echo $(echo)) results in "Shell Syntax Error: Extra tokens after complete command"

@alimpfard alimpfard added the bug Something isn't working label May 30, 2023
@sec05
Copy link
Contributor

sec05 commented Jun 16, 2023

I've been trying to take a crack at this mainly looking at the code in PosixParser.cpp and focusing under parse_complete_command(), but am not having much luck. Is this the right place to look? The errors get generated here I believe.

alimpfard added a commit to alimpfard/serenity that referenced this issue Jul 31, 2023
Previously any expansion closing sequence would've caused the entire
expansion chain to be terminated, fix this by keeping track of active
expansions and running the parser in 'skip' mode.

Fixes SerenityOS#19110.
alimpfard added a commit that referenced this issue Aug 4, 2023
Previously any expansion closing sequence would've caused the entire
expansion chain to be terminated, fix this by keeping track of active
expansions and running the parser in 'skip' mode.

Fixes #19110.
auipc pushed a commit to auipc/serenity that referenced this issue Aug 12, 2023
Previously any expansion closing sequence would've caused the entire
expansion chain to be terminated, fix this by keeping track of active
expansions and running the parser in 'skip' mode.

Fixes SerenityOS#19110.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants