diff options
author | Jörg Thalheim <joerg@thalheim.io> | 2017-07-30 12:27:57 +0100 |
---|---|---|
committer | Jörg Thalheim <joerg@thalheim.io> | 2017-07-30 12:32:45 +0100 |
commit | 2fd8f8bb99a2832b3684878c020ba47322e79332 (patch) | |
tree | 65a667fbc746f4ff8efcaca3c0a58565985f26a5 /src/libstore/optimise-store.cc | |
parent | c7654bc491d9ce7c1fbadecd7769418fa79a2060 (diff) |
Replace Unicode quotes in user-facing strings by ASCII
Relevant RFC: NixOS/rfcs#4
$ ag -l | xargs sed -i -e "/\"/s/’/'/g;/\"/s/‘/'/g"
Diffstat (limited to 'src/libstore/optimise-store.cc')
-rw-r--r-- | src/libstore/optimise-store.cc | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/libstore/optimise-store.cc b/src/libstore/optimise-store.cc index 8e8002a30..4461fc6dd 100644 --- a/src/libstore/optimise-store.cc +++ b/src/libstore/optimise-store.cc @@ -19,9 +19,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); } @@ -47,7 +47,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.get())) { /* sic */ @@ -55,7 +55,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()); @@ -68,14 +68,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.get())) { /* sic */ checkInterrupt(); if (inodeHash.count(dirent->d_ino)) { - debug(format("‘%1%’ is already linked") % dirent->d_name); + debug(format("'%1%' is already linked") % dirent->d_name); continue; } @@ -83,7 +83,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; } @@ -95,7 +95,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 __APPLE__ /* HFS/OS X has some undocumented security feature disabling hardlinking for @@ -105,7 +105,7 @@ void LocalStore::optimisePath_(OptimiseStats & stats, const Path & path, InodeHa if (std::regex_search(path, std::regex("\\.app/Contents/PkgInfo$")) || std::regex_search(path, std::regex("\\.app/Contents/Resources/.+\\.lproj$"))) { - debug(format("‘%1%’ is not allowed to be linked in OS X") % path); + debug(format("'%1%' is not allowed to be linked in OS X") % path); return; } #endif @@ -129,13 +129,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)) { - printError(format("skipping suspicious writable file ‘%1%’") % path); + printError(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)) { - debug(format("‘%1%’ is already linked, with %2% other file(s)") % path % (st.st_nlink - 2)); + debug(format("'%1%' is already linked, with %2% other file(s)") % path % (st.st_nlink - 2)); return; } @@ -149,7 +149,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; - debug(format("‘%1%’ has hash ‘%2%’") % path % hash.to_string()); + debug(format("'%1%' has hash '%2%'") % path % hash.to_string()); /* Check if this is a known hash. */ Path linkPath = linksDir + "/" + hash.to_string(Base32, false); @@ -173,11 +173,11 @@ void LocalStore::optimisePath_(OptimiseStats & stats, const Path & path, InodeHa full. When that happens, it's fine to ignore it: we just effectively disable deduplication of this file. */ - printInfo("cannot link ‘%s’ to ‘%s’: %s", linkPath, path, strerror(errno)); + printInfo("cannot link '%s' to '%s': %s", linkPath, path, strerror(errno)); return; default: - throw SysError("cannot link ‘%1%’ to ‘%2%’", linkPath, path); + throw SysError("cannot link '%1%' to '%2%'", linkPath, path); } } @@ -185,20 +185,20 @@ 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) { - debug(format("‘%1%’ is already linked to ‘%2%’") % path % linkPath); + debug(format("'%1%' is already linked to '%2%'") % path % linkPath); return; } if (st.st_size != stLink.st_size) { - printError(format("removing corrupted link ‘%1%’") % linkPath); + printError(format("removing corrupted link '%1%'") % linkPath); unlink(linkPath.c_str()); goto retry; } - 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 @@ -219,25 +219,25 @@ 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) - printInfo(format("‘%1%’ has maximum number of links") % linkPath); + printInfo(format("'%1%' has maximum number of links") % linkPath); return; } - throw SysError("cannot link ‘%1%’ to ‘%2%’", tempLink, linkPath); + throw SysError("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) - printError(format("unable to unlink ‘%1%’") % tempLink); + printError(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.) */ - debug("‘%s’ has reached maximum number of links", linkPath); + debug("'%s' has reached 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++; @@ -254,7 +254,7 @@ void LocalStore::optimiseStore(OptimiseStats & stats) for (auto & i : paths) { addTempRoot(i); if (!isValidPath(i)) continue; /* path was GC'ed, probably */ - //Activity act(*logger, lvlChatty, format("hashing files in ‘%1%’") % i); + //Activity act(*logger, lvlChatty, format("hashing files in '%1%'") % i); optimisePath_(stats, realStoreDir + "/" + baseNameOf(i), inodeHash); } } |