On Wed, 7 May 2025 21:17:47 GMT, Erik Joelsson <er...@openjdk.org> wrote:

>> If you check out your source code in Cygwin, somewhere under /home/... (as 
>> opposed to /cygpath/...), IncludeCustomExtension does not work.
>> 
>> The problem is that TOPDIR gets a different lexical value from the spec.gmk 
>> file when setup in Makefile, even if this was the same directory. Since 
>> THIS_INCLUDE is calculated as a relative path by string substitution of 
>> $(TOPDIR), the path failed to relativize correctly.
>
> make/PreInitSupport.gmk line 256:
> 
>> 254:   # We need to include the given SPEC file to setup TOPDIR properly
>> 255:   SPEC_FILE := $(strip $2)
>> 256:   -include $$(SPEC_FILE)
> 
> Is it safe to include SPEC here? I thought the point of PreInit.gmk was that 
> it didn't load it.

Yeah, it is a bit scary. I don't really like it either. I tested this and it 
seemed okay, but we are not sure we are including the proper spec at this 
point, since we can pick an arbitrary spec file for e.g. tab expansion. I can't 
really say what could go wrong, but it is more of the lines "this is not 
obviously wrong" rather than "this is obviously right".

I also toyed with the idea of extracting the TOPDIR line from the spec file, 
but that would mean accessing grep (and possibly some other tool like sed, awk 
or cut) before we have properly checked for that, and we have not done anything 
like that so early up until now, so that was not attractive either.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25100#discussion_r2078535348

Reply via email to