about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-08-20T15·00+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-08-20T16·03+0200
commit11849a320e4f522b97fcdf09ff0940496880475b (patch)
tree13548f1c1bb2e01590b31d66d9bb8f46534bc99f /src/libstore
parent373fad75e19a2f24db512621b8cedb627d03d49d (diff)
Use proper quotes everywhere
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/build.cc174
-rw-r--r--src/libstore/derivations.cc6
-rw-r--r--src/libstore/gc.cc72
-rw-r--r--src/libstore/globals.cc6
-rw-r--r--src/libstore/local-store.cc128
-rw-r--r--src/libstore/misc.cc4
-rw-r--r--src/libstore/optimise-store.cc42
-rw-r--r--src/libstore/pathlocks.cc14
-rw-r--r--src/libstore/references.cc4
-rw-r--r--src/libstore/remote-store.cc6
-rw-r--r--src/libstore/store-api.cc12
11 files changed, 234 insertions, 234 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index d93b5607d8a6..856e5f8200d6 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -322,7 +322,7 @@ void Goal::waiteeDone(GoalPtr waitee, ExitCode result)
     assert(waitees.find(waitee) != waitees.end());
     waitees.erase(waitee);
 
-    trace(format("waitee `%1%' done; %2% left") %
+    trace(format("waitee ‘%1%’ done; %2% left") %
         waitee->name % waitees.size());
 
     if (result == ecFailed || result == ecNoSubstituters || result == ecIncompleteClosure) ++nrFailed;
@@ -395,7 +395,7 @@ static void commonChildInit(Pipe & logPipe)
     /* Reroute stdin to /dev/null. */
     int fdDevNull = open(pathNullDevice.c_str(), O_RDWR);
     if (fdDevNull == -1)
-        throw SysError(format("cannot open `%1%'") % pathNullDevice);
+        throw SysError(format("cannot open ‘%1%’") % pathNullDevice);
     if (dup2(fdDevNull, STDIN_FILENO) == -1)
         throw SysError("cannot dup null device into stdin");
     close(fdDevNull);
@@ -475,29 +475,29 @@ void UserLock::acquire()
     /* Get the members of the build-users-group. */
     struct group * gr = getgrnam(settings.buildUsersGroup.c_str());
     if (!gr)
-        throw Error(format("the group `%1%' specified in `build-users-group' does not exist")
+        throw Error(format("the group ‘%1%’ specified in ‘build-users-group’ does not exist")
             % settings.buildUsersGroup);
     gid = gr->gr_gid;
 
     /* Copy the result of getgrnam. */
     Strings users;
     for (char * * p = gr->gr_mem; *p; ++p) {
-        debug(format("found build user `%1%'") % *p);
+        debug(format("found build user ‘%1%’") % *p);
         users.push_back(*p);
     }
 
     if (users.empty())
-        throw Error(format("the build users group `%1%' has no members")
+        throw Error(format("the build users group ‘%1%’ has no members")
             % settings.buildUsersGroup);
 
     /* Find a user account that isn't currently in use for another
        build. */
     foreach (Strings::iterator, i, users) {
-        debug(format("trying user `%1%'") % *i);
+        debug(format("trying user ‘%1%’") % *i);
 
         struct passwd * pw = getpwnam(i->c_str());
         if (!pw)
-            throw Error(format("the user `%1%' in the group `%2%' does not exist")
+            throw Error(format("the user ‘%1%’ in the group ‘%2%’ does not exist")
                 % *i % settings.buildUsersGroup);
 
         createDirs(settings.nixStateDir + "/userpool");
@@ -510,7 +510,7 @@ void UserLock::acquire()
 
         AutoCloseFD fd = open(fnUserLock.c_str(), O_RDWR | O_CREAT, 0600);
         if (fd == -1)
-            throw SysError(format("opening user lock `%1%'") % fnUserLock);
+            throw SysError(format("opening user lock ‘%1%’") % fnUserLock);
         closeOnExec(fd);
 
         if (lockFile(fd, ltWrite, false)) {
@@ -521,7 +521,7 @@ void UserLock::acquire()
 
             /* Sanity check... */
             if (uid == getuid() || uid == geteuid())
-                throw Error(format("the Nix user should not be a member of `%1%'")
+                throw Error(format("the Nix user should not be a member of ‘%1%’")
                     % settings.buildUsersGroup);
 
             return;
@@ -529,7 +529,7 @@ void UserLock::acquire()
     }
 
     throw Error(format("all build users are currently in use; "
-        "consider creating additional users and adding them to the `%1%' group")
+        "consider creating additional users and adding them to the ‘%1%’ group")
         % settings.buildUsersGroup);
 }
 
@@ -597,7 +597,7 @@ HookInstance::HookInstance()
 
         commonChildInit(fromHook);
 
-        if (chdir("/") == -1) throw SysError("changing into `/");
+        if (chdir("/") == -1) throw SysError("changing into /");
 
         /* Dup the communication pipes. */
         if (dup2(toHook.readSide, STDIN_FILENO) == -1)
@@ -613,7 +613,7 @@ HookInstance::HookInstance()
             (format("%1%") % settings.buildTimeout).str().c_str(),
             NULL);
 
-        throw SysError(format("executing `%1%'") % buildHook);
+        throw SysError(format("executing ‘%1%’") % buildHook);
     });
 
     pid.setSeparatePG(true);
@@ -843,7 +843,7 @@ DerivationGoal::DerivationGoal(const Path & drvPath, const StringSet & wantedOut
 {
     this->drvPath = drvPath;
     state = &DerivationGoal::init;
-    name = (format("building of `%1%'") % drvPath).str();
+    name = (format("building of ‘%1%’") % drvPath).str();
     trace("created");
 }
 
@@ -924,7 +924,7 @@ void DerivationGoal::init()
     trace("init");
 
     if (settings.readOnlyMode)
-        throw Error(format("cannot build derivation `%1%' - no write access to the Nix store") % drvPath);
+        throw Error(format("cannot build derivation ‘%1%’ - no write access to the Nix store") % drvPath);
 
     /* The first thing to do is to make sure that the derivation
        exists.  If it doesn't, it may be created through a
@@ -940,7 +940,7 @@ void DerivationGoal::haveDerivation()
     trace("loading derivation");
 
     if (nrFailed != 0) {
-        printMsg(lvlError, format("cannot build missing derivation `%1%'") % drvPath);
+        printMsg(lvlError, format("cannot build missing derivation ‘%1%’") % drvPath);
         amDone(ecFailed);
         return;
     }
@@ -991,7 +991,7 @@ void DerivationGoal::outputsSubstituted()
     trace("all outputs substituted (maybe)");
 
     if (nrFailed > 0 && nrFailed > nrNoSubstituters + nrIncompleteClosure && !settings.tryFallback)
-        throw Error(format("some substitutes for the outputs of derivation `%1%' failed (usually happens due to networking issues); try `--fallback' to build derivation from source ") % drvPath);
+        throw Error(format("some substitutes for the outputs of derivation ‘%1%’ failed (usually happens due to networking issues); try ‘--fallback’ to build derivation from source ") % drvPath);
 
     /*  If the substitutes form an incomplete closure, then we should
         build the dependencies of this derivation, but after that, we
@@ -1016,7 +1016,7 @@ void DerivationGoal::outputsSubstituted()
         return;
     }
     if (buildMode == bmCheck && nrInvalid > 0)
-        throw Error(format("some outputs of `%1%' are not valid, so checking is not possible") % drvPath);
+        throw Error(format("some outputs of ‘%1%’ are not valid, so checking is not possible") % drvPath);
 
     /* Otherwise, at least one of the output paths could not be
        produced using a substitute.  So we have to build instead. */
@@ -1072,7 +1072,7 @@ void DerivationGoal::repairClosure()
     PathSet broken;
     foreach (PathSet::iterator, i, outputClosure) {
         if (worker.store.pathContentsGood(*i)) continue;
-        printMsg(lvlError, format("found corrupted or missing path `%1%' in the output closure of `%2%'") % *i % drvPath);
+        printMsg(lvlError, format("found corrupted or missing path ‘%1%’ in the output closure of ‘%2%’") % *i % drvPath);
         Path drvPath2 = outputsToDrv[*i];
         if (drvPath2 == "")
             addWaitee(worker.makeSubstitutionGoal(*i, true));
@@ -1093,7 +1093,7 @@ void DerivationGoal::closureRepaired()
 {
     trace("closure repaired");
     if (nrFailed > 0)
-        throw Error(format("some paths in the output closure of derivation `%1%' could not be repaired") % drvPath);
+        throw Error(format("some paths in the output closure of derivation ‘%1%’ could not be repaired") % drvPath);
     amDone(ecSuccess);
 }
 
@@ -1104,7 +1104,7 @@ void DerivationGoal::inputsRealised()
 
     if (nrFailed != 0) {
         printMsg(lvlError,
-            format("cannot build derivation `%1%': %2% dependencies couldn't be built")
+            format("cannot build derivation ‘%1%’: %2% dependencies couldn't be built")
             % drvPath % nrFailed);
         amDone(ecFailed);
         return;
@@ -1120,7 +1120,7 @@ void DerivationGoal::inputsRealised()
 
     /* The outputs are referenceable paths. */
     foreach (DerivationOutputs::iterator, i, drv.outputs) {
-        debug(format("building path `%1%'") % i->second.path);
+        debug(format("building path ‘%1%’") % i->second.path);
         allPaths.insert(i->second.path);
     }
 
@@ -1138,7 +1138,7 @@ void DerivationGoal::inputsRealised()
                 computeFSClosure(worker.store, inDrv.outputs[*j].path, inputPaths);
             else
                 throw Error(
-                    format("derivation `%1%' requires non-existent output `%2%' from input derivation `%3%'")
+                    format("derivation ‘%1%’ requires non-existent output ‘%2%’ from input derivation ‘%3%’")
                     % drvPath % *j % i->first);
     }
 
@@ -1206,7 +1206,7 @@ void DerivationGoal::tryToBuild()
        goal to sleep until another goal finishes, then try again. */
     foreach (DerivationOutputs::iterator, i, drv.outputs)
         if (pathIsLockedByMe(i->second.path)) {
-            debug(format("putting derivation `%1%' to sleep because `%2%' is locked by another goal")
+            debug(format("putting derivation ‘%1%’ to sleep because ‘%2%’ is locked by another goal")
                 % drvPath % i->second.path);
             worker.waitForAnyGoal(shared_from_this());
             return;
@@ -1232,7 +1232,7 @@ void DerivationGoal::tryToBuild()
     validPaths = checkPathValidity(true, buildMode == bmRepair);
     assert(buildMode != bmCheck || validPaths.size() == drv.outputs.size());
     if (buildMode != bmCheck && validPaths.size() == drv.outputs.size()) {
-        debug(format("skipping build of derivation `%1%', someone beat us to it") % drvPath);
+        debug(format("skipping build of derivation ‘%1%’, someone beat us to it") % drvPath);
         outputLocks.setDeletion(true);
         amDone(ecSuccess);
         return;
@@ -1248,7 +1248,7 @@ void DerivationGoal::tryToBuild()
         Path path = i->second.path;
         if (worker.store.isValidPath(path)) continue;
         if (!pathExists(path)) continue;
-        debug(format("removing invalid path `%1%'") % path);
+        debug(format("removing invalid path ‘%1%’") % path);
         deletePath(path);
     }
 
@@ -1326,7 +1326,7 @@ void replaceValidPath(const Path & storePath, const Path tmpPath)
     if (pathExists(storePath))
         rename(storePath.c_str(), oldPath.c_str());
     if (rename(tmpPath.c_str(), storePath.c_str()) == -1)
-        throw SysError(format("moving `%1%' to `%2%'") % tmpPath % storePath);
+        throw SysError(format("moving ‘%1%’ to ‘%2%’") % tmpPath % storePath);
     if (pathExists(oldPath))
         deletePath(oldPath);
 }
@@ -1352,7 +1352,7 @@ void DerivationGoal::buildDone()
         status = pid.wait(true);
     }
 
-    debug(format("builder process for `%1%' finished") % drvPath);
+    debug(format("builder process for ‘%1%’ finished") % drvPath);
 
     /* So the child is gone now. */
     worker.childTerminated(savedPid);
@@ -1409,7 +1409,7 @@ void DerivationGoal::buildDone()
             if (diskFull)
                 printMsg(lvlError, "note: build failure may have been caused by lack of free disk space");
 
-            throw BuildError(format("builder for `%1%' %2%")
+            throw BuildError(format("builder for ‘%1%’ %2%")
                 % drvPath % statusToString(status));
         }
 
@@ -1519,12 +1519,12 @@ HookReply DerivationGoal::tryBuildHook()
         writeToStderr(s);
     }
 
-    debug(format("hook reply is `%1%'") % reply);
+    debug(format("hook reply is ‘%1%’") % reply);
 
     if (reply == "decline" || reply == "postpone")
         return reply == "decline" ? rpDecline : rpPostpone;
     else if (reply != "accept")
-        throw Error(format("bad hook reply `%1%'") % reply);
+        throw Error(format("bad hook reply ‘%1%’") % reply);
 
     printMsg(lvlTalkative, format("using hook to build path(s) %1%") % showPaths(missingPaths));
 
@@ -1571,7 +1571,7 @@ HookReply DerivationGoal::tryBuildHook()
 void chmod_(const Path & path, mode_t mode)
 {
     if (chmod(path.c_str(), mode) == -1)
-        throw SysError(format("setting permissions on `%1%'") % path);
+        throw SysError(format("setting permissions on ‘%1%’") % path);
 }
 
 
@@ -1594,7 +1594,7 @@ void DerivationGoal::startBuilder()
         if (settings.printBuildTrace)
             printMsg(lvlError, format("@ unsupported-platform %1% %2%") % drvPath % drv.platform);
         throw Error(
-            format("a `%1%' is required to build `%3%', but I am a `%2%'")
+            format("a ‘%1%’ is required to build ‘%3%’, but I am a ‘%2%’")
             % drv.platform % settings.thisSystem % drvPath);
     }
 
@@ -1674,7 +1674,7 @@ void DerivationGoal::startBuilder()
     string s = get(drv.env, "exportReferencesGraph");
     Strings ss = tokenizeString<Strings>(s);
     if (ss.size() % 2 != 0)
-        throw BuildError(format("odd number of tokens in `exportReferencesGraph': `%1%'") % s);
+        throw BuildError(format("odd number of tokens in ‘exportReferencesGraph’: ‘%1%’") % s);
     for (Strings::iterator i = ss.begin(); i != ss.end(); ) {
         string fileName = *i++;
         checkStoreName(fileName); /* !!! abuse of this function */
@@ -1682,11 +1682,11 @@ void DerivationGoal::startBuilder()
         /* Check that the store path is valid. */
         Path storePath = *i++;
         if (!isInStore(storePath))
-            throw BuildError(format("`exportReferencesGraph' contains a non-store path `%1%'")
+            throw BuildError(format("‘exportReferencesGraph’ contains a non-store path ‘%1%’")
                 % storePath);
         storePath = toStorePath(storePath);
         if (!worker.store.isValidPath(storePath))
-            throw BuildError(format("`exportReferencesGraph' contains an invalid path `%1%'")
+            throw BuildError(format("‘exportReferencesGraph’ contains an invalid path ‘%1%’")
                 % storePath);
 
         /* If there are derivations in the graph, then include their
@@ -1724,7 +1724,7 @@ void DerivationGoal::startBuilder()
 
         /* Change ownership of the temporary build directory. */
         if (chown(tmpDir.c_str(), buildUser.getUID(), buildUser.getGID()) == -1)
-            throw SysError(format("cannot change ownership of `%1%'") % tmpDir);
+            throw SysError(format("cannot change ownership of ‘%1%’") % tmpDir);
 
         /* Check that the Nix store has the appropriate permissions,
            i.e., owned by root and mode 1775 (sticky bit on so that
@@ -1732,13 +1732,13 @@ void DerivationGoal::startBuilder()
            outputs of other processes). */
         struct stat st;
         if (stat(settings.nixStore.c_str(), &st) == -1)
-            throw SysError(format("cannot stat `%1%'") % settings.nixStore);
+            throw SysError(format("cannot stat ‘%1%’") % settings.nixStore);
         if (!(st.st_mode & S_ISVTX) ||
             ((st.st_mode & S_IRWXG) != S_IRWXG) ||
             (st.st_gid != buildUser.getGID()))
             throw Error(format(
-                "builder does not have write permission to `%2%'; "
-                "try `chgrp %1% %2%; chmod 1775 %2%'")
+                "builder does not have write permission to ‘%2%’; "
+                "try ‘chgrp %1% %2%; chmod 1775 %2%’")
                 % buildUser.getGID() % settings.nixStore);
     }
 
@@ -1767,7 +1767,7 @@ void DerivationGoal::startBuilder()
         /* Clean up the chroot directory automatically. */
         autoDelChroot = std::shared_ptr<AutoDelete>(new AutoDelete(chrootRootDir));
 
-        printMsg(lvlChatty, format("setting up chroot environment in `%1%'") % chrootRootDir);
+        printMsg(lvlChatty, format("setting up chroot environment in ‘%1%’") % chrootRootDir);
 
         /* Create a writable /tmp in the chroot.  Many builders need
            this.  (Of course they should really respect $TMPDIR
@@ -1824,7 +1824,7 @@ void DerivationGoal::startBuilder()
         foreach (PathSet::iterator, i, inputPaths) {
             struct stat st;
             if (lstat(i->c_str(), &st))
-                throw SysError(format("getting attributes of path `%1%'") % *i);
+                throw SysError(format("getting attributes of path ‘%1%’") % *i);
             if (S_ISDIR(st.st_mode))
                 dirsInChroot[*i] = *i;
             else {
@@ -1835,7 +1835,7 @@ void DerivationGoal::startBuilder()
                        which is quite possible after a `nix-store
                        --optimise'. */
                     if (errno != EMLINK)
-                        throw SysError(format("linking `%1%' to `%2%'") % p % *i);
+                        throw SysError(format("linking ‘%1%’ to ‘%2%’") % p % *i);
                     StringSink sink;
                     dumpPath(*i, sink);
                     StringSource source(sink.s);
@@ -1862,7 +1862,7 @@ void DerivationGoal::startBuilder()
     else {
 
         if (pathExists(homeDir))
-            throw Error(format("directory `%1%' exists; please remove it") % homeDir);
+            throw Error(format("directory ‘%1%’ exists; please remove it") % homeDir);
 
         /* We're not doing a chroot build, but we have some valid
            output paths.  Since we can't just overwrite or delete
@@ -1889,7 +1889,7 @@ void DerivationGoal::startBuilder()
 
 
     /* Run the builder. */
-    printMsg(lvlChatty, format("executing builder `%1%'") % drv.builder);
+    printMsg(lvlChatty, format("executing builder ‘%1%’") % drv.builder);
 
     /* Create the log file. */
     Path logFile = openLogFile();
@@ -2004,7 +2004,7 @@ void DerivationGoal::initChild()
                 vector<string> fields = tokenizeString<vector<string> >(*i, " ");
                 string fs = decodeOctalEscaped(fields.at(4));
                 if (mount(0, fs.c_str(), 0, MS_PRIVATE, 0) == -1)
-                    throw SysError(format("unable to make filesystem `%1%' private") % fs);
+                    throw SysError(format("unable to make filesystem ‘%1%’ private") % fs);
             }
 
             /* Set up a nearly empty /dev, unless the user asked to
@@ -2038,9 +2038,9 @@ void DerivationGoal::initChild()
                 Path source = i->second;
                 Path target = chrootRootDir + i->first;
                 if (source == "/proc") continue; // backwards compatibility
-                debug(format("bind mounting `%1%' to `%2%'") % source % target);
+                debug(format("bind mounting ‘%1%’ to ‘%2%’") % source % target);
                 if (stat(source.c_str(), &st) == -1)
-                    throw SysError(format("getting attributes of path `%1%'") % source);
+                    throw SysError(format("getting attributes of path ‘%1%’") % source);
                 if (S_ISDIR(st.st_mode))
                     createDirs(target);
                 else {
@@ -2048,7 +2048,7 @@ void DerivationGoal::initChild()
                     writeFile(target, "");
                 }
                 if (mount(source.c_str(), target.c_str(), "", MS_BIND, 0) == -1)
-                    throw SysError(format("bind mount from `%1%' to `%2%' failed") % source % target);
+                    throw SysError(format("bind mount from ‘%1%’ to ‘%2%’ failed") % source % target);
             }
 
             /* Bind a new instance of procfs on /proc to reflect our
@@ -2085,12 +2085,12 @@ void DerivationGoal::initChild()
                doesn't matter, since due to the bind mount tmpDir and
                tmpRootDit/tmpDir are the same directories.) */
             if (chroot(chrootRootDir.c_str()) == -1)
-                throw SysError(format("cannot change root directory to `%1%'") % chrootRootDir);
+                throw SysError(format("cannot change root directory to ‘%1%’") % chrootRootDir);
         }
 #endif
 
         if (chdir(tmpDir.c_str()) == -1)
-            throw SysError(format("changing into `%1%'") % tmpDir);
+            throw SysError(format("changing into ‘%1%’") % tmpDir);
 
         /* Close all other file descriptors. */
         closeMostFDs(set<int>());
@@ -2132,7 +2132,7 @@ void DerivationGoal::initChild()
            setuid() when run as root sets the real, effective and
            saved UIDs. */
         if (buildUser.enabled()) {
-            printMsg(lvlChatty, format("switching to user `%1%'") % buildUser.getUser());
+            printMsg(lvlChatty, format("switching to user ‘%1%’") % buildUser.getUser());
 
             if (setgroups(0, 0) == -1)
                 throw SysError("cannot clear the set of supplementary groups");
@@ -2163,7 +2163,7 @@ void DerivationGoal::initChild()
         /* Execute the program.  This should not return. */
         execve(program.c_str(), (char * *) &args[0], (char * *) envArr);
 
-        throw SysError(format("executing `%1%'") % drv.builder);
+        throw SysError(format("executing ‘%1%’") % drv.builder);
 
     } catch (std::exception & e) {
         writeToStderr("while setting up the build environment: " + string(e.what()) + "\n");
@@ -2187,7 +2187,7 @@ PathSet parseReferenceSpecifiers(const Derivation & drv, string attr)
         else if (drv.outputs.find(*i) != drv.outputs.end())
             result.insert(drv.outputs.find(*i)->second.path);
         else throw BuildError(
-            format("derivation contains an illegal reference specifier `%1%'")
+            format("derivation contains an illegal reference specifier ‘%1%’")
             % *i);
     }
     return result;
@@ -2224,7 +2224,7 @@ void DerivationGoal::registerOutputs()
                     replaceValidPath(path, actualPath);
                 else
                     if (buildMode != bmCheck && rename(actualPath.c_str(), path.c_str()) == -1)
-                        throw SysError(format("moving build output `%1%' from the chroot to the Nix store") % path);
+                        throw SysError(format("moving build output ‘%1%’ from the chroot to the Nix store") % path);
             }
             if (buildMode != bmCheck) actualPath = path;
         } else {
@@ -2241,9 +2241,9 @@ void DerivationGoal::registerOutputs()
         if (lstat(actualPath.c_str(), &st) == -1) {
             if (errno == ENOENT)
                 throw BuildError(
-                    format("builder for `%1%' failed to produce output path `%2%'")
+                    format("builder for ‘%1%’ failed to produce output path ‘%2%’")
                     % drvPath % path);
-            throw SysError(format("getting attributes of path `%1%'") % actualPath);
+            throw SysError(format("getting attributes of path ‘%1%’") % actualPath);
         }
 
 #ifndef __CYGWIN__
@@ -2253,13 +2253,13 @@ void DerivationGoal::registerOutputs()
            user. */
         if ((!S_ISLNK(st.st_mode) && (st.st_mode & (S_IWGRP | S_IWOTH))) ||
             (buildUser.enabled() && st.st_uid != buildUser.getUID()))
-            throw BuildError(format("suspicious ownership or permission on `%1%'; rejecting this build output") % path);
+            throw BuildError(format("suspicious ownership or permission on ‘%1%’; rejecting this build output") % path);
 #endif
 
         /* Apply hash rewriting if necessary. */
         bool rewritten = false;
         if (!rewritesFromTmp.empty()) {
-            printMsg(lvlError, format("warning: rewriting hashes in `%1%'; cross fingers") % path);
+            printMsg(lvlError, format("warning: rewriting hashes in ‘%1%’; cross fingers") % path);
 
             /* Canonicalise first.  This ensures that the path we're
                rewriting doesn't contain a hard link to /etc/shadow or
@@ -2278,7 +2278,7 @@ void DerivationGoal::registerOutputs()
         }
 
         startNest(nest, lvlTalkative,
-            format("scanning for references inside `%1%'") % path);
+            format("scanning for references inside ‘%1%’") % path);
 
         /* Check that fixed-output derivations produced the right
            outputs (i.e., the content hash should match the specified
@@ -2293,14 +2293,14 @@ void DerivationGoal::registerOutputs()
                    execute permission. */
                 if (!S_ISREG(st.st_mode) || (st.st_mode & S_IXUSR) != 0)
                     throw BuildError(
-                        format("output path `%1% should be a non-executable regular file") % path);
+                        format("output path ‘%1%’ should be a non-executable regular file") % path);
             }
 
             /* Check the hash. */
             Hash h2 = recursive ? hashPath(ht, actualPath).first : hashFile(ht, actualPath);
             if (h != h2)
                 throw BuildError(
-                    format("output path `%1%' should have %2% hash `%3%', instead has `%4%'")
+                    format("output path ‘%1%’ should have %2% hash ‘%3%’, instead has ‘%4%’")
                     % path % i->second.hashAlgo % printHash16or32(h) % printHash16or32(h2));
         }
 
