RFR: JDK-8226538: find-files.gmk gets corrupted if tab completion is used before running make first
Erik Joelsson
erik.joelsson at oracle.com
Thu Jun 20 21:13:40 UTC 2019
In a new build configuration, if the user hits tab to complete a make
target before running any other make target, the generated file
find-tests.gmk gets corrupted, causing tons of strange make debug output
to be printed in the console on each subsequent make invocation.
This is caused by the tab completion script which invokes make with the
-p flag (to print the make database), which FindTests.gmk inadvertently
propagates into the call to TestMake.gmk where it extracts the test-make
sub targets into find-test.gmk. This causes make to dump its database
into find-test.gmk, which includes the definition of MAKEFLAGS with the
value for -p set. After this, all calls to make will include
find-tests.gmk, which will set MAKEFLAGS to a value including -p,
causing make to spit out the database again and again.
The main problem here is that we rely on capturing stdout from calling a
sub make target. This is a bad practice since there are plenty of ways
the user may change what make prints. We have had trouble with this in
the past and were already trying to protect ourselves from similar
problems. I could not find an easy way to add protection against this
particular flag, so instead, I'm changing TestMake.gmk to accept an
input parameter for a target file to which the list of targets is
printed to instead of stdout. This solves the fundamental design problem.
Bug: https://bugs.openjdk.java.net/browse/JDK-8226538
Webrev: http://cr.openjdk.java.net/~erikj/8226538/webrev.01/
/Erik
More information about the build-dev
mailing list