diff options
author | Jörg Thalheim <joerg@thalheim.io> | 2017-07-30T11·27+0100 |
---|---|---|
committer | Jörg Thalheim <joerg@thalheim.io> | 2017-07-30T11·32+0100 |
commit | 2fd8f8bb99a2832b3684878c020ba47322e79332 (patch) | |
tree | 65a667fbc746f4ff8efcaca3c0a58565985f26a5 /src/libstore/gc.cc | |
parent | c7654bc491d9ce7c1fbadecd7769418fa79a2060 (diff) |
Replace Unicode quotes in user-facing strings by ASCII
Relevant RFC: NixOS/rfcs#4 $ ag -l | xargs sed -i -e "/\"/s/’/'/g;/\"/s/‘/'/g"
Diffstat (limited to 'src/libstore/gc.cc')
-rw-r--r-- | src/libstore/gc.cc | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc index 0cf9f87cac32..bd335fbb49e3 100644 --- a/src/libstore/gc.cc +++ b/src/libstore/gc.cc @@ -32,11 +32,11 @@ int LocalStore::openGCLock(LockType lockType) Path fnGCLock = (format("%1%/%2%") % stateDir % gcLockName).str(); - debug(format("acquiring global GC lock ‘%1%’") % fnGCLock); + debug(format("acquiring global GC lock '%1%'") % fnGCLock); AutoCloseFD fdGCLock = open(fnGCLock.c_str(), O_RDWR | O_CREAT | O_CLOEXEC, 0600); if (!fdGCLock) - throw SysError(format("opening global GC lock ‘%1%’") % fnGCLock); + throw SysError(format("opening global GC lock '%1%'") % fnGCLock); if (!lockFile(fdGCLock.get(), lockType, false)) { printError(format("waiting for the big garbage collector lock...")); @@ -63,7 +63,7 @@ static void makeSymlink(const Path & link, const Path & target) /* Atomically replace the old one. */ if (rename(tempLink.c_str(), link.c_str()) == -1) - throw SysError(format("cannot rename ‘%1%’ to ‘%2%’") + throw SysError(format("cannot rename '%1%' to '%2%'") % tempLink % link); } @@ -99,7 +99,7 @@ Path LocalFSStore::addPermRoot(const Path & _storePath, /* Don't clobber the link if it already exists and doesn't point to the Nix store. */ if (pathExists(gcRoot) && (!isLink(gcRoot) || !isInStore(readLink(gcRoot)))) - throw Error(format("cannot create symlink ‘%1%’; already exists") % gcRoot); + throw Error(format("cannot create symlink '%1%'; already exists") % gcRoot); makeSymlink(gcRoot, storePath); addIndirectRoot(gcRoot); } @@ -110,8 +110,8 @@ Path LocalFSStore::addPermRoot(const Path & _storePath, if (string(gcRoot, 0, rootsDir.size() + 1) != rootsDir + "/") throw Error(format( - "path ‘%1%’ is not a valid garbage collector root; " - "it's not in the directory ‘%2%’") + "path '%1%' is not a valid garbage collector root; " + "it's not in the directory '%2%'") % gcRoot % rootsDir); } @@ -131,8 +131,8 @@ Path LocalFSStore::addPermRoot(const Path & _storePath, if (roots.find(gcRoot) == roots.end()) printError( format( - "warning: ‘%1%’ is not in a directory where the garbage collector looks for roots; " - "therefore, ‘%2%’ might be removed by the garbage collector") + "warning: '%1%' is not in a directory where the garbage collector looks for roots; " + "therefore, '%2%' might be removed by the garbage collector") % gcRoot % storePath); } @@ -169,14 +169,14 @@ void LocalStore::addTempRoot(const Path & path) fdGCLock = -1; - debug(format("acquiring read lock on ‘%1%’") % state->fnTempRoots); + debug(format("acquiring read lock on '%1%'") % state->fnTempRoots); lockFile(state->fdTempRoots.get(), ltRead, true); /* Check whether the garbage collector didn't get in our way. */ struct stat st; if (fstat(state->fdTempRoots.get(), &st) == -1) - throw SysError(format("statting ‘%1%’") % state->fnTempRoots); + throw SysError(format("statting '%1%'") % state->fnTempRoots); if (st.st_size == 0) break; /* The garbage collector deleted this file before we could @@ -188,14 +188,14 @@ void LocalStore::addTempRoot(const Path & path) /* Upgrade the lock to a write lock. This will cause us to block if the garbage collector is holding our lock. */ - debug(format("acquiring write lock on ‘%1%’") % state->fnTempRoots); + debug(format("acquiring write lock on '%1%'") % state->fnTempRoots); lockFile(state->fdTempRoots.get(), ltWrite, true); string s = path + '\0'; writeFull(state->fdTempRoots.get(), s); /* Downgrade to a read lock. */ - debug(format("downgrading to read lock on ‘%1%’") % state->fnTempRoots); + debug(format("downgrading to read lock on '%1%'") % state->fnTempRoots); lockFile(state->fdTempRoots.get(), ltRead, true); } @@ -210,12 +210,12 @@ void LocalStore::readTempRoots(PathSet & tempRoots, FDs & fds) for (auto & i : tempRootFiles) { Path path = (format("%1%/%2%/%3%") % stateDir % tempRootsDir % i.name).str(); - debug(format("reading temporary root file ‘%1%’") % path); + debug(format("reading temporary root file '%1%'") % path); FDPtr fd(new AutoCloseFD(open(path.c_str(), O_CLOEXEC | O_RDWR, 0666))); if (!*fd) { /* It's okay if the file has disappeared. */ if (errno == ENOENT) continue; - throw SysError(format("opening temporary roots file ‘%1%’") % path); + throw SysError(format("opening temporary roots file '%1%'") % path); } /* This should work, but doesn't, for some reason. */ @@ -226,7 +226,7 @@ void LocalStore::readTempRoots(PathSet & tempRoots, FDs & fds) only succeed if the owning process has died. In that case we don't care about its temporary roots. */ if (lockFile(fd->get(), ltWrite, false)) { - printError(format("removing stale temporary roots file ‘%1%’") % path); + printError(format("removing stale temporary roots file '%1%'") % path); unlink(path.c_str()); writeFull(fd->get(), "d"); continue; @@ -235,7 +235,7 @@ void LocalStore::readTempRoots(PathSet & tempRoots, FDs & fds) /* Acquire a read lock. This will prevent the owning process from upgrading to a write lock, therefore it will block in addTempRoot(). */ - debug(format("waiting for read lock on ‘%1%’") % path); + debug(format("waiting for read lock on '%1%'") % path); lockFile(fd->get(), ltRead, true); /* Read the entire file. */ @@ -246,7 +246,7 @@ void LocalStore::readTempRoots(PathSet & tempRoots, FDs & fds) while ((end = contents.find((char) 0, pos)) != string::npos) { Path root(contents, pos, end - pos); - debug(format("got temporary root ‘%1%’") % root); + debug(format("got temporary root '%1%'") % root); assertStorePath(root); tempRoots.insert(root); pos = end + 1; @@ -264,7 +264,7 @@ void LocalStore::findRoots(const Path & path, unsigned char type, Roots & roots) if (isStorePath(storePath) && isValidPath(storePath)) roots[path] = storePath; else - printInfo(format("skipping invalid root from ‘%1%’ to ‘%2%’") % path % storePath); + printInfo(format("skipping invalid root from '%1%' to '%2%'") % path % storePath); }; try { @@ -287,7 +287,7 @@ void LocalStore::findRoots(const Path & path, unsigned char type, Roots & roots) target = absPath(target, dirOf(path)); if (!pathExists(target)) { if (isInDir(path, stateDir + "/" + gcRootsDir + "/auto")) { - printInfo(format("removing stale link from ‘%1%’ to ‘%2%’") % path % target); + printInfo(format("removing stale link from '%1%' to '%2%'") % path % target); unlink(path.c_str()); } } else { @@ -310,7 +310,7 @@ void LocalStore::findRoots(const Path & path, unsigned char type, Roots & roots) catch (SysError & e) { /* We only ignore permanent failures. */ if (e.errNo == EACCES || e.errNo == ENOENT || e.errNo == ENOTDIR) - printInfo(format("cannot read potential root ‘%1%’") % path); + printInfo(format("cannot read potential root '%1%'") % path); else throw; } @@ -451,7 +451,7 @@ void LocalStore::findRuntimeRoots(PathSet & roots) if (isInStore(i)) { Path path = toStorePath(i); if (roots.find(path) == roots.end() && isStorePath(path) && isValidPath(path)) { - debug(format("got additional root ‘%1%’") % path); + debug(format("got additional root '%1%'") % path); roots.insert(path); } } @@ -517,7 +517,7 @@ void LocalStore::deletePathRecursive(GCState & state, const Path & path) throw SysError(format("getting status of %1%") % realPath); } - printInfo(format("deleting ‘%1%’") % path); + printInfo(format("deleting '%1%'") % path); state.results.paths.insert(path); @@ -532,14 +532,14 @@ void LocalStore::deletePathRecursive(GCState & state, const Path & path) // size. try { if (chmod(realPath.c_str(), st.st_mode | S_IWUSR) == -1) - throw SysError(format("making ‘%1%’ writable") % realPath); + throw SysError(format("making '%1%' writable") % realPath); Path tmp = trashDir + "/" + baseNameOf(path); if (rename(realPath.c_str(), tmp.c_str())) - throw SysError(format("unable to rename ‘%1%’ to ‘%2%’") % realPath % tmp); + throw SysError(format("unable to rename '%1%' to '%2%'") % realPath % tmp); state.bytesInvalidated += size; } catch (SysError & e) { if (e.errNo == ENOSPC) { - printInfo(format("note: can't create move ‘%1%’: %2%") % realPath % e.msg()); + printInfo(format("note: can't create move '%1%': %2%") % realPath % e.msg()); deleteGarbage(state, realPath); } } @@ -566,7 +566,7 @@ bool LocalStore::canReachRoot(GCState & state, PathSet & visited, const Path & p } if (state.roots.find(path) != state.roots.end()) { - debug(format("cannot delete ‘%1%’ because it's a root") % path); + debug(format("cannot delete '%1%' because it's a root") % path); state.alive.insert(path); return true; } @@ -615,7 +615,7 @@ void LocalStore::tryToDelete(GCState & state, const Path & path) auto realPath = realStoreDir + "/" + baseNameOf(path); if (realPath == linksDir || realPath == trashDir) return; - //Activity act(*logger, lvlDebug, format("considering whether to delete ‘%1%’") % path); + //Activity act(*logger, lvlDebug, format("considering whether to delete '%1%'") % path); if (!isStorePath(path) || !isValidPath(path)) { /* A lock file belonging to a path that we're building right @@ -635,7 +635,7 @@ void LocalStore::tryToDelete(GCState & state, const Path & path) PathSet visited; if (canReachRoot(state, visited, path)) { - debug(format("cannot delete ‘%1%’ because it's still reachable") % path); + debug(format("cannot delete '%1%' because it's still reachable") % path); } else { /* No path we visited was a root, so everything is garbage. But we only delete ‘path’ and its referrers here so that @@ -656,7 +656,7 @@ void LocalStore::tryToDelete(GCState & state, const Path & path) void LocalStore::removeUnusedLinks(const GCState & state) { AutoCloseDir dir(opendir(linksDir.c_str())); - if (!dir) throw SysError(format("opening directory ‘%1%’") % linksDir); + if (!dir) throw SysError(format("opening directory '%1%'") % linksDir); long long actualSize = 0, unsharedSize = 0; @@ -669,7 +669,7 @@ void LocalStore::removeUnusedLinks(const GCState & state) struct stat st; if (lstat(path.c_str(), &st) == -1) - throw SysError(format("statting ‘%1%’") % path); + throw SysError(format("statting '%1%'") % path); if (st.st_nlink != 1) { unsigned long long size = st.st_blocks * 512ULL; @@ -678,17 +678,17 @@ void LocalStore::removeUnusedLinks(const GCState & state) continue; } - printMsg(lvlTalkative, format("deleting unused link ‘%1%’") % path); + printMsg(lvlTalkative, format("deleting unused link '%1%'") % path); if (unlink(path.c_str()) == -1) - throw SysError(format("deleting ‘%1%’") % path); + throw SysError(format("deleting '%1%'") % path); state.results.bytesFreed += st.st_blocks * 512ULL; } struct stat st; if (stat(linksDir.c_str(), &st) == -1) - throw SysError(format("statting ‘%1%’") % linksDir); + throw SysError(format("statting '%1%'") % linksDir); long long overhead = st.st_blocks * 512ULL; printInfo(format("note: currently hard linking saves %.2f MiB") @@ -768,7 +768,7 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results) assertStorePath(i); tryToDelete(state, i); if (state.dead.find(i) == state.dead.end()) - throw Error(format("cannot delete path ‘%1%’ since it is still alive") % i); + throw Error(format("cannot delete path '%1%' since it is still alive") % i); } } else if (options.maxFreed > 0) { @@ -781,7 +781,7 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results) try { AutoCloseDir dir(opendir(realStoreDir.c_str())); - if (!dir) throw SysError(format("opening directory ‘%1%’") % realStoreDir); + if (!dir) throw SysError(format("opening directory '%1%'") % realStoreDir); /* Read the store and immediately delete all paths that aren't valid. When using --max-freed etc., deleting @@ -834,7 +834,7 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results) fds.clear(); /* Delete the trash directory. */ - printInfo(format("deleting ‘%1%’") % trashDir); + printInfo(format("deleting '%1%'") % trashDir); deleteGarbage(state, trashDir); /* Clean up the links directory. */ |