@@ -2319,7 +2319,7 @@ void DerivationGoal::registerOutputs()
         if (buildMode == bmCheck) {
             ValidPathInfo info = worker.store.queryPathInfo(path);
             if (hash.first != info.hash)
-                throw Error(format("derivation `%2%' may not be deterministic: hash mismatch in output `%1%'") % drvPath % path);
+                throw Error(format("derivation ‘%2%’ may not be deterministic: hash mismatch in output ‘%1%’") % drvPath % path);
             continue;
         }
 
@@ -2328,9 +2328,9 @@ void DerivationGoal::registerOutputs()
         foreach (PathSet::iterator, i, inputPaths) {
             PathSet::iterator j = references.find(*i);
             if (j == references.end())
-                debug(format("unreferenced input: `%1%'") % *i);
+                debug(format("unreferenced input: ‘%1%’") % *i);
             else
-                debug(format("referenced input: `%1%'") % *i);
+                debug(format("referenced input: ‘%1%’") % *i);
         }
 
         /* If the derivation specifies an `allowedReferences'
@@ -2341,7 +2341,7 @@ void DerivationGoal::registerOutputs()
             PathSet allowed = parseReferenceSpecifiers(drv, get(drv.env, "allowedReferences"));
             foreach (PathSet::iterator, i, references)
                 if (allowed.find(*i) == allowed.end())
-                    throw BuildError(format("output is not allowed to refer to path `%1%'") % *i);
+                    throw BuildError(format("output is not allowed to refer to path ‘%1%’") % *i);
         }
 
         worker.store.optimisePath(path); // FIXME: combine with scanForReferences()
@@ -2385,22 +2385,22 @@ Path DerivationGoal::openLogFile()
 
         Path logFileName = (format("%1%/%2%.bz2") % dir % string(baseName, 2)).str();
         AutoCloseFD fd = open(logFileName.c_str(), O_CREAT | O_WRONLY | O_TRUNC, 0666);
-        if (fd == -1) throw SysError(format("creating log file `%1%'") % logFileName);
+        if (fd == -1) throw SysError(format("creating log file ‘%1%’") % logFileName);
         closeOnExec(fd);
 
         if (!(fLogFile = fdopen(fd.borrow(), "w")))
-            throw SysError(format("opening file `%1%'") % logFileName);
+            throw SysError(format("opening file ‘%1%’") % logFileName);
 
         int err;
         if (!(bzLogFile = BZ2_bzWriteOpen(&err, fLogFile, 9, 0, 0)))
-            throw Error(format("cannot open compressed log file `%1%'") % logFileName);
+            throw Error(format("cannot open compressed log file ‘%1%’") % logFileName);
 
         return logFileName;
 
     } else {
         Path logFileName = (format("%1%/%2%") % dir % string(baseName, 2)).str();
         fdLogFile = open(logFileName.c_str(), O_CREAT | O_WRONLY | O_TRUNC, 0666);
-        if (fdLogFile == -1) throw SysError(format("creating log file `%1%'") % logFileName);
+        if (fdLogFile == -1) throw SysError(format("creating log file ‘%1%’") % logFileName);
         closeOnExec(fdLogFile);
         return logFileName;
     }
@@ -2430,7 +2430,7 @@ void DerivationGoal::deleteTmpDir(bool force)
     if (tmpDir != "") {
         if (settings.keepFailed && !force) {
             printMsg(lvlError,
-                format("note: keeping build directory `%2%'")
+                format("note: keeping build directory ‘%2%’")
                 % drvPath % tmpDir);
             chmod(tmpDir.c_str(), 0755);
         }
@@ -2495,7 +2495,7 @@ bool DerivationGoal::pathFailed(const Path & path)
 
     if (!worker.store.hasPathFailed(path)) return false;
 
-    printMsg(lvlError, format("builder for `%1%' failed previously (cached)") % path);
+    printMsg(lvlError, format("builder for ‘%1%’ failed previously (cached)") % path);
 
     if (settings.printBuildTrace)
         printMsg(lvlError, format("@ build-failed %1% - cached") % drvPath);
@@ -2597,7 +2597,7 @@ SubstitutionGoal::SubstitutionGoal(const Path & storePath, Worker & worker, bool
 {
     this->storePath = storePath;
     state = &SubstitutionGoal::init;
-    name = (format("substitution of `%1%'") % storePath).str();
+    name = (format("substitution of ‘%1%’") % storePath).str();
     trace("created");
 }
 
@@ -2640,7 +2640,7 @@ void SubstitutionGoal::init()
     }
 
     if (settings.readOnlyMode)
-        throw Error(format("cannot substitute path `%1%' - no write access to the Nix store") % storePath);
+        throw Error(format("cannot substitute path ‘%1%’ - no write access to the Nix store") % storePath);
 
     subs = settings.substituters;
 
@@ -2655,7 +2655,7 @@ void SubstitutionGoal::tryNext()
     if (subs.size() == 0) {
         /* None left.  Terminate this goal and let someone else deal
            with it. */
