Fix a problem that run
always fails with IFS=_
#650
Merged
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.
Environment and steps to reproduce the issue
I believe this is unrelated to any changes in Bash.
Issues and fixes
I wanted to perform a test with a special value of
IFS
but noticed thatrun
always fails withIFS=_
. This is caused by unquoted$pre_command
in this line. The variablepre_command
contains a function name including_
, so the function name is split byIFS=_
by word splitting. To fix the issue, we can just quote the function name by" ... "
. See c8b5bba.I also noticed that
run
tries to recover the original value ofIFS
, but this fails to restore the original state ofIFS
whenIFS
is in the unset state before the test. It should be noted that the empty IFS and the unset IFS have different meanings: e.g. word splitting is disabled by the empty IFS while word splitting is performed with the unset IFS as if it has the default value$' \t\n'
. To fix the issue, we may just declareIFS
locally in the function. We may also save and restore the set/unset state ofIFS
as well as its value in the function. See d62e928.