mirror of
https://github.com/NixOS/nix.git
synced 2025-11-17 16:02:43 +01:00
Use proper quotes everywhere
This commit is contained in:
parent
373fad75e1
commit
11849a320e
54 changed files with 548 additions and 543 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue