daemon: Use unbranded phrases in comments and messages.
* nix/libstore/build.cc, nix/libstore/globals.cc, nix/libstore/gc.cc, nix/libstore/local-store.cc, nix/libstore/optimise-store.cc, nix/libstore/store-api.cc, nix/libutil/archive.cc, nix/nix-daemon/nix-daemon.cc: Replace "Nix store" by "store", and "Nix daemon" by "build daemon".
This commit is contained in:
parent
938078a34d
commit
8327e73396
|
@ -545,7 +545,7 @@ void UserLock::acquire()
|
||||||
|
|
||||||
/* Sanity check... */
|
/* Sanity check... */
|
||||||
if (uid == getuid() || uid == geteuid())
|
if (uid == getuid() || uid == geteuid())
|
||||||
throw Error(format("the Nix user should not be a member of `%1%'")
|
throw Error(format("the build user should not be a member of `%1%'")
|
||||||
% settings.buildUsersGroup);
|
% settings.buildUsersGroup);
|
||||||
|
|
||||||
/* Get the list of supplementary groups of this build user. This
|
/* Get the list of supplementary groups of this build user. This
|
||||||
|
@ -989,7 +989,7 @@ void DerivationGoal::init()
|
||||||
trace("init");
|
trace("init");
|
||||||
|
|
||||||
if (settings.readOnlyMode)
|
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 store") % drvPath);
|
||||||
|
|
||||||
/* The first thing to do is to make sure that the derivation
|
/* The first thing to do is to make sure that the derivation
|
||||||
exists. If it doesn't, it may be created through a
|
exists. If it doesn't, it may be created through a
|
||||||
|
@ -1287,7 +1287,7 @@ void DerivationGoal::tryToBuild()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Obtain locks on all output paths. The locks are automatically
|
/* Obtain locks on all output paths. The locks are automatically
|
||||||
released when we exit this function or Nix crashes. If we
|
released when we exit this function or the client crashes. If we
|
||||||
can't acquire the lock, then continue; hopefully some other
|
can't acquire the lock, then continue; hopefully some other
|
||||||
goal can start a build, and if not, the main loop will sleep a
|
goal can start a build, and if not, the main loop will sleep a
|
||||||
few seconds and then retry this goal. */
|
few seconds and then retry this goal. */
|
||||||
|
@ -1706,7 +1706,7 @@ void DerivationGoal::startBuilder()
|
||||||
Path homeDir = "/homeless-shelter";
|
Path homeDir = "/homeless-shelter";
|
||||||
env["HOME"] = homeDir;
|
env["HOME"] = homeDir;
|
||||||
|
|
||||||
/* Tell the builder where the Nix store is. Usually they
|
/* Tell the builder where the store is. Usually they
|
||||||
shouldn't care, but this is useful for purity checking (e.g.,
|
shouldn't care, but this is useful for purity checking (e.g.,
|
||||||
the compiler or linker might only want to accept paths to files
|
the compiler or linker might only want to accept paths to files
|
||||||
in the store or in the build directory). */
|
in the store or in the build directory). */
|
||||||
|
@ -1827,9 +1827,9 @@ void DerivationGoal::startBuilder()
|
||||||
if (useChroot) {
|
if (useChroot) {
|
||||||
#if CHROOT_ENABLED
|
#if CHROOT_ENABLED
|
||||||
/* Create a temporary directory in which we set up the chroot
|
/* Create a temporary directory in which we set up the chroot
|
||||||
environment using bind-mounts. We put it in the Nix store
|
environment using bind-mounts. We put it in the store
|
||||||
to ensure that we can create hard-links to non-directory
|
to ensure that we can create hard-links to non-directory
|
||||||
inputs in the fake Nix store in the chroot (see below). */
|
inputs in the fake store in the chroot (see below). */
|
||||||
chrootRootDir = drvPath + ".chroot";
|
chrootRootDir = drvPath + ".chroot";
|
||||||
if (pathExists(chrootRootDir)) deletePath(chrootRootDir);
|
if (pathExists(chrootRootDir)) deletePath(chrootRootDir);
|
||||||
|
|
||||||
|
@ -1888,11 +1888,11 @@ void DerivationGoal::startBuilder()
|
||||||
dirsInChroot[tmpDirInSandbox] = tmpDir;
|
dirsInChroot[tmpDirInSandbox] = tmpDir;
|
||||||
|
|
||||||
/* Make the closure of the inputs available in the chroot,
|
/* Make the closure of the inputs available in the chroot,
|
||||||
rather than the whole Nix store. This prevents any access
|
rather than the whole store. This prevents any access
|
||||||
to undeclared dependencies. Directories are bind-mounted,
|
to undeclared dependencies. Directories are bind-mounted,
|
||||||
while other inputs are hard-linked (since only directories
|
while other inputs are hard-linked (since only directories
|
||||||
can be bind-mounted). !!! As an extra security
|
can be bind-mounted). !!! As an extra security
|
||||||
precaution, make the fake Nix store only writable by the
|
precaution, make the fake store only writable by the
|
||||||
build user. */
|
build user. */
|
||||||
Path chrootStoreDir = chrootRootDir + settings.nixStore;
|
Path chrootStoreDir = chrootRootDir + settings.nixStore;
|
||||||
createDirs(chrootStoreDir);
|
createDirs(chrootStoreDir);
|
||||||
|
@ -2387,12 +2387,12 @@ void DerivationGoal::registerOutputs()
|
||||||
if (useChroot) {
|
if (useChroot) {
|
||||||
actualPath = chrootRootDir + path;
|
actualPath = chrootRootDir + path;
|
||||||
if (pathExists(actualPath)) {
|
if (pathExists(actualPath)) {
|
||||||
/* Move output paths from the chroot to the Nix store. */
|
/* Move output paths from the chroot to the store. */
|
||||||
if (buildMode == bmRepair)
|
if (buildMode == bmRepair)
|
||||||
replaceValidPath(path, actualPath);
|
replaceValidPath(path, actualPath);
|
||||||
else
|
else
|
||||||
if (buildMode != bmCheck && rename(actualPath.c_str(), path.c_str()) == -1)
|
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 store") % path);
|
||||||
}
|
}
|
||||||
if (buildMode != bmCheck) actualPath = path;
|
if (buildMode != bmCheck) actualPath = path;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2975,7 +2975,7 @@ void SubstitutionGoal::init()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.readOnlyMode)
|
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 store") % storePath);
|
||||||
|
|
||||||
subs = settings.substituters;
|
subs = settings.substituters;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ static string tempRootsDir = "temproots";
|
||||||
static string gcRootsDir = "gcroots";
|
static string gcRootsDir = "gcroots";
|
||||||
|
|
||||||
|
|
||||||
/* Acquire the global GC lock. This is used to prevent new Nix
|
/* Acquire the global GC lock. This is used to prevent new build
|
||||||
processes from starting after the temporary root files have been
|
processes from starting after the temporary root files have been
|
||||||
read. To be precise: when they try to create a new temporary root
|
read. To be precise: when they try to create a new temporary root
|
||||||
file, they will block until the garbage collector has finished /
|
file, they will block until the garbage collector has finished /
|
||||||
|
@ -92,12 +92,12 @@ Path addPermRoot(StoreAPI & store, const Path & _storePath,
|
||||||
|
|
||||||
if (isInStore(gcRoot))
|
if (isInStore(gcRoot))
|
||||||
throw Error(format(
|
throw Error(format(
|
||||||
"creating a garbage collector root (%1%) in the Nix store is forbidden "
|
"creating a garbage collector root (%1%) in the store is forbidden "
|
||||||
"(are you running nix-build inside the store?)") % gcRoot);
|
"(are you running nix-build inside the store?)") % gcRoot);
|
||||||
|
|
||||||
if (indirect) {
|
if (indirect) {
|
||||||
/* Don't clobber the link if it already exists and doesn't
|
/* Don't clobber the link if it already exists and doesn't
|
||||||
point to the Nix store. */
|
point to the store. */
|
||||||
if (pathExists(gcRoot) && (!isLink(gcRoot) || !isInStore(readLink(gcRoot))))
|
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);
|
makeSymlink(gcRoot, storePath);
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace nix {
|
||||||
|
|
||||||
/* The default location of the daemon socket, relative to nixStateDir.
|
/* The default location of the daemon socket, relative to nixStateDir.
|
||||||
The socket is in a directory to allow you to control access to the
|
The socket is in a directory to allow you to control access to the
|
||||||
Nix daemon by setting the mode/ownership of the directory
|
build daemon by setting the mode/ownership of the directory
|
||||||
appropriately. (This wouldn't work on the socket itself since it
|
appropriately. (This wouldn't work on the socket itself since it
|
||||||
must be deleted and recreated on startup.) */
|
must be deleted and recreated on startup.) */
|
||||||
#define DEFAULT_SOCKET_PATH "/daemon-socket/socket"
|
#define DEFAULT_SOCKET_PATH "/daemon-socket/socket"
|
||||||
|
|
|
@ -51,7 +51,7 @@ void checkStoreNotSymlink()
|
||||||
if (S_ISLNK(st.st_mode))
|
if (S_ISLNK(st.st_mode))
|
||||||
throw Error(format(
|
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")
|
"this is not allowed for the store and its parent directories")
|
||||||
% path);
|
% path);
|
||||||
path = dirOf(path);
|
path = dirOf(path);
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ LocalStore::LocalStore(bool reserveSpace)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lockFile(globalLock, ltRead, false)) {
|
if (!lockFile(globalLock, ltRead, false)) {
|
||||||
printMsg(lvlError, "waiting for the big Nix store lock...");
|
printMsg(lvlError, "waiting for the big store lock...");
|
||||||
lockFile(globalLock, ltRead, true);
|
lockFile(globalLock, ltRead, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ LocalStore::LocalStore(bool reserveSpace)
|
||||||
upgrade. */
|
upgrade. */
|
||||||
int curSchema = getSchema();
|
int curSchema = getSchema();
|
||||||
if (curSchema > nixSchemaVersion)
|
if (curSchema > nixSchemaVersion)
|
||||||
throw Error(format("current Nix store schema is version %1%, but I only support %2%")
|
throw Error(format("current store schema is version %1%, but I only support %2%")
|
||||||
% curSchema % nixSchemaVersion);
|
% curSchema % nixSchemaVersion);
|
||||||
|
|
||||||
else if (curSchema == 0) { /* new store */
|
else if (curSchema == 0) { /* new store */
|
||||||
|
@ -222,13 +222,13 @@ int LocalStore::getSchema()
|
||||||
void LocalStore::openDB(bool create)
|
void LocalStore::openDB(bool create)
|
||||||
{
|
{
|
||||||
if (access(settings.nixDBPath.c_str(), R_OK | W_OK))
|
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("store database directory `%1%' is not writable") % settings.nixDBPath);
|
||||||
|
|
||||||
/* Open the Nix database. */
|
/* Open the store database. */
|
||||||
string dbPath = settings.nixDBPath + "/db.sqlite";
|
string dbPath = settings.nixDBPath + "/db.sqlite";
|
||||||
if (sqlite3_open_v2(dbPath.c_str(), &db.db,
|
if (sqlite3_open_v2(dbPath.c_str(), &db.db,
|
||||||
SQLITE_OPEN_READWRITE | (create ? SQLITE_OPEN_CREATE : 0), 0) != SQLITE_OK)
|
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 store database `%1%'") % dbPath);
|
||||||
|
|
||||||
if (sqlite3_busy_timeout(db, 60 * 60 * 1000) != SQLITE_OK)
|
if (sqlite3_busy_timeout(db, 60 * 60 * 1000) != SQLITE_OK)
|
||||||
throwSQLiteError(db, "setting timeout");
|
throwSQLiteError(db, "setting timeout");
|
||||||
|
@ -316,8 +316,8 @@ void LocalStore::openDB(bool create)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* To improve purity, users may want to make the Nix store a read-only
|
/* To improve purity, users may want to make the store a read-only
|
||||||
bind mount. So make the Nix store writable for this process. */
|
bind mount. So make the store writable for this process. */
|
||||||
void LocalStore::makeStoreWritable()
|
void LocalStore::makeStoreWritable()
|
||||||
{
|
{
|
||||||
#if HAVE_UNSHARE && HAVE_STATVFS && HAVE_SYS_MOUNT_H && defined(MS_BIND) && defined(MS_REMOUNT)
|
#if HAVE_UNSHARE && HAVE_STATVFS && HAVE_SYS_MOUNT_H && defined(MS_BIND) && defined(MS_REMOUNT)
|
||||||
|
@ -325,7 +325,7 @@ void LocalStore::makeStoreWritable()
|
||||||
/* Check if /nix/store is on a read-only mount. */
|
/* Check if /nix/store is on a read-only mount. */
|
||||||
struct statvfs stat;
|
struct statvfs stat;
|
||||||
if (statvfs(settings.nixStore.c_str(), &stat) != 0)
|
if (statvfs(settings.nixStore.c_str(), &stat) != 0)
|
||||||
throw SysError("getting info about the Nix store mount point");
|
throw SysError("getting info about the store mount point");
|
||||||
|
|
||||||
if (stat.f_flag & ST_RDONLY) {
|
if (stat.f_flag & ST_RDONLY) {
|
||||||
if (unshare(CLONE_NEWNS) == -1)
|
if (unshare(CLONE_NEWNS) == -1)
|
||||||
|
@ -420,8 +420,8 @@ static void canonicalisePathMetaData_(const Path & path, uid_t fromUid, InodesSe
|
||||||
lchown if available, otherwise don't bother. Wrong ownership
|
lchown if available, otherwise don't bother. Wrong ownership
|
||||||
of a symlink doesn't matter, since the owning user can't change
|
of a symlink doesn't matter, since the owning user can't change
|
||||||
the symlink and can't delete it because the directory is not
|
the symlink and can't delete it because the directory is not
|
||||||
writable. The only exception is top-level paths in the Nix
|
writable. The only exception is top-level paths in the
|
||||||
store (since that directory is group-writable for the Nix build
|
store (since that directory is group-writable for the build
|
||||||
users group); we check for this case below. */
|
users group); we check for this case below. */
|
||||||
if (st.st_uid != geteuid()) {
|
if (st.st_uid != geteuid()) {
|
||||||
#if HAVE_LCHOWN
|
#if HAVE_LCHOWN
|
||||||
|
@ -1347,7 +1347,7 @@ Path LocalStore::importPath(bool requireSignature, Source & source)
|
||||||
|
|
||||||
unsigned int magic = readInt(hashAndReadSource);
|
unsigned int magic = readInt(hashAndReadSource);
|
||||||
if (magic != EXPORT_MAGIC)
|
if (magic != EXPORT_MAGIC)
|
||||||
throw Error("Nix archive cannot be imported; wrong format");
|
throw Error("normalized archive cannot be imported; wrong format");
|
||||||
|
|
||||||
Path dstPath = readStorePath(hashAndReadSource);
|
Path dstPath = readStorePath(hashAndReadSource);
|
||||||
|
|
||||||
|
@ -1476,7 +1476,7 @@ void LocalStore::invalidatePathChecked(const Path & path)
|
||||||
|
|
||||||
bool LocalStore::verifyStore(bool checkContents, bool repair)
|
bool LocalStore::verifyStore(bool checkContents, bool repair)
|
||||||
{
|
{
|
||||||
printMsg(lvlError, format("reading the Nix store..."));
|
printMsg(lvlError, format("reading the store..."));
|
||||||
|
|
||||||
bool errors = false;
|
bool errors = false;
|
||||||
|
|
||||||
|
@ -1564,7 +1564,7 @@ void LocalStore::verifyPath(const Path & path, const PathSet & store,
|
||||||
done.insert(path);
|
done.insert(path);
|
||||||
|
|
||||||
if (!isStorePath(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 store") % path);
|
||||||
invalidatePath(path);
|
invalidatePath(path);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,9 +112,9 @@ void LocalStore::optimisePath_(OptimiseStats & stats, const Path & path, InodeHa
|
||||||
#endif
|
#endif
|
||||||
) return;
|
) return;
|
||||||
|
|
||||||
/* Sometimes SNAFUs can cause files in the Nix store to be
|
/* Sometimes SNAFUs can cause files in the store to be
|
||||||
modified, in particular when running programs as root under
|
modified, in particular when running programs as root under
|
||||||
NixOS (example: $fontconfig/var/cache being modified). Skip
|
GuixSD (example: $fontconfig/var/cache being modified). Skip
|
||||||
those files. FIXME: check the modification time. */
|
those files. FIXME: check the modification time. */
|
||||||
if (S_ISREG(st.st_mode) && (st.st_mode & S_IWUSR)) {
|
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);
|
||||||
|
|
|
@ -32,14 +32,14 @@ bool isStorePath(const Path & path)
|
||||||
void assertStorePath(const Path & path)
|
void assertStorePath(const Path & path)
|
||||||
{
|
{
|
||||||
if (!isStorePath(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 store") % path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Path toStorePath(const Path & path)
|
Path toStorePath(const Path & path)
|
||||||
{
|
{
|
||||||
if (!isInStore(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 store") % path);
|
||||||
Path::size_type slash = path.find('/', settings.nixStore.size() + 1);
|
Path::size_type slash = path.find('/', settings.nixStore.size() + 1);
|
||||||
if (slash == Path::npos)
|
if (slash == Path::npos)
|
||||||
return path;
|
return path;
|
||||||
|
@ -80,7 +80,7 @@ void checkStoreName(const string & name)
|
||||||
|
|
||||||
where
|
where
|
||||||
|
|
||||||
<store> = the location of the Nix store, usually /nix/store
|
<store> = the location of the store, usually /gnu/store
|
||||||
|
|
||||||
<name> = a human readable name for the path, typically obtained
|
<name> = a human readable name for the path, typically obtained
|
||||||
from the name attribute of the derivation, or the name of the
|
from the name attribute of the derivation, or the name of the
|
||||||
|
|
|
@ -260,7 +260,7 @@ void parseDump(ParseSink & sink, Source & source)
|
||||||
decoded. Ignore and throw the exception below. */
|
decoded. Ignore and throw the exception below. */
|
||||||
}
|
}
|
||||||
if (version != archiveVersion1)
|
if (version != archiveVersion1)
|
||||||
throw badArchive("input doesn't look like a Nix archive");
|
throw badArchive("input doesn't look like a normalized archive");
|
||||||
parse(sink, source, "");
|
parse(sink, source, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -474,7 +474,7 @@ static void performOp(bool trusted, unsigned int clientVersion,
|
||||||
/* Repairing is not atomic, so disallowed for "untrusted"
|
/* Repairing is not atomic, so disallowed for "untrusted"
|
||||||
clients. */
|
clients. */
|
||||||
if (mode == bmRepair && !trusted)
|
if (mode == bmRepair && !trusted)
|
||||||
throw Error("repairing is not supported when building through the Nix daemon");
|
throw Error("repairing is a privileged operation");
|
||||||
}
|
}
|
||||||
startWork();
|
startWork();
|
||||||
store->buildPaths(drvs, mode);
|
store->buildPaths(drvs, mode);
|
||||||
|
@ -801,7 +801,7 @@ static void processConnection(bool trusted)
|
||||||
stopWork(false, e.msg(), GET_PROTOCOL_MINOR(clientVersion) >= 8 ? e.status : 0);
|
stopWork(false, e.msg(), GET_PROTOCOL_MINOR(clientVersion) >= 8 ? e.status : 0);
|
||||||
if (!errorAllowed) throw;
|
if (!errorAllowed) throw;
|
||||||
} catch (std::bad_alloc & e) {
|
} catch (std::bad_alloc & e) {
|
||||||
stopWork(false, "Nix daemon out of memory", GET_PROTOCOL_MINOR(clientVersion) >= 8 ? 1 : 0);
|
stopWork(false, "build daemon out of memory", GET_PROTOCOL_MINOR(clientVersion) >= 8 ? 1 : 0);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -955,7 +955,7 @@ static void acceptConnection(int fdSocket)
|
||||||
processConnection(trusted);
|
processConnection(trusted);
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}, false, "unexpected Nix daemon error: ", true);
|
}, false, "unexpected build daemon error: ", true);
|
||||||
|
|
||||||
} catch (Interrupted & e) {
|
} catch (Interrupted & e) {
|
||||||
throw;
|
throw;
|
||||||
|
|
Loading…
Reference in New Issue