weiqingy opened a new issue, #1044:
URL: https://github.com/apache/flink-agents/issues/1044
### Description
`tools/install.sh`'s `edit_plan_quote` wraps a value in single quotes and
escapes any embedded quote as `'\''`, so the result can be sourced back by
`edit_plan_dump_state`. It did that with an inline parameter expansion,
`${v//\'/\'\\\'\'}`.
That form is not treated alike across bash versions. On 3.2.57 it emits
`'it\'\\'\'s'` where the intended output is `'it'\''s'`. The result is not
valid shell, so sourcing the dumped state file fails with `unexpected EOF while
looking for matching '` and the value is lost.
This affects real users rather than only the test suite. `install.sh`
declares macOS support, it is fetched and piped to bash, and macOS resolves
`bash` to `/bin/bash` 3.2.57. So the plan-edit feature corrupts its own state
file on a stock mac.
`normalize_path` hit the same parameter-expansion difference and works
around it, with an implementation note recording why. `edit_plan_quote` did not
carry that lesson.
### How to reproduce
Run the installer's plan edit on macOS with a value containing a single
quote, for example a venv directory named `o'brien`. The dumped state file
fails to source and the edited value is silently dropped.
Directly:
```
$ /bin/bash -c 'v="it'"'"'s"; printf "'"'"'%s'"'"'"
"${v//\'"'"'/\'"'"'\\\'"'"'\'"'"'}"'
'it\'\\'\'s' # 3.2.57, not valid shell
'it'\''s' # 5.3.15, correct
```
### Version and environment
Reproduced against `8ad3a32b`. macOS, `/bin/bash` 3.2.57. Not reproducible
on 4.4+ or 5.x.
### Are you willing to submit a PR?
Yes. Fixed in the PR for #1035, which is where it was found: pinning the
interpreter the test suite runs test bodies under would otherwise have hidden
it, since the unfixed code is correct on a newer bash.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]