Build succeeds even if JDK source file fails to compile
Kelly O'Hair
kelly.ohair at oracle.com
Fri Dec 16 20:56:42 UTC 2011
Change looks good.
-kto
On Dec 16, 2011, at 11:58 AM, Stuart Marks wrote:
> Here's a fix I'm working on. I'm still doing test builds but I wanted to get this in front of people pretty quickly.
>
> The initial diagnosis was correct; adding an "echo" (or some other command) after the javac will prevent javac's failure code from reaching make and thus not stopping the build if there is an error.
>
> The fix is to use && instead of ; to separate the commands, i.e.
>
> javac && echo "# javac finished"
>
> If javac fails this will abort the commands chained with && and report the failure code back to make.
>
> Diff below.
>
> s'marks
>
>
>
> diff -r c647ebb3c4f7 make/common/Rules.gmk
> --- a/make/common/Rules.gmk Tue Dec 13 15:41:47 2011 -0800
> +++ b/make/common/Rules.gmk Fri Dec 16 11:52:48 2011 -0800
> @@ -239,7 +239,7 @@
> $(CAT) $<.filtered; \
> $(ECHO) "# Running javac: $$numfiles files; in $(CURDIR)"; \
> $(ECHO) $(JAVAC_CMD) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$<.filtered; \
> - $(JAVAC_CMD) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$<.filtered; \
> + $(JAVAC_CMD) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$<.filtered && \
> $(ECHO) "# javac finished"; \
> fi
> @$(java-vm-cleanup)
>
>
> On 12/16/11 10:12 AM, Mandy Chung wrote:
>> On 12/16/2011 9:26 AM, Kelly O'Hair wrote:
>>> You are correct. This changeset was wrong.
>>>
>>
>> Chris - good find.
>>
>>> Mandy was asking me about this a while back
>>
>> That was Wednesday - not long ago. jigsaw build has a similar issue:
>> http://hg.openjdk.java.net/jigsaw/jigsaw/jdk/diff/459b6cbb0de7/make/common/Rules.gmk
>>
>>
>> that I have fixed. I didn't get the chance to check on jdk8/tl yet.
>>
>> Mandy
>>
>>> and I was also noticing the problem with a recent
>>> problem Maurizio was having doing boot cycle builds on Linux, where javac
>>> failed, make did not stop,
>>> and merrily crashed later in javah. :^(
>>>
>>> -kto
>>>
>>> On Dec 16, 2011, at 6:13 AM, Chris Hegarty wrote:
>>>
>>>> I filed CR 7122235 for this issue.
>>>>
>>>> Forcing a compile time error of a JDK class by inserting some bad code is
>>>> just ignored and the build continues, and appears to complete successfully.
>>>>
>>>> I believe the changes for CR 7116322 "enhance javac make rule with a little
>>>> bit of instrumentation", caused this problem.
>>>>
>>>> Changeset for 7116322:
>>>> http://hg.openjdk.java.net/jdk8/tl/jdk/rev/43a630f11af6
>>>>
>>>> After the javac cmd is run there is a simple echo to indicate 'javac
>>>> finished'. I am not a makefile expert, but I think the makefiles are
>>>> checking the return code for this directive/rule and now will always see the
>>>> successful return code of the echo, so it will never fail.
>>>>
>>>> Example:
>>>>
>>>> # Running javac: 18 files; in
>>>> /export2/Users/chris/repos/jdk8/tl/buildFail/make/com/sun/net/ssl
>>>> /java/re/jdk/1.8.0/promoted/latest/binaries/solaris-i586/bin/javac
>>>> -J-XX:ThreadStackSize=768 -J-XX:-PrintVMOptions
>>>> -J-XX:+UnlockDiagnosticVMOptions -J-XX:-LogVMOutput -J-client -J-Xmx512m
>>>> -J-Xms512m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m -g -Werror
>>>> -Xlint:all,-deprecation -Xlint:all -Xlint:-path -source 7 -target 7
>>>> -encoding ascii -Xbootclasspath:../../../../../build/solaris-i586/classes
>>>> -sourcepath
>>>> ../../../../../src/closed/solaris/classes:../../../../../src/closed/share/classes:../../../../../build/solaris-i586/gensrc:../../../../../src/solaris/classes:../../../../../src/share/classes
>>>> -d ../../../../../build/solaris-i586/classes
>>>> @../../../../../build/solaris-i586/tmp/sun/com.sun.net.ssl/.classes.list.filtered
>>>>
>>>> ../../../../../src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java:438:
>>>> error: missing return statement
>>>> }
>>>> ^
>>>> Note: Some input files use or override a deprecated API.
>>>> Note: Recompile with -Xlint:deprecation for details.
>>>> 1 error
>>>> # javac finished
>>>> make381[3]: Leaving directory
>>>> `/export2/Users/chris/repos/jdk8/tl/buildFail/make/com/sun/net/ssl'
>>>> make381[3]: Entering directory
>>>> `/export2/Users/chris/repos/jdk8/tl/buildFail/make/com/sun/jarsigner'
>>>> make381[3]: Leaving directory
>>>> `/export2/Users/chris/repos/jdk8/tl/buildFail/make/com/sun/jarsigner'
>>>> make381[3]: Entering directory
>>>> `/export2/Users/chris/repos/jdk8/tl/buildFail/make/com/sun/image'
>>>>
>>>> -Chris.
More information about the build-dev
mailing list