-        debug(format("path `%1%' is required, but there is no substituter that can build it") % storePath);
+        debug(format("path ‘%1%’ is required, but there is no substituter that can build it") % storePath);
         /* Hack: don't indicate failure if there were no substituters.
            In that case the calling derivation should just do a
            build. */
@@ -2692,7 +2692,7 @@ void SubstitutionGoal::referencesValid()
     trace("all references realised");
 
     if (nrFailed > 0) {
-        debug(format("some references of path `%1%' could not be realised") % storePath);
+        debug(format("some references of path ‘%1%’ could not be realised") % storePath);
         amDone(nrNoSubstituters > 0 || nrIncompleteClosure > 0 ? ecIncompleteClosure : ecFailed);
         return;
     }
@@ -2724,7 +2724,7 @@ void SubstitutionGoal::tryToRun()
        first, but let's be defensive). */
     outputLock.reset(); // make sure this goal's lock is gone
     if (pathIsLockedByMe(storePath)) {
-        debug(format("restarting substitution of `%1%' because it's locked by another goal")
+        debug(format("restarting substitution of ‘%1%’ because it's locked by another goal")
             % storePath);
         worker.waitForAnyGoal(shared_from_this());
         return; /* restart in the tryToRun() state when another goal finishes */
@@ -2739,13 +2739,13 @@ void SubstitutionGoal::tryToRun()
 
     /* Check again whether the path is invalid. */
     if (!repair && worker.store.isValidPath(storePath)) {
-        debug(format("store path `%1%' has become valid") % storePath);
+        debug(format("store path ‘%1%’ has become valid") % storePath);
         outputLock->setDeletion(true);
         amDone(ecSuccess);
         return;
     }
 
-    printMsg(lvlInfo, format("fetching path `%1%'...") % storePath);
+    printMsg(lvlInfo, format("fetching path ‘%1%’...") % storePath);
 
     outPipe.create();
     logPipe.create();
@@ -2776,7 +2776,7 @@ void SubstitutionGoal::tryToRun()
 
         execv(sub.c_str(), (char * *) argArr);
 
-        throw SysError(format("executing `%1%'") % sub);
+        throw SysError(format("executing ‘%1%’") % sub);
     });
 
     pid.setSeparatePG(true);
