> When calling ExecuteWithLog with a redirection (using > or, possibly, <), the > entire command needs to be executed in a subshell, that is, inside a pair of > parentheses. This is the callers obligation to ensure, but we have proven > multiple times that this is hard to keep in mind, and we got several cases of > race conditions due to missing this. > > This PR changes the implementation of ExecuteWithLog so it checks if the > command line contains redirection, and automatically add the subshell > parentheses in that case. The alternative would have been to always execute > in a subshell, but that would have been very expensive on Windows.
Magnus Ihse Bursie has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision: - Merge branch 'master' into safe-execute-with-redirect - 8233115: Protect ExecuteWithLog from running with redirection without a subshell ------------- Changes: - all: https://git.openjdk.org/jdk/pull/27096/files - new: https://git.openjdk.org/jdk/pull/27096/files/836558ab..c5111837 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=27096&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27096&range=00-01 Stats: 4126 lines in 245 files changed: 2630 ins; 395 del; 1101 mod Patch: https://git.openjdk.org/jdk/pull/27096.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27096/head:pull/27096 PR: https://git.openjdk.org/jdk/pull/27096