mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00

I've had a lot of Puzzles nightly builds fail recently in the NestedVM stage, with a 'jar' command producing a message along these lines: java.util.zip.ZipException: attempt to write past end of STORED entry at java.base/java.util.zip.ZipOutputStream.write(ZipOutputStream.java:337) at jdk.jartool/sun.tools.jar.Main.copy(Main.java:1250) at jdk.jartool/sun.tools.jar.Main.copy(Main.java:1263) at jdk.jartool/sun.tools.jar.Main.addFile(Main.java:1211) at jdk.jartool/sun.tools.jar.Main.create(Main.java:879) at jdk.jartool/sun.tools.jar.Main.run(Main.java:319) at jdk.jartool/sun.tools.jar.Main.main(Main.java:1681) Suppressed: java.util.zip.ZipException: invalid entry size (expected 0 but got 786 bytes) at java.base/java.util.zip.ZipOutputStream.closeEntry(ZipOutputStream.java:288) at java.base/java.util.zip.ZipOutputStream.finish(ZipOutputStream.java:361) at java.base/java.util.zip.DeflaterOutputStream.close(DeflaterOutputStream.java:238) at java.base/java.util.zip.ZipOutputStream.close(ZipOutputStream.java:378) at jdk.jartool/sun.tools.jar.Main.create(Main.java:854) ... 2 more It's hard to work out exactly what this error dump means, and web-searching for the error message isn't much help because the same exception can occur in application code using java.util.zip, and most mentions on the web are about that, and not about what I want to know, which is why it might happen in the 'jar' program in particular. However, the clues visible in that message suggest that 'jar' had somehow got confused about the size of one of the files it was adding to the jar archive, in that it initially decided it was 0 bytes long and later found it was longer. That suggests a problem of excessive parallelism between the build steps, perhaps due to a missing dependency in the makefile, which might plausibly cause the 'jar' step to be running already while some file it needs to read is still being written. (Which would also explain why it doesn't happen every time.) An eyeball review of cmake/platforms/nestedvm.cmake didn't find any obvious missing dependencies. But I vaguely remembered that in some other context I'd had trouble with cmake 'add_custom_command'. So in this commit I replace all those custom commands with custom _targets_, listing the previous OUTPUT files as BYPRODUCTS. And then the dependencies are written using the target names, instead of the file names. I don't fully understand why this should make a difference. But it seems more reliable in a soak test, and still builds the right things, so I'll commit it and see if it makes the flakiness in the actual nightly builds stop happening.
This is the README accompanying the source code to Simon Tatham's puzzle collection. The collection's web site is at <https://www.chiark.greenend.org.uk/~sgtatham/puzzles/>. The puzzle collection is built using CMake <https://cmake.org/>. To compile in the simplest way (on any of Linux, Windows or Mac), run these commands in the source directory: cmake . cmake --build . The manual is provided in Windows Help format for the Windows build; in text format for anyone who needs it; and in HTML for the Mac OS X application and for the web site. It is generated from a Halibut source file (puzzles.but), which is the preferred form for modification. To generate the manual in other formats, rebuild it, or learn about Halibut, visit the Halibut website at <https://www.chiark.greenend.org.uk/~sgtatham/halibut/>.
Description
Languages
C
93.3%
JavaScript
1.4%
Objective-C
1.1%
CMake
1.1%
HTML
0.8%
Other
2.2%