Fix NarInfoDiskCache::queryCacheRaw on 32 bit platforms#15356
Merged
Ericson2314 merged 2 commits intomasterfrom Feb 26, 2026
Merged
Fix NarInfoDiskCache::queryCacheRaw on 32 bit platforms#15356Ericson2314 merged 2 commits intomasterfrom
Ericson2314 merged 2 commits intomasterfrom
Conversation
f6e6764 to
f36278b
Compare
Bug has existed for a long time, but was only recently surfaced by 6733f2e. time_t was being implicitly promoted to unsigned. Apparently time_t is still 32 bit for i686-linux in nixpkgs. Fixes https://hydra.nixos.org/build/322992746/nixlog/1
Ericson2314
approved these changes
Feb 26, 2026
Use proper nullptr literal for NULL pointer instead of the rather confusing 0 literal.
f36278b to
796f5cd
Compare
xokdvium
commented
Feb 26, 2026
| /* Important: always use int64_t even on 32 bit systems. Otherwise | ||
| the the subtraction would promote time_t to unsigned if time_t is | ||
| 32 bit. */ | ||
| auto timestamp = static_cast<int64_t>(time(nullptr)) - static_cast<int64_t>(settings.ttlMeta.get()); |
Contributor
Author
There was a problem hiding this comment.
I think being extra explicit here is nice. C/C++ integral promotion rules are too confusing to get right.
Ericson2314
approved these changes
Feb 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Bug has existed for a long time, but was only recently surfaced by 6733f2e.
time_twas being implicitly promoted to unsigned. Apparentlytime_tis still 32 bit fori686-linuxin nixpkgs.Context
Fixes https://hydra.nixos.org/build/322992746/nixlog/1
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.