Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

lukebakken
Copy link
Collaborator

@lukebakken lukebakken commented Aug 27, 2025

Commit e435bc6 introduced behavior in creating the source-dist archive that sets the file modification time to the same time as the most recent git commit. This facilitates reproducible builds, but it also has an issue. The code sets TZ=, which means that on systems running in time zones which aren't UTC, the modification time may be in the future (or past). It depends on the system's behavior.

Up until recently, this only resulted in GNU make printing warnings about modification times being in the future. However, with recent changes in how escripts are built, this results in an "infinite make loop" that is described in #14440 and #14443

This solution is to set the TZ=UTC when calculating the time of the most recent git commit, as well as when using touch -t to set the file modification times.

Fixes #14440, #14443

@lukebakken lukebakken self-assigned this Aug 27, 2025
@lukebakken lukebakken requested a review from dumbbell August 27, 2025 20:50
@lukebakken lukebakken marked this pull request as ready for review August 27, 2025 20:50
@mergify mergify bot added the make label Aug 27, 2025
@lukebakken
Copy link
Collaborator Author

Here's a V=2 log of the following command, including this patch:

cd rabbitmq-server
make RABBITMQ_PACKAGING_REPO=../rabbitmq-packaging package-windows V=2 2>&1 | tee /tmp/make-package-windows.txt

make-package-windows.txt

@michaelklishin michaelklishin requested a review from lhoguin August 27, 2025 21:06
@michaelklishin
Copy link
Collaborator

michaelklishin commented Aug 27, 2025

@lukebakken thank you. JSP is out on PTO this week, perhaps @lhoguin can help with a review :)

@lukebakken
Copy link
Collaborator Author

Yeah I'm pretty sure @lhoguin is a good choice πŸ˜‰

@lukebakken lukebakken force-pushed the lukebakken/fix-package-build branch from 328470d to 6347323 Compare August 27, 2025 21:36
Copy link
Contributor

@lhoguin lhoguin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not 100% sure why TZ=. TZ= means that the system default timezone is used but that behavior varies between platforms.

It might be there to ensure that misconfigured systems can still build reproducibly.

If that's the case then TZ=UTC might be better. But if doing that the part of the Makefile using the git-times.txt file likely needs updating so that UTC is used when updating timestamps with touch at the end of the target (it also needs TZ=UTC).

If this doesn't work and waiting is a bother then I'm OK with merging this for now and seeing with JSP when he gets back.

@lukebakken
Copy link
Collaborator Author

lukebakken commented Aug 28, 2025

TZ= means that the system default timezone is used but that behavior varies between platforms

At least on Ubuntu 24, using git 2.43, the timestamps in the git-time*.txt files are in UTC which of course is in the future for me. Later on, make complains about file modification times being in the future, and the infinite loop is triggered.

If that's the case then TZ=UTC might be better. But if doing that the part of the Makefile using the git-times.txt file likely needs updating so that UTC is used when updating timestamps with touch at the end of the target (it also needs TZ=UTC).

I'll give that a try to see what happens!

@lukebakken lukebakken force-pushed the lukebakken/fix-package-build branch from 6347323 to 507a2ca Compare August 28, 2025 15:20
@lukebakken
Copy link
Collaborator Author

@lhoguin yep, that worked like a charm. I've updated the PR and associated commit log message.

@lukebakken lukebakken requested a review from lhoguin August 28, 2025 15:21
@michaelklishin
Copy link
Collaborator

@lukebakken may I ask you to rebase this PR? That should fix the OCI job but @Zerpet and I can only verify it with a PR from an "external contributor" :)

Commit e435bc6 introduced behavior in
creating the source-dist archive that sets the file modification time to
the same time as the most recent `git` commit. This facilitates
reproducible builds, but it also has an issue. The code sets `TZ=`,
which means that on systems running in time zones which aren't UTC, the
modification time may be in the future (or past). It depends on the
system's behavior.

Up until recently, this only resulted in GNU make printing warnings
about modification times being in the future. However, with recent
changes in how escripts are built, this results in an "infinite make
loop" that is described in rabbitmq#14440
and rabbitmq#14443

This solution is to set the `TZ=UTC` when calculating the time of the
most recent `git` commit, as well as when using `touch -t` to set the
file modification times.

Fixes rabbitmq#14440, rabbitmq#14443
@lukebakken lukebakken force-pushed the lukebakken/fix-package-build branch from 507a2ca to 993322f Compare August 28, 2025 20:37
@lukebakken
Copy link
Collaborator Author

@michaelklishin done!

@michaelklishin michaelklishin added this to the 4.2.0 milestone Aug 28, 2025
@michaelklishin michaelklishin merged commit bbe25c0 into rabbitmq:main Aug 28, 2025
280 of 281 checks passed
@michaelklishin
Copy link
Collaborator

@Mergifyio backport v4.1.x

Copy link

mergify bot commented Aug 28, 2025

backport v4.1.x

βœ… Backports have been created

@lhoguin
Copy link
Contributor

lhoguin commented Aug 29, 2025

Perfect, thank you!

@lukebakken lukebakken deleted the lukebakken/fix-package-build branch August 29, 2025 13:19
michaelklishin added a commit that referenced this pull request Sep 2, 2025
For 4.1.5: Ensure that file modified time is set correctly (backport #14444)
@dumbbell
Copy link
Collaborator

dumbbell commented Sep 3, 2025

The solution looks good to me. After reading git-log(1) again, I see that the datetime in git-times.txt could have indicated the timezone as well (i.e., have a Z suffix in our case). This way it would have been fine wherever it was consumed, without the need to set $TZ.

Anyway, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

make package-windows results in never-ending make loop
4 participants