about summary refs log tree commit diff
path: root/src/libstore/local-store.cc
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2017-07-30T11·27+0100
committerJörg Thalheim <joerg@thalheim.io>2017-07-30T11·32+0100
commit2fd8f8bb99a2832b3684878c020ba47322e79332 (patch)
tree65a667fbc746f4ff8efcaca3c0a58565985f26a5 /src/libstore/local-store.cc
parentc7654bc491d9ce7c1fbadecd7769418fa79a2060 (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/local-store.cc')
-rw-r--r--src/libstore/local-store.cc86
1 files changed, 43 insertions, 43 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index 7c41dfca7f31..95b05f8afd31 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -76,24 +76,24 @@ LocalStore::LocalStore(const Params & params)
         Path perUserDir = profilesDir + "/per-user";
         createDirs(perUserDir);
         if (chmod(perUserDir.c_str(), 01777) == -1)
-            throw SysError(format("could not set permissions on ‘%1%’ to 1777") % perUserDir);
+            throw SysError(format("could not set permissions on '%1%' to 1777") % perUserDir);
 
         mode_t perm = 01775;
 
         struct group * gr = getgrnam(settings.buildUsersGroup.get().c_str());
         if (!gr)
-            printError(format("warning: the group ‘%1%’ specified in ‘build-users-group’ does not exist")
+            printError(format("warning: the group '%1%' specified in 'build-users-group' does not exist")
                 % settings.buildUsersGroup);
         else {
             struct stat st;
             if (stat(realStoreDir.c_str(), &st))
-                throw SysError(format("getting attributes of path ‘%1%’") % realStoreDir);
+                throw SysError(format("getting attributes of path '%1%'") % realStoreDir);
 
             if (st.st_uid != 0 || st.st_gid != gr->gr_gid || (st.st_mode & ~S_IFMT) != perm) {
                 if (chown(realStoreDir.c_str(), 0, gr->gr_gid) == -1)
-                    throw SysError(format("changing ownership of path ‘%1%’") % realStoreDir);
+                    throw SysError(format("changing ownership of path '%1%'") % realStoreDir);
                 if (chmod(realStoreDir.c_str(), perm) == -1)
-                    throw SysError(format("changing permissions on path ‘%1%’") % realStoreDir);
+                    throw SysError(format("changing permissions on path '%1%'") % realStoreDir);
             }
         }
     }
@@ -104,10 +104,10 @@ LocalStore::LocalStore(const Params & params)
         struct stat st;
         while (path != "/") {
             if (lstat(path.c_str(), &st))
-                throw SysError(format("getting status of ‘%1%’") % path);
+                throw SysError(format("getting status of '%1%'") % path);
             if (S_ISLNK(st.st_mode))
                 throw Error(format(
-                        "the path ‘%1%’ is a symlink; "
+                        "the path '%1%' is a symlink; "
                         "this is not allowed for the Nix store and its parent directories")
                     % path);
             path = dirOf(path);
@@ -267,7 +267,7 @@ int LocalStore::getSchema()
     if (pathExists(schemaPath)) {
         string s = readFile(schemaPath);
         if (!string2Int(s, curSchema))
-            throw Error(format("‘%1%’ is corrupt") % schemaPath);
+            throw Error(format("'%1%' is corrupt") % schemaPath);
     }
     return curSchema;
 }
@@ -276,14 +276,14 @@ int LocalStore::getSchema()
 void LocalStore::openDB(State & state, bool create)
 {
     if (access(dbDir.c_str(), R_OK | W_OK))
-        throw SysError(format("Nix database directory ‘%1%’ is not writable") % dbDir);
+        throw SysError(format("Nix database directory '%1%' is not writable") % dbDir);
 
     /* Open the Nix database. */
     string dbPath = dbDir + "/db.sqlite";
     auto & db(state.db);
     if (sqlite3_open_v2(dbPath.c_str(), &db.db,
             SQLITE_OPEN_READWRITE | (create ? SQLITE_OPEN_CREATE : 0), 0) != SQLITE_OK)
-        throw Error(format("cannot open Nix database ‘%1%’") % dbPath);
+        throw Error(format("cannot open Nix database '%1%'") % dbPath);
 
 #ifdef __CYGWIN__
     /* The cygwin version of sqlite3 has a patch which calls
@@ -378,7 +378,7 @@ static void canonicaliseTimestampAndPermissions(const Path & path, const struct
                  | 0444
                  | (st.st_mode & S_IXUSR ? 0111 : 0);
             if (chmod(path.c_str(), mode) == -1)
-                throw SysError(format("changing mode of ‘%1%’ to %2$o") % path % mode);
+                throw SysError(format("changing mode of '%1%' to %2$o") % path % mode);
         }
 
     }
@@ -396,7 +396,7 @@ static void canonicaliseTimestampAndPermissions(const Path & path, const struct
 #else
         if (!S_ISLNK(st.st_mode) && utimes(path.c_str(), times) == -1)
 #endif
-            throw SysError(format("changing modification time of ‘%1%’") % path);
+            throw SysError(format("changing modification time of '%1%'") % path);
     }
 }
 
@@ -405,7 +405,7 @@ void canonicaliseTimestampAndPermissions(const Path & path)
 {
     struct stat st;
     if (lstat(path.c_str(), &st))
-        throw SysError(format("getting attributes of path ‘%1%’") % path);
+        throw SysError(format("getting attributes of path '%1%'") % path);
     canonicaliseTimestampAndPermissions(path, st);
 }
 
@@ -420,17 +420,17 @@ static void canonicalisePathMetaData_(const Path & path, uid_t fromUid, InodesSe
        setattrlist() to remove other attributes as well. */
     if (lchflags(path.c_str(), 0)) {
         if (errno != ENOTSUP)
-            throw SysError(format("clearing flags of path ‘%1%’") % path);
+            throw SysError(format("clearing flags of path '%1%'") % path);
     }
 #endif
 
     struct stat st;
     if (lstat(path.c_str(), &st))
-        throw SysError(format("getting attributes of path ‘%1%’") % path);
+        throw SysError(format("getting attributes of path '%1%'") % path);
 
     /* Really make sure that the path is of a supported type. */
     if (!(S_ISREG(st.st_mode) || S_ISDIR(st.st_mode) || S_ISLNK(st.st_mode)))
-        throw Error(format("file ‘%1%’ has an unsupported type") % path);
+        throw Error(format("file '%1%' has an unsupported type") % path);
 
 #if __linux__
     /* Remove extended attributes / ACLs. */
@@ -438,19 +438,19 @@ static void canonicalisePathMetaData_(const Path & path, uid_t fromUid, InodesSe
 
     if (eaSize < 0) {
         if (errno != ENOTSUP)
-            throw SysError("querying extended attributes of ‘%s’", path);
+            throw SysError("querying extended attributes of '%s'", path);
     } else if (eaSize > 0) {
         std::vector<char> eaBuf(eaSize);
 
         if ((eaSize = llistxattr(path.c_str(), eaBuf.data(), eaBuf.size())) < 0)
-            throw SysError("querying extended attributes of ‘%s’", path);
+            throw SysError("querying extended attributes of '%s'", path);
 
         for (auto & eaName: tokenizeString<Strings>(std::string(eaBuf.data(), eaSize), std::string("\000", 1))) {
             /* Ignore SELinux security labels since these cannot be
                removed even by root. */
             if (eaName == "security.selinux") continue;
             if (lremovexattr(path.c_str(), eaName.c_str()) == -1)
-                throw SysError("removing extended attribute ‘%s’ from ‘%s’", eaName, path);
+                throw SysError("removing extended attribute '%s' from '%s'", eaName, path);
         }
      }
 #endif
@@ -464,7 +464,7 @@ static void canonicalisePathMetaData_(const Path & path, uid_t fromUid, InodesSe
     if (fromUid != (uid_t) -1 && st.st_uid != fromUid) {
         assert(!S_ISDIR(st.st_mode));
         if (inodesSeen.find(Inode(st.st_dev, st.st_ino)) == inodesSeen.end())
-            throw BuildError(format("invalid ownership on file ‘%1%’") % path);
+            throw BuildError(format("invalid ownership on file '%1%'") % path);
         mode_t mode = st.st_mode & ~S_IFMT;
         assert(S_ISLNK(st.st_mode) || (st.st_uid == geteuid() && (mode == 0444 || mode == 0555) && st.st_mtime == mtimeStore));
         return;
@@ -488,7 +488,7 @@ static void canonicalisePathMetaData_(const Path & path, uid_t fromUid, InodesSe
         if (!S_ISLNK(st.st_mode) &&
             chown(path.c_str(), geteuid(), getegid()) == -1)
 #endif
-            throw SysError(format("changing owner of ‘%1%’ to %2%")
+            throw SysError(format("changing owner of '%1%' to %2%")
                 % path % geteuid());
     }
 
@@ -508,11 +508,11 @@ void canonicalisePathMetaData(const Path & path, uid_t fromUid, InodesSeen & ino
        be a symlink, since we can't change its ownership. */
     struct stat st;
     if (lstat(path.c_str(), &st))
-        throw SysError(format("getting attributes of path ‘%1%’") % path);
+        throw SysError(format("getting attributes of path '%1%'") % path);
 
     if (st.st_uid != geteuid()) {
         assert(S_ISLNK(st.st_mode));
-        throw Error(format("wrong ownership of top-level store path ‘%1%’") % path);
+        throw Error(format("wrong ownership of top-level store path '%1%'") % path);
     }
 }
 
@@ -533,7 +533,7 @@ void LocalStore::checkDerivationOutputs(const Path & drvPath, const Derivation &
     if (drv.isFixedOutput()) {
         DerivationOutputs::const_iterator out = drv.outputs.find("out");
         if (out == drv.outputs.end())
-            throw Error(format("derivation ‘%1%’ does not have an output named ‘out’") % drvPath);
+            throw Error(format("derivation '%1%' does not have an output named 'out'") % drvPath);
 
         bool recursive; Hash h;
         out->second.parseHashInfo(recursive, h);
@@ -541,7 +541,7 @@ void LocalStore::checkDerivationOutputs(const Path & drvPath, const Derivation &
 
         StringPairs::const_iterator j = drv.env.find("out");
         if (out->second.path != outPath || j == drv.env.end() || j->second != outPath)
-            throw Error(format("derivation ‘%1%’ has incorrect output ‘%2%’, should be ‘%3%’")
+            throw Error(format("derivation '%1%' has incorrect output '%2%', should be '%3%'")
                 % drvPath % out->second.path % outPath);
     }
 
@@ -558,7 +558,7 @@ void LocalStore::checkDerivationOutputs(const Path & drvPath, const Derivation &
             Path outPath = makeOutputPath(i.first, h, drvName);
             StringPairs::const_iterator j = drv.env.find(i.first);
             if (i.second.path != outPath || j == drv.env.end() || j->second != outPath)
-                throw Error(format("derivation ‘%1%’ has incorrect output ‘%2%’, should be ‘%3%’")
+                throw Error(format("derivation '%1%' has incorrect output '%2%', should be '%3%'")
                     % drvPath % i.second.path % outPath);
         }
     }
@@ -639,7 +639,7 @@ void LocalStore::queryPathInfoUncached(const Path & path,
             try {
                 info->narHash = Hash(useQueryPathInfo.getStr(1));
             } catch (BadHash & e) {
-                throw Error("in valid-path entry for ‘%s’: %s", path, e.what());
+                throw Error("in valid-path entry for '%s': %s", path, e.what());
             }
 
             info->registrationTime = useQueryPathInfo.getInt(2);
@@ -688,7 +688,7 @@ uint64_t LocalStore::queryValidPathId(State & state, const Path & path)
 {
     auto use(state.stmtQueryPathInfo.use()(path));
     if (!use.next())
-        throw Error(format("path ‘%1%’ is not valid") % path);
+        throw Error(format("path '%1%' is not valid") % path);
     return use.getInt(0);
 }
 
@@ -855,7 +855,7 @@ void LocalStore::querySubstitutablePathInfos(const PathSet & paths,
         if (sub->storeDir != storeDir) continue;
         for (auto & path : paths) {
             if (infos.count(path)) continue;
-            debug(format("checking substituter ‘%s’ for path ‘%s’")
+            debug(format("checking substituter '%s' for path '%s'")
                 % sub->getUri() % path);
             try {
                 auto info = sub->queryPathInfo(path);
@@ -936,7 +936,7 @@ void LocalStore::registerValidPaths(const ValidPathInfos & infos)
    there are no referrers. */
 void LocalStore::invalidatePath(State & state, const Path & path)
 {
-    debug(format("invalidating path ‘%1%’") % path);
+    debug(format("invalidating path '%1%'") % path);
 
     state.stmtInvalidatePath.use()(path).exec();
 
@@ -957,15 +957,15 @@ void LocalStore::addToStore(const ValidPathInfo & info, const ref<std::string> &
 
     Hash h = hashString(htSHA256, *nar);
     if (h != info.narHash)
-        throw Error("hash mismatch importing path ‘%s’; expected hash ‘%s’, got ‘%s’",
+        throw Error("hash mismatch importing path '%s'; expected hash '%s', got '%s'",
             info.path, info.narHash.to_string(), h.to_string());
 
     if (nar->size() != info.narSize)
-        throw Error("size mismatch importing path ‘%s’; expected %s, got %s",
+        throw Error("size mismatch importing path '%s'; expected %s, got %s",
             info.path, info.narSize, nar->size());
 
     if (requireSigs && checkSigs && !info.checkSignatures(*this, publicKeys))
-        throw Error("cannot add path ‘%s’ because it lacks a valid signature", info.path);
+        throw Error("cannot add path '%s' because it lacks a valid signature", info.path);
 
     addTempRoot(info.path);
 
@@ -1150,7 +1150,7 @@ void LocalStore::invalidatePathChecked(const Path & path)
             PathSet referrers; queryReferrers(*state, path, referrers);
             referrers.erase(path); /* ignore self-references */
             if (!referrers.empty())
-                throw PathInUse(format("cannot delete path ‘%1%’ because it is in use by %2%")
+                throw PathInUse(format("cannot delete path '%1%' because it is in use by %2%")
                     % path % showPaths(referrers));
             invalidatePath(*state, path);
         }
@@ -1195,12 +1195,12 @@ bool LocalStore::verifyStore(bool checkContents, RepairFlag repair)
                 auto info = std::const_pointer_cast<ValidPathInfo>(std::shared_ptr<const ValidPathInfo>(queryPathInfo(i)));
 
                 /* Check the content hash (optionally - slow). */
-                printMsg(lvlTalkative, format("checking contents of ‘%1%’") % i);
+                printMsg(lvlTalkative, format("checking contents of '%1%'") % i);
                 HashResult current = hashPath(info->narHash.type, i);
 
                 if (info->narHash != nullHash && info->narHash != current.first) {
-                    printError(format("path ‘%1%’ was modified! "
-                            "expected hash ‘%2%’, got ‘%3%’")
+                    printError(format("path '%1%' was modified! "
+                            "expected hash '%2%', got '%3%'")
                         % i % info->narHash.to_string() % current.first.to_string());
                     if (repair) repairPath(i); else errors = true;
                 } else {
@@ -1209,14 +1209,14 @@ bool LocalStore::verifyStore(bool checkContents, RepairFlag repair)
 
                     /* Fill in missing hashes. */
                     if (info->narHash == nullHash) {
-                        printError(format("fixing missing hash on ‘%1%’") % i);
+                        printError(format("fixing missing hash on '%1%'") % i);
                         info->narHash = current.first;
                         update = true;
                     }
 
                     /* Fill in missing narSize fields (from old stores). */
                     if (info->narSize == 0) {
-                        printError(format("updating size field on ‘%1%’ to %2%") % i % current.second);
+                        printError(format("updating size field on '%1%' to %2%") % i % current.second);
                         info->narSize = current.second;
                         update = true;
                     }
@@ -1253,7 +1253,7 @@ void LocalStore::verifyPath(const Path & path, const PathSet & store,
     done.insert(path);
 
     if (!isStorePath(path)) {
-        printError(format("path ‘%1%’ is not in the Nix store") % path);
+        printError(format("path '%1%' is not in the Nix store") % path);
         auto state(_state.lock());
         invalidatePath(*state, path);
         return;
@@ -1272,11 +1272,11 @@ void LocalStore::verifyPath(const Path & path, const PathSet & store,
             }
 
         if (canInvalidate) {
-            printError(format("path ‘%1%’ disappeared, removing from database...") % path);
+            printError(format("path '%1%' disappeared, removing from database...") % path);
             auto state(_state.lock());
             invalidatePath(*state, path);
         } else {
-            printError(format("path ‘%1%’ disappeared, but it still has valid referrers!") % path);
+            printError(format("path '%1%' disappeared, but it still has valid referrers!") % path);
             if (repair)
                 try {
                     repairPath(path);
@@ -1315,7 +1315,7 @@ static void makeMutable(const Path & path)
     AutoCloseFD fd = open(path.c_str(), O_RDONLY | O_NOFOLLOW | O_CLOEXEC);
     if (fd == -1) {
         if (errno == ELOOP) return; // it's a symlink
-        throw SysError(format("opening file ‘%1%’") % path);
+        throw SysError(format("opening file '%1%'") % path);
     }
 
     unsigned int flags = 0, old;