Hi,

I continue experimenting with building mainline on Nix and I've made some
progress. Capstone, Ant and others are in, but I had to work around an
issue when trying to run JMH benchmarks [1].

Seems like when `test` make target is run, `jrt-fs` jar file is created
passing in `--date ...`. In Nix, I was getting this error:

```
/nix/store/5y040sypyg0amh0igxs9rnx5fmj0d88i-temurin-bin-23.0.2/bin/jar
--create --date 1980-01-01T00:00:00Z --file
/Users/galder/1/jdk-avoid-cmov-long-min-max/build/release-darwin-arm64/support/modules_libs/java.base/jrt-fs.jar
--manifest
/Users/galder/1/jdk-avoid-cmov-long-min-max/build/release-darwin-arm64/support/modules_libs/java.base/_the.jrt-fs.jar_manifest

...
date 1980-01-01T00:00:00Z is not within the valid range
1980-01-01T00:00:02Z to 2099-12-31T23:59:59Z
```

@Andrew Leonard <anleo...@redhat.com> found the root of this validation in
[2]. It seems unlikely this is going to change.

The cause is that on Nix shell envs `$SOURCE_DATE_EPOCH` is set to 315532800
which is 1980-01-01T00:00:00Z. This can be easily worked around by
unsetting SOURCE_DATE_EPOCH and that works fine for my use case.

However, @Thomas Fitzsimmons <fitz...@redhat.com> had a very good point to
make:

> I also wonder why the test harness is passing --date $SOURCE_DATE_EPOCH,
since the test jars are not distributed, not sure why they'd need to be
reproducible...

I think his question is valid. Why pass --date for a test jar?

Thanks
Galder

[1] https://github.com/NixOS/nixpkgs/issues/387516#issuecomment-2760642591
[2] https://github.com/openjdk/jdk/pull/6481#issuecomment-982399628

Reply via email to