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

Result of tilde expansion in nested parameter expansion #27

Open
magicant opened this issue Sep 12, 2023 · 0 comments
Open

Result of tilde expansion in nested parameter expansion #27

magicant opened this issue Sep 12, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@magicant
Copy link
Owner

(Issue migrated from https://osdn.net/projects/yash/ticket/40707)

Currently, the result of ~ and ${unset-~} are not subject to field splitting or pathname expansion, but that of ${${unset-~}} is. Can we prevent expansion for the latter, too?

test_oE 'result of tilde expansion in nested parameter expansion'
HOME='/path/with  $space$(:)`:`$((1))' IFS=' /'
echoraw ${${u-~}}
HOME='*'
echoraw ${${u-~}}
__IN__
/path/with  $space$(:)`:`$((1))
*
__OUT__

In the current implementation, the outer expansion receives the result of the inner expansion after it has performed quote removal.
To honor the character origin of the inner expansion, however, the outer expansion needs to receive the result without quote removal. This will affect the character count in the outer expansion; for example, should ${${unset-"~"}[1]} expand to a double-quote or tilde?

@magicant magicant added the bug Something isn't working label Sep 12, 2023
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

No branches or pull requests

1 participant