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

expand: fix parameters with leading/trailing spaces #890

Merged
merged 1 commit into from
Jun 29, 2022

Conversation

mvdan
Copy link
Owner

@mvdan mvdan commented Jun 28, 2022

(see commit message)

Fixes #886.

That is:

	$ a=" b c "
	$ echo foo${a}bar
	foo b c bar

rather than our previous incorrect answer:

	$ a=" b c "
	$ echo foo${a}bar
	foob cbar

Our error was relying on strings.FieldsFunc, which performs exactly as
documented, but is not enough for us - we need to know whether the
expanded string has leading or trailing IFS characters.

Fixes #886.
@mvdan
Copy link
Owner Author

mvdan commented Jun 28, 2022

cc @dkegel-fastly

@dkegel-fastly
Copy link

works in my little test, thanks.

@mvdan mvdan merged commit 3d2e729 into master Jun 29, 2022
@mvdan mvdan deleted the 886-expand-param-spaces branch July 3, 2022 15:04
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.

expand: parameter expansions with spaces in the middle of words are mishandled
3 participants