RFR: 8349933: Mixing of includes and snippets stack causes the wrong -post snippet to be included

Magnus Ihse Bursie ihse at openjdk.org
Thu Feb 20 16:41:52 UTC 2025


On Wed, 12 Feb 2025 20:37:26 GMT, Erik Joelsson <erikj at openjdk.org> wrote:

> The new framework for tracing makefile inclusion has a bug. In the Make[Include|Snippet]End.gmk files, the variables THIS_INCLUDE and THIS_SNIPPET respectively are restored from the HELPER_STACK variable. The problem is that we can't know if the next item on the stack is a previous "include" or "snippet". In a complex tree of includes/snippets, this can cause the wrong custom -post file to get included.
> 
> My proposed fix is to split HELPER_STACK into two variables, INCLUDE_STACK and SNIPPET_STACK, so we keep track of which files were includes and which ones were snippets. When printing indentations we just concatenate these variables to get the total stack size.
> 
> This patch fixes the observed issue for me locally. I'm running extensive testing on it.

LGTM. Thanks for fixing this! Somehow, sharing the HELPER_STACK irked me in the back of my mind, but I did not really listen enough to this warning signal to verify that it was indeed sane to do. (Which it turned out not to be...)

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

Marked as reviewed by ihse (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/23601#pullrequestreview-2630517792


More information about the build-dev mailing list