On Thu, 4 Sep 2025 14:03:41 GMT, Magnus Ihse Bursie <[email protected]> wrote:

> 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.

make/common/MakeBase.gmk line 306:

> 304:   $(call MakeDir, $(dir $(strip $1)) 
> $(MAKESUPPORT_OUTPUTDIR)/failure-logs) \
> 305:   $(call WriteFile, $2, $(strip $1).cmdline) \
> 306:   ( $(RM) $(strip $1).log && $(if $(call is_redirect, $2),$(LEFT_PAREN) 
> )$(strip $2)$(if $(call is_redirect, $2), $(RIGHT_PAREN)) > >($(TEE) -a 
> $(strip $1).log) 2> >($(TEE) -a $(strip $1).log >&2) || \

Consider breaking these lines.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27096#discussion_r2322796527

Reply via email to