Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8226538

find-files.gmk gets corrupted if tab completion is used before running make first



    • Bug
    • Resolution: Fixed
    • P3
    • 13
    • 13
    • infrastructure
    • None
    • b27



        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.


          Issue Links



                erikj Erik Joelsson
                erikj Erik Joelsson
                0 Vote for this issue
                1 Start watching this issue