You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "weiqingy (via GitHub)" <gi...@apache.org> on 2026/08/24 02:50:15 UTC

[I] [Bug] edit_plan_quote produces invalid shell on bash 3.2, corrupting the plan state file [flink-agents]

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: issues-unsubscribe@flink.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] edit_plan_quote produces invalid shell on bash 3.2, corrupting the plan state file [flink-agents]

Posted by "wenjin272 (via GitHub)" <gi...@apache.org>.
wenjin272 closed issue #1044: [Bug] edit_plan_quote produces invalid shell on bash 3.2, corrupting the plan state file
URL: https://github.com/apache/flink-agents/issues/1044


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org