Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nix
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d0a769cb061a
Choose a base ref
...
head repository: NixOS/nix
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 29ccb2e9697e
Choose a head ref
  • 1 commit
  • 3 files changed
  • 1 contributor

Commits on Jun 21, 2019

  1. Fix 32-bit overflow with --no-net

    --no-net causes tarballTtl to be set to the largest 32-bit integer,
    which causes comparison like 'time + tarballTtl < other_time' to
    fail on 32-bit systems. So cast them to 64-bit first.
    
    https://hydra.nixos.org/build/95076624
    edolstra committed Jun 21, 2019
    Copy the full SHA
    29ccb2e View commit details
Showing with 7 additions and 10 deletions.
  1. +1 −1 src/libexpr/primops/fetchGit.cc
  2. +5 −8 src/libexpr/primops/fetchMercurial.cc
  3. +1 −1 src/libstore/download.cc
2 changes: 1 addition & 1 deletion src/libexpr/primops/fetchGit.cc
Original file line number Diff line number Diff line change
@@ -135,7 +135,7 @@ GitInfo exportGit(ref<Store> store, std::string uri,
git fetch to update the local ref to the remote ref. */
struct stat st;
doFetch = stat(localRefFile.c_str(), &st) != 0 ||
st.st_mtime + settings.tarballTtl <= now;
(uint64_t) st.st_mtime + settings.tarballTtl <= (uint64_t) now;
}

if (doFetch) {
13 changes: 5 additions & 8 deletions src/libexpr/primops/fetchMercurial.cc
Original file line number Diff line number Diff line change
@@ -77,7 +77,7 @@ HgInfo exportMercurial(ref<Store> store, const std::string & uri,
time_t now = time(0);
struct stat st;
if (stat(stampFile.c_str(), &st) != 0 ||
st.st_mtime + settings.tarballTtl <= now)
(uint64_t) st.st_mtime + settings.tarballTtl <= (uint64_t) now)
{
/* Except that if this is a commit hash that we already have,
we don't have to pull again. */
@@ -93,17 +93,14 @@ HgInfo exportMercurial(ref<Store> store, const std::string & uri,
try {
runProgram("hg", true, { "pull", "-R", cacheDir, "--", uri });
}
catch (ExecError & e){
catch (ExecError & e) {
string transJournal = cacheDir + "/.hg/store/journal";
/* hg throws "abandoned transaction" error only if this file exists */
if (pathExists(transJournal))
{
if (pathExists(transJournal)) {
runProgram("hg", true, { "recover", "-R", cacheDir });
runProgram("hg", true, { "pull", "-R", cacheDir, "--", uri });
}
else
{
throw ExecError(e.status, fmt("program hg '%1%' ", statusToString(e.status)));
} else {
throw ExecError(e.status, fmt("'hg pull' %s", statusToString(e.status)));
}
}
} else {
2 changes: 1 addition & 1 deletion src/libstore/download.cc
Original file line number Diff line number Diff line change
@@ -822,7 +822,7 @@ CachedDownloadResult Downloader::downloadCached(
auto ss = tokenizeString<vector<string>>(readFile(dataFile), "\n");
if (ss.size() >= 3 && ss[0] == url) {
time_t lastChecked;
if (string2Int(ss[2], lastChecked) && lastChecked + request.ttl >= time(0)) {
if (string2Int(ss[2], lastChecked) && (uint64_t) lastChecked + request.ttl >= (uint64_t) time(0)) {
skip = true;
result.effectiveUri = request.uri;
result.etag = ss[1];