Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep apk modtime #1305

Merged
merged 1 commit into from
Sep 16, 2024
Merged

Conversation

jonjohnsonjr
Copy link
Contributor

We were overwriting all the file timestamps with a configurable SOURCE_DATE_EPOCH, which was always the unix epoch. The only reason we were doing this is that we were also setting the modtime of everything to time.Now() elsewhere.

That's silly.

Instead, don't set anything to time.Now() and keep file modtimes when we add them to the filesystem. If the APKs change, nothing will be reproducible anyway, so keeping the data from the APK seems way better.

We were overwriting all the file timestamps with a configurable
SOURCE_DATE_EPOCH, which was always the unix epoch. The only reason we
were doing this is that we were also setting the modtime of everything
to time.Now() elsewhere.

That's silly.

Instead, don't set anything to time.Now() and keep file modtimes when we
add them to the filesystem. If the APKs change, nothing will be
reproducible anyway, so keeping the data from the APK seems way better.

Signed-off-by: Jon Johnson <[email protected]>
header.AccessTime = c.SourceDateEpoch
header.ModTime = c.SourceDateEpoch
header.ChangeTime = c.SourceDateEpoch
header.ModTime = info.ModTime()
Copy link
Member

Choose a reason for hiding this comment

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

Update the comment?

Copy link
Member

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

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

nit about a comment, but otherwise this LGTM.

@jonjohnsonjr jonjohnsonjr merged commit 7fd722a into chainguard-dev:main Sep 16, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants