* nix-store --verify: don't bail out if a referenced path is missing.
(It can't fix it though.)
This commit is contained in:
parent
4e646b0ddb
commit
8f1bf28505
1 changed files with 13 additions and 14 deletions
|
@ -1004,7 +1004,7 @@ void LocalStore::verifyStore(bool checkContents)
|
||||||
|
|
||||||
PathSet validPaths2 = queryValidPaths(), validPaths;
|
PathSet validPaths2 = queryValidPaths(), validPaths;
|
||||||
|
|
||||||
for (PathSet::iterator i = validPaths2.begin(); i != validPaths2.end(); ++i) {
|
foreach (PathSet::iterator, i, validPaths2) {
|
||||||
checkInterrupt();
|
checkInterrupt();
|
||||||
if (!isStorePath(*i)) {
|
if (!isStorePath(*i)) {
|
||||||
printMsg(lvlError, format("path `%1%' is not in the Nix store") % *i);
|
printMsg(lvlError, format("path `%1%' is not in the Nix store") % *i);
|
||||||
|
@ -1022,26 +1022,25 @@ void LocalStore::verifyStore(bool checkContents)
|
||||||
|
|
||||||
std::map<Path, PathSet> referrersCache;
|
std::map<Path, PathSet> referrersCache;
|
||||||
|
|
||||||
for (PathSet::iterator i = validPaths.begin(); i != validPaths.end(); ++i) {
|
foreach (PathSet::iterator, i, validPaths) {
|
||||||
bool update = false;
|
bool update = false;
|
||||||
ValidPathInfo info = queryPathInfo(*i, true);
|
ValidPathInfo info = queryPathInfo(*i, true);
|
||||||
|
|
||||||
/* Check the references: each reference should be valid, and
|
/* Check the references: each reference should be valid, and
|
||||||
it should have a matching referrer. */
|
it should have a matching referrer. */
|
||||||
for (PathSet::iterator j = info.references.begin();
|
foreach (PathSet::iterator, j, info.references) {
|
||||||
j != info.references.end(); ++j)
|
|
||||||
{
|
|
||||||
if (referrersCache.find(*j) == referrersCache.end())
|
|
||||||
queryReferrers(*j, referrersCache[*j]);
|
|
||||||
if (referrersCache[*j].find(*i) == referrersCache[*j].end()) {
|
|
||||||
printMsg(lvlError, format("adding missing referrer mapping from `%1%' to `%2%'")
|
|
||||||
% *j % *i);
|
|
||||||
appendReferrer(*j, *i, true);
|
|
||||||
}
|
|
||||||
if (validPaths.find(*j) == validPaths.end()) {
|
if (validPaths.find(*j) == validPaths.end()) {
|
||||||
printMsg(lvlError, format("incomplete closure: `%1%' needs missing `%2%'")
|
printMsg(lvlError, format("incomplete closure: `%1%' needs missing `%2%'")
|
||||||
% *i % *j);
|
% *i % *j);
|
||||||
/* nothing we can do about it... */
|
/* nothing we can do about it... */
|
||||||
|
} else {
|
||||||
|
if (referrersCache.find(*j) == referrersCache.end())
|
||||||
|
queryReferrers(*j, referrersCache[*j]);
|
||||||
|
if (referrersCache[*j].find(*i) == referrersCache[*j].end()) {
|
||||||
|
printMsg(lvlError, format("adding missing referrer mapping from `%1%' to `%2%'")
|
||||||
|
% *j % *i);
|
||||||
|
appendReferrer(*j, *i, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1079,7 +1078,7 @@ void LocalStore::verifyStore(bool checkContents)
|
||||||
std::map<Path, PathSet> referencesCache;
|
std::map<Path, PathSet> referencesCache;
|
||||||
|
|
||||||
Strings entries = readDirectory(nixDBPath + "/referrer");
|
Strings entries = readDirectory(nixDBPath + "/referrer");
|
||||||
for (Strings::iterator i = entries.begin(); i != entries.end(); ++i) {
|
foreach (Strings::iterator, i, entries) {
|
||||||
Path from = nixStore + "/" + *i;
|
Path from = nixStore + "/" + *i;
|
||||||
|
|
||||||
if (validPaths.find(from) == validPaths.end()) {
|
if (validPaths.find(from) == validPaths.end()) {
|
||||||
|
@ -1103,7 +1102,7 @@ void LocalStore::verifyStore(bool checkContents)
|
||||||
|
|
||||||
/* Each referrer should have a matching reference. */
|
/* Each referrer should have a matching reference. */
|
||||||
PathSet referrersNew;
|
PathSet referrersNew;
|
||||||
for (PathSet::iterator j = referrers.begin(); j != referrers.end(); ++j) {
|
foreach (PathSet::iterator, j, referrers) {
|
||||||
if (referencesCache.find(*j) == referencesCache.end())
|
if (referencesCache.find(*j) == referencesCache.end())
|
||||||
queryReferences(*j, referencesCache[*j]);
|
queryReferences(*j, referencesCache[*j]);
|
||||||
if (referencesCache[*j].find(from) == referencesCache[*j].end()) {
|
if (referencesCache[*j].find(from) == referencesCache[*j].end()) {
|
||||||
|
|
Loading…
Reference in a new issue