mirror of
https://github.com/NixOS/nix.git
synced 2025-11-14 14:32:42 +01:00
Fix a segfault in the git fetcher
The git fetcher code used to dereference the (potentially empty) `ref`
input attribute. This was magically working, probably because the
compiler somehow outsmarted us, but is now blowing up with newer nixpkgs
versions.
Fix that by not trying to access this field while we don't know for sure
that it has been defined.
Fix #6554
(cherry picked from commit 027fd45230)
This commit is contained in:
parent
daa14b8910
commit
bc47593455
1 changed files with 3 additions and 2 deletions
|
|
@ -449,11 +449,10 @@ struct GitInputScheme : InputScheme
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const Attrs unlockedAttrs({
|
Attrs unlockedAttrs({
|
||||||
{"type", cacheType},
|
{"type", cacheType},
|
||||||
{"name", name},
|
{"name", name},
|
||||||
{"url", actualUrl},
|
{"url", actualUrl},
|
||||||
{"ref", *input.getRef()},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Path repoDir;
|
Path repoDir;
|
||||||
|
|
@ -466,6 +465,7 @@ struct GitInputScheme : InputScheme
|
||||||
head = "master";
|
head = "master";
|
||||||
}
|
}
|
||||||
input.attrs.insert_or_assign("ref", *head);
|
input.attrs.insert_or_assign("ref", *head);
|
||||||
|
unlockedAttrs.insert_or_assign("ref", *head);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!input.getRev())
|
if (!input.getRev())
|
||||||
|
|
@ -482,6 +482,7 @@ struct GitInputScheme : InputScheme
|
||||||
head = "master";
|
head = "master";
|
||||||
}
|
}
|
||||||
input.attrs.insert_or_assign("ref", *head);
|
input.attrs.insert_or_assign("ref", *head);
|
||||||
|
unlockedAttrs.insert_or_assign("ref", *head);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto res = getCache()->lookup(store, unlockedAttrs)) {
|
if (auto res = getCache()->lookup(store, unlockedAttrs)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue