← Back to team overview

openjdk team mailing list archive

Bug#944738: Bug#944738: jlink: Hash of module differs to expected hash recorded in java.base

 

On Mon, Sep 21, 2020 at 10:49:24PM -0700, tony mancill wrote:
> > * Run the sha256sum command (protected with a '-' in case it fails!)
> >   at several points in the build-arch and install targets to see when
> >   the hashes change, if at all.
> 
> Good idea.  I am doing that now, and also building without parallelism,
> since I'd like to see the build logs for a single jmod being built
> without those being interspersed with others.  Specifically, I'd like to
> see the order in which the jmods are built and the hashes recorded.
> Somewhere along the line, we must be invoking jmod hash / --hash-modules
> on a jmod before strip-nondeterminism was invoked. 
> [...]
> Thank you for the ideas.  I will keep working on it.

Aargh, I've found what I did that was different from what I *said* I
did: I left in the dh_strip_nondeterminism -Xjmods option.  Leaving
that option out breaks it: it turns out that dh_strip_nondeterminism
sets a different timestamp from strip-nondeterminism.

dh_strip_nondeterminism gets its timestamp from the debian/changelog
file, while strip-nondeterminism strips the timestamps.

So here's a replacement patch which fixes everything except
java.naming.jmod.  I have to run now, but will try to figure out
tomorrow why that one still breaks.

Best wishes,

   Julian
--- a/make/CreateJmods.gmk
+++ b/make/CreateJmods.gmk
@@ -218,6 +218,9 @@
 
 # Create jmods in the support dir and then move them into place to keep the
 # module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
+# strip-nondeterminism requires the same timestamp as
+# dh_strip_nondeterminism uses, so we determine this first.
+DSN_TIMESTAMP := $(shell perl -MDebian::Debhelper::Dh_Lib -e 'print get_source_date_epoch()')
 $(eval $(call SetupExecute, create_$(JMOD_FILE), \
     WARN := Creating $(INTERIM_MSG)$(JMOD_FILE), \
     DEPS := $(DEPS), \
@@ -228,7 +231,7 @@
         --target-platform '$(OPENJDK_MODULE_TARGET_PLATFORM)' \
         --module-path $(JMODS_DIR) $(JMOD_FLAGS) \
         $(JMODS_SUPPORT_DIR)/$(JMOD_FILE), \
-    POST_COMMAND := $(MV) $(JMODS_SUPPORT_DIR)/$(JMOD_FILE) $(JMODS_DIR)/$(JMOD_FILE), \
+    POST_COMMAND := strip-nondeterminism --timestamp $(DSN_TIMESTAMP) $(JMODS_SUPPORT_DIR)/$(JMOD_FILE) && $(MV) $(JMODS_SUPPORT_DIR)/$(JMOD_FILE) $(JMODS_DIR)/$(JMOD_FILE), \
 ))
 
 TARGETS += $(create_$(JMOD_FILE))

Follow ups

References