@@ -2818,11 +2818,11 @@ void SubstitutionGoal::finished()
     try {
 
         if (!statusOk(status))
-            throw SubstError(format("fetching path `%1%' %2%")
+            throw SubstError(format("fetching path ‘%1%’ %2%")
                 % storePath % statusToString(status));
 
         if (!pathExists(destPath))
-            throw SubstError(format("substitute did not produce path `%1%'") % destPath);
+            throw SubstError(format("substitute did not produce path ‘%1%’") % destPath);
 
         hash = hashPath(htSHA256, destPath);
 
@@ -2833,11 +2833,11 @@ void SubstitutionGoal::finished()
                 throw Error(format("bad hash from substituter: %1%") % expectedHashStr);
             HashType hashType = parseHashType(string(expectedHashStr, 0, n));
             if (hashType == htUnknown)
-                throw Error(format("unknown hash algorithm in `%1%'") % expectedHashStr);
+                throw Error(format("unknown hash algorithm in ‘%1%’") % expectedHashStr);
             Hash expectedHash = parseHash16or32(hashType, string(expectedHashStr, n + 1));
             Hash actualHash = hashType == htSHA256 ? hash.first : hashPath(hashType, destPath).first;
             if (expectedHash != actualHash)
-                throw SubstError(format("hash mismatch in downloaded path `%1%': expected %2%, got %3%")
+                throw SubstError(format("hash mismatch in downloaded path ‘%1%’: expected %2%, got %3%")
                     % storePath % printHash(expectedHash) % printHash(actualHash));
         }
 
@@ -2876,7 +2876,7 @@ void SubstitutionGoal::finished()
     worker.store.markContentsGood(storePath);
 
     printMsg(lvlChatty,
-        format("substitution of path `%1%' succeeded") % storePath);
+        format("substitution of path ‘%1%’ succeeded") % storePath);
 
     if (settings.printBuildTrace)
         printMsg(lvlError, format("@ substituter-succeeded %1%") % storePath);
@@ -3101,7 +3101,7 @@ void Worker::run(const Goals & _topGoals)
             waitForInput();
         else {
             if (awake.empty() && settings.maxBuildJobs == 0) throw Error(
-                "unable to start any build; either increase `--max-jobs' "
+                "unable to start any build; either increase ‘--max-jobs’ "
                 "or enable distributed builds");
             assert(!awake.empty());
         }
@@ -3307,7 +3307,7 @@ void LocalStore::ensurePath(const Path & path)
     worker.run(goals);
 
     if (goal->getExitCode() != Goal::ecSuccess)
-        throw Error(format("path `%1%' does not exist and cannot be created") % path, worker.exitStatus());
+        throw Error(format("path ‘%1%’ does not exist and cannot be created") % path, worker.exitStatus());
 }
 
 
@@ -3320,7 +3320,7 @@ void LocalStore::repairPath(const Path & path)
     worker.run(goals);
 
     if (goal->getExitCode() != Goal::ecSuccess)
-        throw Error(format("cannot repair path `%1%'") % path, worker.exitStatus());
+        throw Error(format("cannot repair path ‘%1%’") % path, worker.exitStatus());
 }
 
 
diff --git a/src/libstore/derivations.cc b/src/libstore/derivations.cc
index b452aa2caf56..7234ae5630ed 100644
--- a/src/libstore/derivations.cc
+++ b/src/libstore/derivations.cc
@@ -20,7 +20,7 @@ void DerivationOutput::parseHashInfo(bool & recursive, HashType & hashType, Hash
 
     hashType = parseHashType(algo);
     if (hashType == htUnknown)
-        throw Error(format("unknown hash algorithm `%1%'") % algo);
+        throw Error(format("unknown hash algorithm ‘%1%’") % algo);
 
     hash = parseHash(hashType, this->hash);
 }
@@ -48,7 +48,7 @@ static Path parsePath(std::istream & str)
 {
     string s = parseString(str);
     if (s.size() == 0 || s[0] != '/')
-        throw FormatError(format("bad path `%1%' in derivation") % s);
+        throw FormatError(format("bad path ‘%1%’ in derivation") % s);
     return s;
 }
 
@@ -117,7 +117,7 @@ Derivation readDerivation(const Path & drvPath)
     try {
         return parseDerivation(readFile(drvPath));
     } catch (FormatError & e) {
-        throw Error(format("error parsing derivation `%1%': %2%") % drvPath % e.msg());
+        throw Error(format("error parsing derivation ‘%1%’: %2%") % drvPath % e.msg());
     }
 }
 
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc
index 74c2083904be..481f5a7c35a8 100644
--- a/src/libstore/gc.cc
+++ b/src/libstore/gc.cc
@@ -31,11 +31,11 @@ int LocalStore::openGCLock(LockType lockType)
     Path fnGCLock = (format("%1%/%2%")
         % settings.nixStateDir % 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, 0600);
     if (fdGCLock == -1)
-        throw SysError(format("opening global GC lock `%1%'") % fnGCLock);
+        throw SysError(format("opening global GC lock ‘%1%’") % fnGCLock);
     closeOnExec(fdGCLock);
 
     if (!lockFile(fdGCLock, lockType, false)) {
@@ -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 addPermRoot(StoreAPI & store, const Path & _storePath,
         /* Don't clobber the 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);
         store.addIndirectRoot(gcRoot);
     }
@@ -110,8 +110,8 @@ Path addPermRoot(StoreAPI & store, 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 addPermRoot(StoreAPI & store, const Path & _storePath,
         if (roots.find(gcRoot) == roots.end())
             printMsg(lvlError,
                 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);
     }
 
@@ -173,14 +173,14 @@ void LocalStore::addTempRoot(const Path & path)
 
             fdGCLock.close();
 
-            debug(format("acquiring read lock on `%1%'") % fnTempRoots);
+            debug(format("acquiring read lock on ‘%1%’") % fnTempRoots);
             lockFile(fdTempRoots, ltRead, true);
 
             /* Check whether the garbage collector didn't get in our
                way. */
             struct stat st;
             if (fstat(fdTempRoots, &st) == -1)
-                throw SysError(format("statting `%1%'") % fnTempRoots);
+                throw SysError(format("statting ‘%1%’") % fnTempRoots);
             if (st.st_size == 0) break;
 
             /* The garbage collector deleted this file before we could
@@ -192,14 +192,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%'") % fnTempRoots);
+    debug(format("acquiring write lock on ‘%1%’") % fnTempRoots);
     lockFile(fdTempRoots, ltWrite, true);
 
     string s = path + '\0';
     writeFull(fdTempRoots, (const unsigned char *) s.data(), s.size());
 
     /* Downgrade to a read lock. */
-    debug(format("downgrading to read lock on `%1%'") % fnTempRoots);
+    debug(format("downgrading to read lock on ‘%1%’") % fnTempRoots);
     lockFile(fdTempRoots, ltRead, true);
 }
 
@@ -239,12 +239,12 @@ static void readTempRoots(PathSet & tempRoots, FDs & fds)
     for (auto & i : tempRootFiles) {
         Path path = (format("%1%/%2%/%3%") % settings.nixStateDir % 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_RDWR, 0666)));
         if (*fd == -1) {
             /* 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. */
@@ -255,7 +255,7 @@ static void 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, ltWrite, false)) {
-            printMsg(lvlError, format("removing stale temporary roots file `%1%'") % path);
+            printMsg(lvlError, format("removing stale temporary roots file ‘%1%’") % path);
             unlink(path.c_str());
             writeFull(*fd, (const unsigned char *) "d", 1);
             continue;
@@ -264,7 +264,7 @@ static void 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, ltRead, true);
 
         /* Read the entire file. */
@@ -275,7 +275,7 @@ static void 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;
@@ -293,7 +293,7 @@ static void foundRoot(StoreAPI & store,
     if (store.isValidPath(storePath))
         roots[path] = storePath;
     else
-        printMsg(lvlInfo, format("skipping invalid root from `%1%' to `%2%'") % path % storePath);
+        printMsg(lvlInfo, format("skipping invalid root from ‘%1%’ to ‘%2%’") % path % storePath);
 }
 
 
