fixes to merged code
This commit is contained in:
parent
59b1f5c701
commit
b93c1bf3d6
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "value.hh"
|
||||
#include "symbol-table.hh"
|
||||
#include "error.hh"
|
||||
|
||||
#include <map>
|
||||
|
||||
|
|
|
@ -1124,7 +1124,7 @@ static void prim_toFile(EvalState & state, const Pos & pos, Value * * args, Valu
|
|||
ErrorInfo {
|
||||
.hint = hintfmt(
|
||||
"in 'toFile': the file named '%1%' must not contain a reference "
|
||||
"to a derivation but contains (%2%)"
|
||||
"to a derivation but contains (%2%)",
|
||||
name,
|
||||
path),
|
||||
.nixCode = NixCode { .errPos = pos }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "types.hh"
|
||||
#include "error.hh"
|
||||
|
||||
#include <cstring>
|
||||
#include <cstddef>
|
||||
|
|
|
@ -547,7 +547,7 @@ UserLock::UserLock()
|
|||
/* Copy the result of getgrnam. */
|
||||
Strings users;
|
||||
for (char * * p = gr->gr_mem; *p; ++p) {
|
||||
debug(format("found build user '%1%'") % *p);
|
||||
debug("found build user '%1%'", *p);
|
||||
users.push_back(*p);
|
||||
}
|
||||
|
||||
|
@ -558,7 +558,7 @@ UserLock::UserLock()
|
|||
/* Find a user account that isn't currently in use for another
|
||||
build. */
|
||||
for (auto & i : users) {
|
||||
debug(format("trying user '%1%'") % i);
|
||||
debug("trying user '%1%'", i);
|
||||
|
||||
struct passwd * pw = getpwnam(i.c_str());
|
||||
if (!pw)
|
||||
|
@ -1794,7 +1794,7 @@ HookReply DerivationGoal::tryBuildHook()
|
|||
}
|
||||
}
|
||||
|
||||
debug(format("hook reply is '%1%'") % reply);
|
||||
debug("hook reply is '%1%'", reply);
|
||||
|
||||
if (reply == "decline")
|
||||
return rpDecline;
|
||||
|
@ -2255,7 +2255,7 @@ void DerivationGoal::startBuilder()
|
|||
startDaemon();
|
||||
|
||||
/* Run the builder. */
|
||||
printMsg(lvlChatty, format("executing builder '%1%'") % drv->builder);
|
||||
printMsg(lvlChatty, "executing builder '%1%'", drv->builder);
|
||||
|
||||
/* Create the log file. */
|
||||
Path logFile = openLogFile();
|
||||
|
@ -3195,7 +3195,7 @@ void DerivationGoal::runChild()
|
|||
filesystem that we want in the chroot
|
||||
environment. */
|
||||
auto doBind = [&](const Path & source, const Path & target, bool optional = false) {
|
||||
debug(format("bind mounting '%1%' to '%2%'") % source % target);
|
||||
debug("bind mounting '%1%' to '%2%'", source, target);
|
||||
struct stat st;
|
||||
if (stat(source.c_str(), &st) == -1) {
|
||||
if (optional && errno == ENOENT)
|
||||
|
@ -3572,7 +3572,7 @@ static void moveCheckToStore(const Path & src, const Path & dst)
|
|||
directory's parent link ".."). */
|
||||
struct stat st;
|
||||
if (lstat(src.c_str(), &st) == -1) {
|
||||
throw SysError(format("getting attributes of path '%1%'") % src);
|
||||
throw SysError("getting attributes of path '%1%'", src);
|
||||
}
|
||||
|
||||
bool changePerm = (geteuid() && S_ISDIR(st.st_mode) && !(st.st_mode & S_IWUSR));
|
||||
|
@ -3581,7 +3581,7 @@ static void moveCheckToStore(const Path & src, const Path & dst)
|
|||
chmod_(src, st.st_mode | S_IWUSR);
|
||||
|
||||
if (rename(src.c_str(), dst.c_str()))
|
||||
throw SysError(format("renaming '%1%' to '%2%'") % src % dst);
|
||||
throw SysError("renaming '%1%' to '%2%'", src, dst);
|
||||
|
||||
if (changePerm)
|
||||
chmod_(dst, st.st_mode);
|
||||
|
@ -4911,15 +4911,15 @@ void Worker::waitForInput()
|
|||
// FIXME: is there a cleaner way to handle pt close
|
||||
// than EIO? Is this even standard?
|
||||
if (rd == 0 || (rd == -1 && errno == EIO)) {
|
||||
debug(format("%1%: got EOF") % goal->getName());
|
||||
debug("%1%: got EOF", goal->getName());
|
||||
goal->handleEOF(k);
|
||||
j->fds.erase(k);
|
||||
} else if (rd == -1) {
|
||||
if (errno != EINTR)
|
||||
throw SysError("%s: read failed", goal->getName());
|
||||
} else {
|
||||
printMsg(lvlVomit, format("%1%: read %2% bytes")
|
||||
% goal->getName() % rd);
|
||||
printMsg(lvlVomit, "%1%: read %2% bytes",
|
||||
goal->getName(), rd);
|
||||
string data((char *) buffer.data(), rd);
|
||||
j->lastOutput = after;
|
||||
goal->handleChildOutput(k, data);
|
||||
|
|
|
@ -103,8 +103,9 @@ class FileTransferError : public Error
|
|||
{
|
||||
public:
|
||||
FileTransfer::Error error;
|
||||
template<typename... Args>
|
||||
FileTransferError(FileTransfer::Error error, const Args & ... args)
|
||||
: Error(fs), error(error)
|
||||
: Error(args...), error(error)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "derivations.hh"
|
||||
#include "nar-info.hh"
|
||||
#include "references.hh"
|
||||
#include "error.hh"
|
||||
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
#include "types.hh"
|
||||
#include "error.hh"
|
||||
|
||||
struct sqlite3;
|
||||
struct sqlite3_stmt;
|
||||
|
|
|
@ -101,15 +101,8 @@ bool Args::processFlag(Strings::iterator & pos, Strings::iterator end)
|
|||
std::vector<std::string> args;
|
||||
for (size_t n = 0 ; n < flag.handler.arity; ++n) {
|
||||
if (pos == end) {
|
||||
<<<<<<< HEAD
|
||||
if (flag.arity == ArityAny) break;
|
||||
throw UsageError("flag '%1%' requires %2% argument(s)",
|
||||
name,
|
||||
flag.arity);
|
||||
=======
|
||||
if (flag.handler.arity == ArityAny) break;
|
||||
throw UsageError("flag '%s' requires %d argument(s)", name, flag.handler.arity);
|
||||
>>>>>>> master
|
||||
}
|
||||
args.push_back(*pos++);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
|
||||
#include "ref.hh"
|
||||
#include "types.hh"
|
||||
|
||||
#include <list>
|
||||
#include <memory>
|
||||
|
@ -21,9 +22,6 @@
|
|||
|
||||
namespace nix {
|
||||
|
||||
using std::list;
|
||||
using std::vector;
|
||||
|
||||
typedef enum {
|
||||
lvlError = 0,
|
||||
lvlWarn,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "types.hh"
|
||||
#include "error.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace nix {
|
|||
using std::list;
|
||||
using std::set;
|
||||
using std::vector;
|
||||
using std::string;
|
||||
|
||||
typedef list<std::string> Strings;
|
||||
typedef set<std::string> StringSet;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "types.hh"
|
||||
#include "error.hh"
|
||||
|
||||
#include <regex>
|
||||
|
||||
|
|
|
@ -276,7 +276,7 @@ DirEntries readDirectory(DIR *dir, const Path & path)
|
|||
DirEntries readDirectory(const Path & path)
|
||||
{
|
||||
AutoCloseDir dir(opendir(path.c_str()));
|
||||
if (!dir) throw SysError(format("opening directory '%1%'") % path);
|
||||
if (!dir) throw SysError("opening directory '%1%'", path);
|
||||
|
||||
return readDirectory(dir.get(), path);
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ string readFile(const Path & path)
|
|||
{
|
||||
AutoCloseFD fd = open(path.c_str(), O_RDONLY | O_CLOEXEC);
|
||||
if (!fd)
|
||||
throw SysError(format("opening file '%1%'") % path);
|
||||
throw SysError("opening file '%1%'", path);
|
||||
return readFile(fd.get());
|
||||
}
|
||||
|
||||
|
@ -394,15 +394,15 @@ static void _deletePath(int parentfd, const Path & path, unsigned long long & by
|
|||
const auto PERM_MASK = S_IRUSR | S_IWUSR | S_IXUSR;
|
||||
if ((st.st_mode & PERM_MASK) != PERM_MASK) {
|
||||
if (fchmodat(parentfd, name.c_str(), st.st_mode | PERM_MASK, 0) == -1)
|
||||
throw SysError(format("chmod '%1%'") % path);
|
||||
throw SysError("chmod '%1%'", path);
|
||||
}
|
||||
|
||||
int fd = openat(parentfd, path.c_str(), O_RDONLY);
|
||||
if (!fd)
|
||||
throw SysError(format("opening directory '%1%'") % path);
|
||||
throw SysError("opening directory '%1%'", path);
|
||||
AutoCloseDir dir(fdopendir(fd));
|
||||
if (!dir)
|
||||
throw SysError(format("opening directory '%1%'") % path);
|
||||
throw SysError("opening directory '%1%'", path);
|
||||
for (auto & i : readDirectory(dir.get(), path))
|
||||
_deletePath(dirfd(dir.get()), path + "/" + i.name, bytesFreed);
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ static void _deletePath(const Path & path, unsigned long long & bytesFreed)
|
|||
// for backwards compatibility.
|
||||
if (errno == ENOENT) return;
|
||||
|
||||
throw SysError(format("opening directory '%1%'") % path);
|
||||
throw SysError("opening directory '%1%'", path);
|
||||
}
|
||||
|
||||
_deletePath(dirfd.get(), path, bytesFreed);
|
||||
|
@ -845,7 +845,7 @@ int Pid::kill()
|
|||
{
|
||||
assert(pid != -1);
|
||||
|
||||
debug(format("killing process %1%") % pid);
|
||||
debug("killing process %1%", pid);
|
||||
|
||||
/* Send the requested signal to the child. If it has its own
|
||||
process group, send the signal to every process in the child
|
||||
|
@ -903,7 +903,7 @@ pid_t Pid::release()
|
|||
|
||||
void killUser(uid_t uid)
|
||||
{
|
||||
debug(format("killing all processes running under uid '%1%'") % uid);
|
||||
debug("killing all processes running under uid '%1%'", uid);
|
||||
|
||||
assert(uid != 0); /* just to be safe... */
|
||||
|
||||
|
|
Loading…
Reference in a new issue