@@ -323,7 +323,7 @@ static void findRoots(StoreAPI & store, const Path & path, unsigned char type, R
                 target = absPath(target, dirOf(path));
                 if (!pathExists(target)) {
                     if (isInDir(path, settings.nixStateDir + "/" + gcRootsDir + "/auto")) {
-                        printMsg(lvlInfo, format("removing stale link from `%1%' to `%2%'") % path % target);
+                        printMsg(lvlInfo, format("removing stale link from ‘%1%’ to ‘%2%’") % path % target);
                         unlink(path.c_str());
                     }
                 } else {
@@ -346,7 +346,7 @@ static void findRoots(StoreAPI & store, const Path & path, unsigned char type, R
     catch (SysError & e) {
         /* We only ignore permanent failures. */
         if (e.errNo == EACCES || e.errNo == ENOENT || e.errNo == ENOTDIR)
-            printMsg(lvlInfo, format("cannot read potential root `%1%'") % path);
+            printMsg(lvlInfo, format("cannot read potential root ‘%1%’") % path);
         else
             throw;
     }
@@ -373,7 +373,7 @@ static void addAdditionalRoots(StoreAPI & store, PathSet & roots)
 
     if (rootFinder.empty()) return;
 
-    debug(format("executing `%1%' to find additional roots") % rootFinder);
+    debug(format("executing ‘%1%’ to find additional roots") % rootFinder);
 
     string result = runProgram(rootFinder);
 
@@ -383,7 +383,7 @@ static void addAdditionalRoots(StoreAPI & store, PathSet & roots)
         if (isInStore(*i)) {
             Path path = toStorePath(*i);
             if (roots.find(path) == roots.end() && store.isValidPath(path)) {
-                debug(format("got additional root `%1%'") % path);
+                debug(format("got additional root ‘%1%’") % path);
                 roots.insert(path);
             }
         }
@@ -448,7 +448,7 @@ void LocalStore::deletePathRecursive(GCState & state, const Path & path)
         throw SysError(format("getting status of %1%") % path);
     }
 
-    printMsg(lvlInfo, format("deleting `%1%'") % path);
+    printMsg(lvlInfo, format("deleting ‘%1%’") % path);
 
     state.results.paths.insert(path);
 
@@ -463,10 +463,10 @@ void LocalStore::deletePathRecursive(GCState & state, const Path & path)
         // size.
         state.bytesInvalidated += size;
         if (chmod(path.c_str(), st.st_mode | S_IWUSR) == -1)
-            throw SysError(format("making `%1%' writable") % path);
+            throw SysError(format("making ‘%1%’ writable") % path);
         Path tmp = state.trashDir + "/" + baseNameOf(path);
         if (rename(path.c_str(), tmp.c_str()))
-            throw SysError(format("unable to rename `%1%' to `%2%'") % path % tmp);
+            throw SysError(format("unable to rename ‘%1%’ to ‘%2%’") % path % tmp);
     } else
         deleteGarbage(state, path);
 
@@ -490,7 +490,7 @@ bool LocalStore::canReachRoot(GCState & state, PathSet & visited, const Path & p
     }
 
     if (state.roots.find(path) != state.roots.end()) {
-        printMsg(lvlDebug, format("cannot delete `%1%' because it's a root") % path);
+        printMsg(lvlDebug, format("cannot delete ‘%1%’ because it's a root") % path);
         state.alive.insert(path);
         return true;
     }
@@ -538,7 +538,7 @@ void LocalStore::tryToDelete(GCState & state, const Path & path)
 
     if (path == linksDir || path == state.trashDir) return;
 
-    startNest(nest, lvlDebug, format("considering whether to delete `%1%'") % path);
+    startNest(nest, lvlDebug, format("considering whether to delete ‘%1%’") % path);
 
     if (!isValidPath(path)) {
         /* A lock file belonging to a path that we're building right
@@ -553,7 +553,7 @@ void LocalStore::tryToDelete(GCState & state, const Path & path)
     PathSet visited;
 
     if (canReachRoot(state, visited, path)) {
-        printMsg(lvlDebug, format("cannot delete `%1%' because it's still reachable") % path);
+        printMsg(lvlDebug, 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
@@ -574,7 +574,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;
 
@@ -587,7 +587,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;
@@ -596,17 +596,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 * 512;
     }
 
     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;
 
     printMsg(lvlInfo, format("note: currently hard linking saves %.2f MiB")
@@ -677,7 +677,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) {
@@ -690,7 +690,7 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
         try {
 
             AutoCloseDir dir = opendir(settings.nixStore.c_str());
-            if (!dir) throw SysError(format("opening directory `%1%'") % settings.nixStore);
+            if (!dir) throw SysError(format("opening directory ‘%1%’") % settings.nixStore);
 
             /* Read the store and immediately delete all paths that
                aren't valid.  When using --max-freed etc., deleting
@@ -743,7 +743,7 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
     fds.clear();
 
     /* Delete the trash directory. */
-    printMsg(lvlInfo, format("deleting `%1%'") % state.trashDir);
+    printMsg(lvlInfo, format("deleting ‘%1%’") % state.trashDir);
     deleteGarbage(state, state.trashDir);
 
     /* Clean up the links directory. */
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
index 23ece4a23369..b410cea2ee76 100644
--- a/src/libstore/globals.cc
+++ b/src/libstore/globals.cc
@@ -102,7 +102,7 @@ void Settings::loadConfFile()
         if (tokens.empty()) continue;
 
         if (tokens.size() < 2 || tokens[1] != "=")
-            throw Error(format("illegal configuration line `%1%' in `%2%'") % line % settingsFile);
+            throw Error(format("illegal configuration line ‘%1%’ in ‘%2%’") % line % settingsFile);
 
         string name = tokens[0];
 
@@ -198,7 +198,7 @@ void Settings::_get(bool & res, const string & name)
     if (i == settings.end()) return;
     if (i->second == "true") res = true;
     else if (i->second == "false") res = false;
-    else throw Error(format("configuration option `%1%' should be either `true' or `false', not `%2%'")
+    else throw Error(format("configuration option ‘%1%’ should be either ‘true’ or ‘false’, not ‘%2%’")
         % name % i->second);
 }
 
@@ -225,7 +225,7 @@ template<class N> void Settings::_get(N & res, const string & name)
     SettingsMap::iterator i = settings.find(name);
     if (i == settings.end()) return;
     if (!string2Int(i->second, res))
-        throw Error(format("configuration setting `%1%' should have an integer value") % name);
+        throw Error(format("configuration setting ‘%1%’ should have an integer value") % name);
 }
 
 
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index ab5b60132e3f..f91a0889250a 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -212,10 +212,10 @@ void checkStoreNotSymlink()
     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);
@@ -254,22 +254,22 @@ LocalStore::LocalStore(bool reserveSpace)
         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);
 
         struct group * gr = getgrnam(settings.buildUsersGroup.c_str());
         if (!gr)
-            throw Error(format("the group `%1%' specified in `build-users-group' does not exist")
+            throw Error(format("the group ‘%1%’ specified in ‘build-users-group’ does not exist")
                 % settings.buildUsersGroup);
 
         struct stat st;
         if (stat(settings.nixStore.c_str(), &st))
-            throw SysError(format("getting attributes of path `%1%'") % settings.nixStore);
+            throw SysError(format("getting attributes of path ‘%1%’") % settings.nixStore);
 
         if (st.st_uid != 0 || st.st_gid != gr->gr_gid || (st.st_mode & ~S_IFMT) != 01775) {
             if (chown(settings.nixStore.c_str(), 0, gr->gr_gid) == -1)
-                throw SysError(format("changing ownership of path `%1%'") % settings.nixStore);
+                throw SysError(format("changing ownership of path ‘%1%’") % settings.nixStore);
             if (chmod(settings.nixStore.c_str(), 01775) == -1)
-                throw SysError(format("changing permissions on path `%1%'") % settings.nixStore);
+                throw SysError(format("changing permissions on path ‘%1%’") % settings.nixStore);
         }
     }
 
@@ -372,7 +372,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;
 }
@@ -381,13 +381,13 @@ int LocalStore::getSchema()
 void LocalStore::openDB(bool create)
 {
     if (access(settings.nixDBPath.c_str(), R_OK | W_OK))
-        throw SysError(format("Nix database directory `%1%' is not writable") % settings.nixDBPath);
+        throw SysError(format("Nix database directory ‘%1%’ is not writable") % settings.nixDBPath);
 
     /* Open the Nix database. */
     string dbPath = settings.nixDBPath + "/db.sqlite";
     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);
 
     if (sqlite3_busy_timeout(db, 60 * 60 * 1000) != SQLITE_OK)
         throwSQLiteError(db, "setting timeout");
@@ -511,7 +511,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);
         }
 
     }
@@ -529,7 +529,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);
     }
 }
 
@@ -538,7 +538,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);
 }
 
@@ -549,7 +549,7 @@ static void canonicalisePathMetaData_(const Path & path, uid_t fromUid, InodesSe
 
     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.  This
        has already been checked in dumpPath(). */
@@ -564,7 +564,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;
@@ -588,7 +588,7 @@ static void canonicalisePathMetaData_(const Path & path, uid_t fromUid, InodesSe
         if (!S_ISLNK(st.st_mode) &&
             chown(path.c_str(), geteuid(), (gid_t) -1) == -1)
 #endif
-            throw SysError(format("changing owner of `%1%' to %2%")
+            throw SysError(format("changing owner of ‘%1%’ to %2%")
                 % path % geteuid());
     }
 
@@ -608,11 +608,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);
     }
 }
 
@@ -633,7 +633,7 @@ void LocalStore::checkDerivationOutputs(const Path & drvPath, const Derivation &
     if (isFixedOutputDrv(drv)) {
         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; HashType ht; Hash h;
         out->second.parseHashInfo(recursive, ht, h);
@@ -641,7 +641,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);
     }
 
@@ -658,7 +658,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);
         }
     }
@@ -680,7 +680,7 @@ unsigned long long LocalStore::addValidPath(const ValidPathInfo & info, bool che
     else
         stmtRegisterValidPath.bind(); // null
     if (sqlite3_step(stmtRegisterValidPath) != SQLITE_DONE)
-        throwSQLiteError(db, format("registering valid path `%1%' in database") % info.path);
+        throwSQLiteError(db, format("registering valid path ‘%1%’ in database") % info.path);
     unsigned long long id = sqlite3_last_insert_rowid(db);
 
     /* If this is a derivation, then store the derivation outputs in
@@ -703,7 +703,7 @@ unsigned long long LocalStore::addValidPath(const ValidPathInfo & info, bool che
             stmtAddDerivationOutput.bind(i->first);
             stmtAddDerivationOutput.bind(i->second.path);
             if (sqlite3_step(stmtAddDerivationOutput) != SQLITE_DONE)
-                throwSQLiteError(db, format("adding derivation output for `%1%' in database") % info.path);
+                throwSQLiteError(db, format("adding derivation output for ‘%1%’ in database") % info.path);
         }
     }
 
@@ -728,7 +728,7 @@ void LocalStore::registerFailedPath(const Path & path)
         stmtRegisterFailedPath.bind(path);
         stmtRegisterFailedPath.bind(time(0));
         if (sqlite3_step(stmtRegisterFailedPath) != SQLITE_DONE)
-            throwSQLiteError(db, format("registering failed path `%1%'") % path);
+            throwSQLiteError(db, format("registering failed path ‘%1%’") % path);
     } end_retry_sqlite;
 }
 
@@ -776,7 +776,7 @@ void LocalStore::clearFailedPaths(const PathSet & paths)
             SQLiteStmtUse use(stmtClearFailedPath);
             stmtClearFailedPath.bind(*i);
             if (sqlite3_step(stmtClearFailedPath) != SQLITE_DONE)
-                throwSQLiteError(db, format("clearing failed path `%1%' in database") % *i);
+                throwSQLiteError(db, format("clearing failed path ‘%1%’ in database") % *i);
         }
 
         txn.commit();
@@ -788,11 +788,11 @@ Hash parseHashField(const Path & path, const string & s)
 {
     string::size_type colon = s.find(':');
     if (colon == string::npos)
-        throw Error(format("corrupt hash `%1%' in valid-path entry for `%2%'")
+        throw Error(format("corrupt hash ‘%1%’ in valid-path entry for ‘%2%’")
             % s % path);
     HashType ht = parseHashType(string(s, 0, colon));
     if (ht == htUnknown)
-        throw Error(format("unknown hash type `%1%' in valid-path entry for `%2%'")
+        throw Error(format("unknown hash type ‘%1%’ in valid-path entry for ‘%2%’")
             % string(s, 0, colon) % path);
     return parseHash(ht, string(s, colon + 1));
 }
@@ -813,7 +813,7 @@ ValidPathInfo LocalStore::queryPathInfo(const Path & path)
         stmtQueryPathInfo.bind(path);
 
         int r = sqlite3_step(stmtQueryPathInfo);
-        if (r == SQLITE_DONE) throw Error(format("path `%1%' is not valid") % path);
+        if (r == SQLITE_DONE) throw Error(format("path ‘%1%’ is not valid") % path);
         if (r != SQLITE_ROW) throwSQLiteError(db, "querying path in database");
 
         info.id = sqlite3_column_int(stmtQueryPathInfo, 0);
@@ -842,7 +842,7 @@ ValidPathInfo LocalStore::queryPathInfo(const Path & path)
         }
 
         if (r != SQLITE_DONE)
-            throwSQLiteError(db, format("error getting references of `%1%'") % path);
+            throwSQLiteError(db, format("error getting references of ‘%1%’") % path);
 
         return info;
     } end_retry_sqlite;
@@ -861,7 +861,7 @@ void LocalStore::updatePathInfo(const ValidPathInfo & info)
     stmtUpdatePathInfo.bind("sha256:" + printHash(info.hash));
     stmtUpdatePathInfo.bind(info.path);
     if (sqlite3_step(stmtUpdatePathInfo) != SQLITE_DONE)
-        throwSQLiteError(db, format("updating info of path `%1%' in database") % info.path);
+        throwSQLiteError(db, format("updating info of path ‘%1%’ in database") % info.path);
 }
 
 
@@ -871,7 +871,7 @@ unsigned long long LocalStore::queryValidPathId(const Path & path)
     stmtQueryPathInfo.bind(path);
     int res = sqlite3_step(stmtQueryPathInfo);
     if (res == SQLITE_ROW) return sqlite3_column_int(stmtQueryPathInfo, 0);
-    if (res == SQLITE_DONE) throw Error(format("path `%1%' is not valid") % path);
+    if (res == SQLITE_DONE) throw Error(format("path ‘%1%’ is not valid") % path);
     throwSQLiteError(db, "querying path in database");
 }
 
@@ -950,7 +950,7 @@ void LocalStore::queryReferrers_(const Path & path, PathSet & referrers)
     }
 
     if (r != SQLITE_DONE)
-        throwSQLiteError(db, format("error getting references of `%1%'") % path);
+        throwSQLiteError(db, format("error getting references of ‘%1%’") % path);
 }
 
 
@@ -986,7 +986,7 @@ PathSet LocalStore::queryValidDerivers(const Path & path)
         }
 
         if (r != SQLITE_DONE)
-            throwSQLiteError(db, format("error getting valid derivers of `%1%'") % path);
+            throwSQLiteError(db, format("error getting valid derivers of ‘%1%’") % path);
 
         return derivers;
     } end_retry_sqlite;
@@ -1008,7 +1008,7 @@ PathSet LocalStore::queryDerivationOutputs(const Path & path)
         }
 
         if (r != SQLITE_DONE)
-            throwSQLiteError(db, format("error getting outputs of `%1%'") % path);
+            throwSQLiteError(db, format("error getting outputs of ‘%1%’") % path);
 
         return outputs;
     } end_retry_sqlite;
@@ -1030,7 +1030,7 @@ StringSet LocalStore::queryDerivationOutputNames(const Path & path)
         }
 
         if (r != SQLITE_DONE)
-            throwSQLiteError(db, format("error getting output names of `%1%'") % path);
+            throwSQLiteError(db, format("error getting output names of ‘%1%’") % path);
 
         return outputNames;
     } end_retry_sqlite;
@@ -1073,7 +1073,7 @@ void LocalStore::startSubstituter(const Path & substituter, RunningSubstituter &
 {
     if (run.disabled || run.pid != -1) return;
 
-    debug(format("starting substituter program `%1%'") % substituter);
+    debug(format("starting substituter program ‘%1%’") % substituter);
 
     Pipe toPipe, fromPipe, errorPipe;
 
@@ -1091,7 +1091,7 @@ void LocalStore::startSubstituter(const Path & substituter, RunningSubstituter &
         if (dup2(errorPipe.writeSide, STDERR_FILENO) == -1)
             throw SysError("dupping stderr");
         execl(substituter.c_str(), substituter.c_str(), "--query", NULL);
-        throw SysError(format("executing `%1%'") % substituter);
+        throw SysError(format("executing ‘%1%’") % substituter);
     });
 
     run.program = baseNameOf(substituter);
@@ -1150,7 +1150,7 @@ string LocalStore::getLineFromSubstituter(RunningSubstituter & run)
                 if (errno == EINTR) continue;
                 throw SysError("reading from substituter's stderr");
             }
-            if (n == 0) throw EndOfFile(format("substituter `%1%' died unexpectedly") % run.program);
+            if (n == 0) throw EndOfFile(format("substituter ‘%1%’ died unexpectedly") % run.program);
             err.append(buf, n);
             string::size_type p;
             while ((p = err.find('\n')) != string::npos) {
@@ -1227,7 +1227,7 @@ void LocalStore::querySubstitutablePathInfos(const Path & substituter,
         Path path = getLineFromSubstituter(run);
         if (path == "") break;
         if (paths.find(path) == paths.end())
-            throw Error(format("got unexpected path `%1%' from substituter") % path);
+            throw Error(format("got unexpected path ‘%1%’ from substituter") % path);
         paths.erase(path);
         SubstitutablePathInfo & info(infos[path]);
         info.deriver = getLineFromSubstituter(run);
@@ -1321,7 +1321,7 @@ void LocalStore::registerValidPaths(const ValidPathInfos & infos)
    there are no referrers. */
 void LocalStore::invalidatePath(const Path & path)
 {
-    debug(format("invalidating path `%1%'") % path);
+    debug(format("invalidating path ‘%1%’") % path);
 
     drvHashes.erase(path);
 
@@ -1330,7 +1330,7 @@ void LocalStore::invalidatePath(const Path & path)
     stmtInvalidatePath.bind(path);
 
     if (sqlite3_step(stmtInvalidatePath) != SQLITE_DONE)
-        throwSQLiteError(db, format("invalidating path `%1%' in database") % path);
+        throwSQLiteError(db, format("invalidating path ‘%1%’ in database") % path);
 
     /* Note that the foreign key constraints on the Refs table take
        care of deleting the references entries for `path'. */
@@ -1396,7 +1396,7 @@ Path LocalStore::addToStore(const Path & _srcPath,
     bool recursive, HashType hashAlgo, PathFilter & filter, bool repair)
 {
     Path srcPath(absPath(_srcPath));
-    debug(format("adding `%1%' to the store") % srcPath);
+    debug(format("adding ‘%1%’ to the store") % srcPath);
 
     /* Read the whole path into memory. This is not a very scalable
        method for very large paths, but `copyPath' is mainly used for
@@ -1475,9 +1475,9 @@ static void checkSecrecy(const Path & path)
 {
     struct stat st;
     if (stat(path.c_str(), &st))
-        throw SysError(format("getting status of `%1%'") % path);
+        throw SysError(format("getting status of ‘%1%’") % path);
     if ((st.st_mode & (S_IRWXG | S_IRWXO)) != 0)
-        throw Error(format("file `%1%' should be secret (inaccessible to everybody else)!") % path);
+        throw Error(format("file ‘%1%’ should be secret (inaccessible to everybody else)!") % path);
 }
 
 
@@ -1486,10 +1486,10 @@ void LocalStore::exportPath(const Path & path, bool sign,
 {
     assertStorePath(path);
 
-    printMsg(lvlInfo, format("exporting path `%1%'") % path);
+    printMsg(lvlInfo, format("exporting path ‘%1%’") % path);
 
     if (!isValidPath(path))
-        throw Error(format("path `%1%' is not valid") % path);
+        throw Error(format("path ‘%1%’ is not valid") % path);
 
     HashAndWriteSink hashAndWriteSink(sink);
 
@@ -1501,7 +1501,7 @@ void LocalStore::exportPath(const Path & path, bool sign,
     Hash hash = hashAndWriteSink.currentHash();
     Hash storedHash = queryPathHash(path);
     if (hash != storedHash && storedHash != Hash(storedHash.type))
-        throw Error(format("hash of path `%1%' has changed from `%2%' to `%3%'!") % path
+        throw Error(format("hash of path ‘%1%’ has changed from ‘%2%’ to ‘%3%’!") % path
             % printHash(storedHash) % printHash(hash));
 
     writeInt(EXPORT_MAGIC, hashAndWriteSink);
@@ -1608,7 +1608,7 @@ Path LocalStore::importPath(bool requireSignature, Source & source)
     bool haveSignature = readInt(hashAndReadSource) == 1;
 
     if (requireSignature && !haveSignature)
-        throw Error(format("imported archive of `%1%' lacks a signature") % dstPath);
+        throw Error(format("imported archive of ‘%1%’ lacks a signature") % dstPath);
 
     if (haveSignature) {
         string signature = readString(hashAndReadSource);
@@ -1659,7 +1659,7 @@ Path LocalStore::importPath(bool requireSignature, Source & source)
             if (pathExists(dstPath)) deletePath(dstPath);
 
             if (rename(unpacked.c_str(), dstPath.c_str()) == -1)
-                throw SysError(format("cannot move `%1%' to `%2%'")
+                throw SysError(format("cannot move ‘%1%’ to ‘%2%’")
                     % unpacked % dstPath);
 
             canonicalisePathMetaData(dstPath, -1);
@@ -1692,7 +1692,7 @@ Paths LocalStore::importPaths(bool requireSignature, Source & source)
     while (true) {
         unsigned long long n = readLongLong(source);
         if (n == 0) break;
-        if (n != 1) throw Error("input doesn't look like something created by `nix-store --export'");
+        if (n != 1) throw Error("input doesn't look like something created by ‘nix-store --export’");
         res.push_back(importPath(requireSignature, source));
     }
     return res;
@@ -1710,7 +1710,7 @@ void LocalStore::invalidatePathChecked(const Path & path)
             PathSet referrers; queryReferrers_(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(path);
         }
@@ -1755,12 +1755,12 @@ bool LocalStore::verifyStore(bool checkContents, bool repair)
                 ValidPathInfo info = 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.hash.type, *i);
 
                 if (info.hash != nullHash && info.hash != current.first) {
-                    printMsg(lvlError, format("path `%1%' was modified! "
-                            "expected hash `%2%', got `%3%'")
+                    printMsg(lvlError, format("path ‘%1%’ was modified! "
+                            "expected hash ‘%2%’, got ‘%3%’")
                         % *i % printHash(info.hash) % printHash(current.first));
                     if (repair) repairPath(*i); else errors = true;
                 } else {
@@ -1769,14 +1769,14 @@ bool LocalStore::verifyStore(bool checkContents, bool repair)
 
                     /* Fill in missing hashes. */
                     if (info.hash == nullHash) {
-                        printMsg(lvlError, format("fixing missing hash on `%1%'") % *i);
+                        printMsg(lvlError, format("fixing missing hash on ‘%1%’") % *i);
                         info.hash = current.first;
                         update = true;
                     }
 
                     /* Fill in missing narSize fields (from old stores). */
                     if (info.narSize == 0) {
-                        printMsg(lvlError, format("updating size field on `%1%' to %2%") % *i % current.second);
+                        printMsg(lvlError, format("updating size field on ‘%1%’ to %2%") % *i % current.second);
                         info.narSize = current.second;
                         update = true;
                     }
@@ -1810,7 +1810,7 @@ void LocalStore::verifyPath(const Path & path, const PathSet & store,
     done.insert(path);
 
     if (!isStorePath(path)) {
-        printMsg(lvlError, format("path `%1%' is not in the Nix store") % path);
+        printMsg(lvlError, format("path ‘%1%’ is not in the Nix store") % path);
         invalidatePath(path);
         return;
     }
@@ -1828,10 +1828,10 @@ void LocalStore::verifyPath(const Path & path, const PathSet & store,
             }
 
         if (canInvalidate) {
-            printMsg(lvlError, format("path `%1%' disappeared, removing from database...") % path);
+            printMsg(lvlError, format("path ‘%1%’ disappeared, removing from database...") % path);
             invalidatePath(path);
         } else {
-            printMsg(lvlError, format("path `%1%' disappeared, but it still has valid referrers!") % path);
+            printMsg(lvlError, format("path ‘%1%’ disappeared, but it still has valid referrers!") % path);
             if (repair)
                 try {
                     repairPath(path);
@@ -1853,7 +1853,7 @@ bool LocalStore::pathContentsGood(const Path & path)
 {
     std::map<Path, bool>::iterator i = pathContentsGoodCache.find(path);
     if (i != pathContentsGoodCache.end()) return i->second;
-    printMsg(lvlInfo, format("checking path `%1%'...") % path);
+    printMsg(lvlInfo, format("checking path ‘%1%’...") % path);
     ValidPathInfo info = queryPathInfo(path);
     bool res;
     if (!pathExists(path))
@@ -1864,7 +1864,7 @@ bool LocalStore::pathContentsGood(const Path & path)
         res = info.hash == nullHash || info.hash == current.first;
     }
     pathContentsGoodCache[path] = res;
-    if (!res) printMsg(lvlError, format("path `%1%' is corrupted or missing!") % path);
+    if (!res) printMsg(lvlError, format("path ‘%1%’ is corrupted or missing!") % path);
     return res;
 }
 
@@ -1895,7 +1895,7 @@ ValidPathInfo LocalStore::queryPathInfoOld(const Path & path)
     string baseName = baseNameOf(path);
     Path infoFile = (format("%1%/info/%2%") % settings.nixDBPath % baseName).str();
     if (!pathExists(infoFile))
-        throw Error(format("path `%1%' is not valid") % path);
+        throw Error(format("path ‘%1%’ is not valid") % path);
     string info = readFile(infoFile);
 
     /* Parse it. */
@@ -1904,7 +1904,7 @@ ValidPathInfo LocalStore::queryPathInfoOld(const Path & path)
     foreach (Strings::iterator, i, lines) {
         string::size_type p = i->find(':');
         if (p == string::npos)
-            throw Error(format("corrupt line in `%1%': %2%") % infoFile % *i);
+            throw Error(format("corrupt line in ‘%1%’: %2%") % infoFile % *i);
         string name(*i, 0, p);
         string value(*i, p + 2);
         if (name == "References") {
@@ -1978,7 +1978,7 @@ static void makeMutable(const Path & path)
     AutoCloseFD fd = open(path.c_str(), O_RDONLY | O_NOFOLLOW);
     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;
diff --git a/src/libstore/misc.cc b/src/libstore/misc.cc
index 6ecf8787cf61..2facda81583d 100644
--- a/src/libstore/misc.cc
+++ b/src/libstore/misc.cc
@@ -63,7 +63,7 @@ Path findOutput(const Derivation & drv, string id)
 {
     foreach (DerivationOutputs::const_iterator, i, drv.outputs)
         if (i->first == id) return i->second.path;
-    throw Error(format("derivation has no output `%1%'") % id);
+    throw Error(format("derivation has no output ‘%1%’") % id);
 }
 
 
@@ -186,7 +186,7 @@ static void dfsVisit(StoreAPI & store, const PathSet & paths,
     PathSet & parents)
 {
     if (parents.find(path) != parents.end())
-        throw BuildError(format("cycle detected in the references of `%1%'") % path);
+        throw BuildError(format("cycle detected in the references of ‘%1%’") % path);
 
     if (visited.find(path) != visited.end()) return;
     visited.insert(path);
diff --git a/src/libstore/optimise-store.cc b/src/libstore/optimise-store.cc
index 67ee94a4bdea..208d9688ed98 100644
--- a/src/libstore/optimise-store.cc
+++ b/src/libstore/optimise-store.cc
@@ -18,9 +18,9 @@ static void makeWritable(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);
     if (chmod(path.c_str(), st.st_mode | S_IWUSR) == -1)
-        throw SysError(format("changing writability of `%1%'") % path);
+        throw SysError(format("changing writability of ‘%1%’") % path);
 }
 
 
@@ -46,7 +46,7 @@ LocalStore::InodeHash LocalStore::loadInodeHash()
     InodeHash inodeHash;
 
     AutoCloseDir dir = opendir(linksDir.c_str());
-    if (!dir) throw SysError(format("opening directory `%1%'") % linksDir);
+    if (!dir) throw SysError(format("opening directory ‘%1%’") % linksDir);
 
     struct dirent * dirent;
     while (errno = 0, dirent = readdir(dir)) { /* sic */
@@ -54,7 +54,7 @@ LocalStore::InodeHash LocalStore::loadInodeHash()
         // We don't care if we hit non-hash files, anything goes
         inodeHash.insert(dirent->d_ino);
     }
-    if (errno) throw SysError(format("reading directory `%1%'") % linksDir);
+    if (errno) throw SysError(format("reading directory ‘%1%’") % linksDir);
 
     printMsg(lvlTalkative, format("loaded %1% hash inodes") % inodeHash.size());
 
@@ -67,14 +67,14 @@ Strings LocalStore::readDirectoryIgnoringInodes(const Path & path, const InodeHa
     Strings names;
 
     AutoCloseDir dir = opendir(path.c_str());
-    if (!dir) throw SysError(format("opening directory `%1%'") % path);
+    if (!dir) throw SysError(format("opening directory ‘%1%’") % path);
 
     struct dirent * dirent;
     while (errno = 0, dirent = readdir(dir)) { /* sic */
         checkInterrupt();
 
         if (inodeHash.count(dirent->d_ino)) {
-            printMsg(lvlDebug, format("`%1%' is already linked") % dirent->d_name);
+            printMsg(lvlDebug, format("‘%1%’ is already linked") % dirent->d_name);
             continue;
         }
 
@@ -82,7 +82,7 @@ Strings LocalStore::readDirectoryIgnoringInodes(const Path & path, const InodeHa
         if (name == "." || name == "..") continue;
         names.push_back(name);
     }
-    if (errno) throw SysError(format("reading directory `%1%'") % path);
+    if (errno) throw SysError(format("reading directory ‘%1%’") % path);
 
     return names;
 }
@@ -94,7 +94,7 @@ void LocalStore::optimisePath_(OptimiseStats & stats, const Path & path, InodeHa
 
     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 (S_ISDIR(st.st_mode)) {
         Strings names = readDirectoryIgnoringInodes(path, inodeHash);
@@ -115,13 +115,13 @@ void LocalStore::optimisePath_(OptimiseStats & stats, const Path & path, InodeHa
        NixOS (example: $fontconfig/var/cache being modified).  Skip
        those files.  FIXME: check the modification time. */
     if (S_ISREG(st.st_mode) && (st.st_mode & S_IWUSR)) {
-        printMsg(lvlError, format("skipping suspicious writable file `%1%'") % path);
+        printMsg(lvlError, format("skipping suspicious writable file ‘%1%’") % path);
         return;
     }
 
     /* This can still happen on top-level files */
     if (st.st_nlink > 1 && inodeHash.count(st.st_ino)) {
-        printMsg(lvlDebug, format("`%1%' is already linked, with %2% other file(s).") % path % (st.st_nlink - 2));
+        printMsg(lvlDebug, format("‘%1%’ is already linked, with %2% other file(s).") % path % (st.st_nlink - 2));
         return;
     }
 
@@ -135,7 +135,7 @@ void LocalStore::optimisePath_(OptimiseStats & stats, const Path & path, InodeHa
        contents of the symlink (i.e. the result of readlink()), not
        the contents of the target (which may not even exist). */
     Hash hash = hashPath(htSHA256, path).first;
-    printMsg(lvlDebug, format("`%1%' has hash `%2%'") % path % printHash(hash));
+    printMsg(lvlDebug, format("‘%1%’ has hash ‘%2%’") % path % printHash(hash));
 
     /* Check if this is a known hash. */
     Path linkPath = linksDir + "/" + printHash32(hash);
@@ -147,7 +147,7 @@ void LocalStore::optimisePath_(OptimiseStats & stats, const Path & path, InodeHa
             return;
         }
         if (errno != EEXIST)
-            throw SysError(format("cannot link `%1%' to `%2%'") % linkPath % path);
+            throw SysError(format("cannot link ‘%1%’ to ‘%2%’") % linkPath % path);
         /* Fall through if another process created ‘linkPath’ before
            we did. */
     }
@@ -156,14 +156,14 @@ void LocalStore::optimisePath_(OptimiseStats & stats, const Path & path, InodeHa
        current file with a hard link to that file. */
     struct stat stLink;
     if (lstat(linkPath.c_str(), &stLink))
-        throw SysError(format("getting attributes of path `%1%'") % linkPath);
+        throw SysError(format("getting attributes of path ‘%1%’") % linkPath);
 
     if (st.st_ino == stLink.st_ino) {
-        printMsg(lvlDebug, format("`%1%' is already linked to `%2%'") % path % linkPath);
+        printMsg(lvlDebug, format("‘%1%’ is already linked to ‘%2%’") % path % linkPath);
         return;
     }
 
-    printMsg(lvlTalkative, format("linking `%1%' to `%2%'") % path % linkPath);
+    printMsg(lvlTalkative, format("linking ‘%1%’ to ‘%2%’") % path % linkPath);
 
     /* Make the containing directory writable, but only if it's not
        the store itself (we don't want or need to mess with its
@@ -184,26 +184,26 @@ void LocalStore::optimisePath_(OptimiseStats & stats, const Path & path, InodeHa
                systems).  This is likely to happen with empty files.
                Just shrug and ignore. */
             if (st.st_size)
-                printMsg(lvlInfo, format("`%1%' has maximum number of links") % linkPath);
+                printMsg(lvlInfo, format("‘%1%’ has maximum number of links") % linkPath);
             return;
         }
-        throw SysError(format("cannot link `%1%' to `%2%'") % tempLink % linkPath);
+        throw SysError(format("cannot link ‘%1%’ to ‘%2%’") % tempLink % linkPath);
     }
 
     /* Atomically replace the old file with the new hard link. */
     if (rename(tempLink.c_str(), path.c_str()) == -1) {
         if (unlink(tempLink.c_str()) == -1)
-            printMsg(lvlError, format("unable to unlink `%1%'") % tempLink);
+            printMsg(lvlError, format("unable to unlink ‘%1%’") % tempLink);
         if (errno == EMLINK) {
             /* Some filesystems generate too many links on the rename,
                rather than on the original link.  (Probably it
                temporarily increases the st_nlink field before
                decreasing it again.) */
             if (st.st_size)
-                printMsg(lvlInfo, format("`%1%' has maximum number of links") % linkPath);
+                printMsg(lvlInfo, format("‘%1%’ has maximum number of links") % linkPath);
             return;
         }
-        throw SysError(format("cannot rename `%1%' to `%2%'") % tempLink % path);
+        throw SysError(format("cannot rename ‘%1%’ to ‘%2%’") % tempLink % path);
     }
 
     stats.filesLinked++;
@@ -220,7 +220,7 @@ void LocalStore::optimiseStore(OptimiseStats & stats)
     foreach (PathSet::iterator, i, paths) {
         addTempRoot(*i);
         if (!isValidPath(*i)) continue; /* path was GC'ed, probably */
-        startNest(nest, lvlChatty, format("hashing files in `%1%'") % *i);
+        startNest(nest, lvlChatty, format("hashing files in ‘%1%’") % *i);
         optimisePath_(stats, *i, inodeHash);
     }
 }
diff --git a/src/libstore/pathlocks.cc b/src/libstore/pathlocks.cc
index b858ed238de0..f26684afacb9 100644
--- a/src/libstore/pathlocks.cc
+++ b/src/libstore/pathlocks.cc
@@ -18,7 +18,7 @@ int openLockFile(const Path & path, bool create)
 
     fd = open(path.c_str(), O_RDWR | (create ? O_CREAT : 0), 0600);
     if (fd == -1 && (create || errno != ENOENT))
-        throw SysError(format("opening lock file `%1%'") % path);
+        throw SysError(format("opening lock file ‘%1%’") % path);
 
     closeOnExec(fd);
 
@@ -109,7 +109,7 @@ bool PathLocks::lockPaths(const PathSet & _paths,
         Path path = *i;
         Path lockPath = path + ".lock";
 
-        debug(format("locking path `%1%'") % path);
+        debug(format("locking path ‘%1%’") % path);
 
         if (lockedPaths.find(lockPath) != lockedPaths.end())
             throw Error("deadlock: trying to re-acquire self-held lock");
@@ -134,19 +134,19 @@ bool PathLocks::lockPaths(const PathSet & _paths,
                 }
             }
 
-            debug(format("lock acquired on `%1%'") % lockPath);
+            debug(format("lock acquired on ‘%1%’") % lockPath);
 
             /* Check that the lock file hasn't become stale (i.e.,
                hasn't been unlinked). */
             struct stat st;
             if (fstat(fd, &st) == -1)
-                throw SysError(format("statting lock file `%1%'") % lockPath);
+                throw SysError(format("statting lock file ‘%1%’") % lockPath);
             if (st.st_size != 0)
                 /* This lock file has been unlinked, so we're holding
                    a lock on a deleted file.  This means that other
                    processes may create and acquire a lock on
                    `lockPath', and proceed.  So we must retry. */
-                debug(format("open lock file `%1%' has become stale") % lockPath);
+                debug(format("open lock file ‘%1%’ has become stale") % lockPath);
             else
                 break;
         }
@@ -174,9 +174,9 @@ void PathLocks::unlock()
         lockedPaths.erase(i->second);
         if (close(i->first) == -1)
             printMsg(lvlError,
-                format("error (ignored): cannot close lock file on `%1%'") % i->second);
+                format("error (ignored): cannot close lock file on ‘%1%’") % i->second);
 
-        debug(format("lock released on `%1%'") % i->second);
+        debug(format("lock released on ‘%1%’") % i->second);
     }
 
     fds.clear();
diff --git a/src/libstore/references.cc b/src/libstore/references.cc
index 282b848938b3..521244a31377 100644
--- a/src/libstore/references.cc
+++ b/src/libstore/references.cc
@@ -37,7 +37,7 @@ static void search(const unsigned char * s, unsigned int len,
         if (!match) continue;
         string ref((const char *) s + i, refLength);
         if (hashes.find(ref) != hashes.end()) {
-            debug(format("found reference to `%1%' at offset `%2%'")
+            debug(format("found reference to ‘%1%’ at offset ‘%2%’")
                   % ref % i);
             seen.insert(ref);
             hashes.erase(ref);
@@ -93,7 +93,7 @@ PathSet scanForReferences(const string & path,
         string baseName = baseNameOf(*i);
         string::size_type pos = baseName.find('-');
         if (pos == string::npos)
-            throw Error(format("bad reference `%1%'") % *i);
+            throw Error(format("bad reference ‘%1%’") % *i);
         string s = string(baseName, 0, pos);
         assert(s.size() == refLength);
         assert(backMap.find(s) == backMap.end());
diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc
index 7c51f395aae2..8ef673783ec5 100644
--- a/src/libstore/remote-store.cc
+++ b/src/libstore/remote-store.cc
@@ -55,7 +55,7 @@ void RemoteStore::openConnection(bool reserveSpace)
            us. */
         connectToDaemon();
     else
-        throw Error(format("invalid setting for NIX_REMOTE, `%1%'") % remoteMode);
+        throw Error(format("invalid setting for NIX_REMOTE, ‘%1%’") % remoteMode);
 
     from.fd = fdSocket;
     to.fd = fdSocket;
@@ -116,12 +116,12 @@ void RemoteStore::connectToDaemon()
     struct sockaddr_un addr;
     addr.sun_family = AF_UNIX;
     if (socketPathRel.size() >= sizeof(addr.sun_path))
-        throw Error(format("socket path `%1%' is too long") % socketPathRel);
+        throw Error(format("socket path ‘%1%’ is too long") % socketPathRel);
     using namespace std;
     strcpy(addr.sun_path, socketPathRel.c_str());
 
     if (connect(fdSocket, (struct sockaddr *) &addr, sizeof(addr)) == -1)
-        throw SysError(format("cannot connect to daemon at `%1%'") % socketPath);
+        throw SysError(format("cannot connect to daemon at ‘%1%’") % socketPath);
 
     if (fchdir(fdPrevDir) == -1)
         throw SysError("couldn't change back to previous directory");
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc
index 0238e5b0b692..d3cbd1e7dee2 100644
--- a/src/libstore/store-api.cc
+++ b/src/libstore/store-api.cc
@@ -32,14 +32,14 @@ bool isStorePath(const Path & path)
 void assertStorePath(const Path & path)
 {
     if (!isStorePath(path))
-        throw Error(format("path `%1%' is not in the Nix store") % path);
+        throw Error(format("path ‘%1%’ is not in the Nix store") % path);
 }
 
 
 Path toStorePath(const Path & path)
 {
     if (!isInStore(path))
-        throw Error(format("path `%1%' is not in the Nix store") % path);
+        throw Error(format("path ‘%1%’ is not in the Nix store") % path);
     Path::size_type slash = path.find('/', settings.nixStore.size() + 1);
     if (slash == Path::npos)
         return path;
@@ -57,7 +57,7 @@ Path followLinksToStore(const Path & _path)
         path = absPath(target, dirOf(path));
     }
     if (!isInStore(path))
-        throw Error(format("path `%1%' is not in the Nix store") % path);
+        throw Error(format("path ‘%1%’ is not in the Nix store") % path);
     return path;
 }
 
@@ -81,14 +81,14 @@ void checkStoreName(const string & name)
     /* Disallow names starting with a dot for possible security
        reasons (e.g., "." and ".."). */
     if (string(name, 0, 1) == ".")
-        throw Error(format("illegal name: `%1%'") % name);
+        throw Error(format("illegal name: ‘%1%’") % name);
     foreach (string::const_iterator, i, name)
         if (!((*i >= 'A' && *i <= 'Z') ||
               (*i >= 'a' && *i <= 'z') ||
               (*i >= '0' && *i <= '9') ||
               validChars.find(*i) != string::npos))
         {
-            throw Error(format("invalid character `%1%' in name `%2%'")
+            throw Error(format("invalid character ‘%1%’ in name ‘%2%’")
                 % *i % name);
         }
 }
@@ -288,7 +288,7 @@ string showPaths(const PathSet & paths)
     string s;
     foreach (PathSet::const_iterator, i, paths) {
         if (s.size() != 0) s += ", ";
-        s += "`" + *i + "'";
+        s += "‘" + *i + "’";
     }
     return s;
 }