From e14e62fddde3b00ee82a8da29725f571ad8ecee1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 15 Jun 2020 14:12:39 +0200 Subject: [PATCH] Remove trailing whitespace --- src/build-remote/build-remote.cc | 2 +- src/libexpr/attr-path.cc | 4 +-- src/libexpr/lexer.l | 1 - src/libexpr/nixexpr.cc | 2 +- src/libmain/progress-bar.cc | 2 +- src/libstore/daemon.cc | 2 +- src/libstore/filetransfer.cc | 4 +-- src/libstore/local-store.cc | 10 +++---- src/libstore/optimise-store.cc | 6 ++-- src/libstore/store-api.cc | 2 +- src/libutil/error.cc | 2 +- src/libutil/logging.cc | 2 +- src/libutil/util.cc | 2 +- src/nix-daemon/nix-daemon.cc | 30 +++++++++---------- src/nix-env/nix-env.cc | 8 ++--- src/nix-store/nix-store.cc | 4 +-- src/nix/verify.cc | 6 ++-- .../resolve-system-dependencies.cc | 8 ++--- 18 files changed, 48 insertions(+), 49 deletions(-) diff --git a/src/build-remote/build-remote.cc b/src/build-remote/build-remote.cc index 49b35a4e9..e07117496 100644 --- a/src/build-remote/build-remote.cc +++ b/src/build-remote/build-remote.cc @@ -200,7 +200,7 @@ static int _main(int argc, char * * argv) } catch (std::exception & e) { auto msg = chomp(drainFD(5, false)); - logError({ + logError({ .name = "Remote build", .hint = hintfmt("cannot build on '%s': %s%s", bestMachine->storeUri, e.what(), diff --git a/src/libexpr/attr-path.cc b/src/libexpr/attr-path.cc index 9a9531a3f..8980bc09d 100644 --- a/src/libexpr/attr-path.cc +++ b/src/libexpr/attr-path.cc @@ -62,7 +62,7 @@ std::pair findAlongAttrPath(EvalState & state, const string & attr throw TypeError( "the expression selected by the selection path '%1%' should be a set but is %2%", attrPath, - showType(*v)); + showType(*v)); if (attr.empty()) throw Error("empty attribute name in selection path '%1%'", attrPath); @@ -79,7 +79,7 @@ std::pair findAlongAttrPath(EvalState & state, const string & attr throw TypeError( "the expression selected by the selection path '%1%' should be a list but is %2%", attrPath, - showType(*v)); + showType(*v)); if (attrIndex >= v->listSize()) throw AttrPathNotFound("list index %1% in selection path '%2%' is out of range", attrIndex, attrPath); diff --git a/src/libexpr/lexer.l b/src/libexpr/lexer.l index 85376a08f..f6e83926b 100644 --- a/src/libexpr/lexer.l +++ b/src/libexpr/lexer.l @@ -219,4 +219,3 @@ or { return OR_KW; } } %% - diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc index 5b2dd9751..b4b65883d 100644 --- a/src/libexpr/nixexpr.cc +++ b/src/libexpr/nixexpr.cc @@ -267,7 +267,7 @@ void ExprVar::bindVars(const StaticEnv & env) /* Otherwise, the variable must be obtained from the nearest enclosing `with'. If there is no `with', then we can issue an "undefined variable" error now. */ - if (withLevel == -1) + if (withLevel == -1) throw UndefinedVarError({ .hint = hintfmt("undefined variable '%1%'", name), .nixCode = NixCode { .errPos = pos } diff --git a/src/libmain/progress-bar.cc b/src/libmain/progress-bar.cc index 20d9915a0..8d0421c2f 100644 --- a/src/libmain/progress-bar.cc +++ b/src/libmain/progress-bar.cc @@ -133,7 +133,7 @@ public: { auto state(state_.lock()); - std::stringstream oss; + std::stringstream oss; oss << ei; log(*state, ei.level, oss.str()); diff --git a/src/libstore/daemon.cc b/src/libstore/daemon.cc index 172cfe3cb..620722516 100644 --- a/src/libstore/daemon.cc +++ b/src/libstore/daemon.cc @@ -77,7 +77,7 @@ struct TunnelLogger : public Logger { if (ei.level > verbosity) return; - std::stringstream oss; + std::stringstream oss; oss << ei; StringSink buf; diff --git a/src/libstore/filetransfer.cc b/src/libstore/filetransfer.cc index 6ca3393ab..601cb858a 100644 --- a/src/libstore/filetransfer.cc +++ b/src/libstore/filetransfer.cc @@ -599,9 +599,9 @@ struct curlFileTransfer : public FileTransfer workerThreadMain(); } catch (nix::Interrupted & e) { } catch (std::exception & e) { - logError({ + logError({ .name = "File transfer", - .hint = hintfmt("unexpected error in download thread: %s", + .hint = hintfmt("unexpected error in download thread: %s", e.what()) }); } diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index 5521b8633..f5c5bd9b7 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -87,7 +87,7 @@ LocalStore::LocalStore(const Params & params) struct group * gr = getgrnam(settings.buildUsersGroup.get().c_str()); if (!gr) - logError({ + logError({ .name = "'build-users-group' not found", .hint = hintfmt( "warning: the group '%1%' specified in 'build-users-group' does not exist", @@ -1223,7 +1223,7 @@ bool LocalStore::verifyStore(bool checkContents, RepairFlag repair) Path linkPath = linksDir + "/" + link.name; string hash = hashPath(htSHA256, linkPath).first.to_string(Base32, false); if (hash != link.name) { - logError({ + logError({ .name = "Invalid hash", .hint = hintfmt( "link '%s' was modified! expected hash '%s', got '%s'", @@ -1261,7 +1261,7 @@ bool LocalStore::verifyStore(bool checkContents, RepairFlag repair) auto current = hashSink->finish(); if (info->narHash != nullHash && info->narHash != current.first) { - logError({ + logError({ .name = "Invalid hash - path modified", .hint = hintfmt("path '%s' was modified! expected hash '%s', got '%s'", printStorePath(i), info->narHash.to_string(Base32, true), current.first.to_string(Base32, true)) @@ -1316,7 +1316,7 @@ void LocalStore::verifyPath(const Path & pathS, const StringSet & store, if (!done.insert(pathS).second) return; if (!isStorePath(pathS)) { - logError({ + logError({ .name = "Nix path not found", .hint = hintfmt("path '%s' is not in the Nix store", pathS) }); @@ -1342,7 +1342,7 @@ void LocalStore::verifyPath(const Path & pathS, const StringSet & store, auto state(_state.lock()); invalidatePath(*state, path); } else { - logError({ + logError({ .name = "Missing path with referrers", .hint = hintfmt("path '%s' disappeared, but it still has valid referrers!", pathS) }); diff --git a/src/libstore/optimise-store.cc b/src/libstore/optimise-store.cc index d760d110c..b2b2412a3 100644 --- a/src/libstore/optimise-store.cc +++ b/src/libstore/optimise-store.cc @@ -130,7 +130,7 @@ void LocalStore::optimisePath_(Activity * act, OptimiseStats & stats, 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)) { - logWarning({ + logWarning({ .name = "Suspicious file", .hint = hintfmt("skipping suspicious writable file '%1%'", path) }); @@ -197,7 +197,7 @@ void LocalStore::optimisePath_(Activity * act, OptimiseStats & stats, } if (st.st_size != stLink.st_size) { - logWarning({ + logWarning({ .name = "Corrupted link", .hint = hintfmt("removing corrupted link '%1%'", linkPath) }); @@ -235,7 +235,7 @@ void LocalStore::optimisePath_(Activity * act, OptimiseStats & stats, /* 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) - logError({ + logError({ .name = "Unlink error", .hint = hintfmt("unable to unlink '%1%'", tempLink) }); diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 464261010..e23a9ca50 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -777,7 +777,7 @@ bool ValidPathInfo::isContentAddressed(const Store & store) const auto warn = [&]() { logWarning( ErrorInfo{ - .name = "Path not content-addressed", + .name = "Path not content-addressed", .hint = hintfmt("path '%s' claims to be content-addressed but isn't", store.printStorePath(path)) }); }; diff --git a/src/libutil/error.cc b/src/libutil/error.cc index 1fcb8111c..cb5fe70bf 100644 --- a/src/libutil/error.cc +++ b/src/libutil/error.cc @@ -61,7 +61,7 @@ void printCodeLines(std::ostream &out, const string &prefix, const NixCode &nixC { // previous line of code. if (nixCode.prevLineOfCode.has_value()) { - out << std::endl + out << std::endl << fmt("%1% %|2$5d|| %3%", prefix, (nixCode.errPos.line - 1), diff --git a/src/libutil/logging.cc b/src/libutil/logging.cc index 108dc3bd1..105fadb15 100644 --- a/src/libutil/logging.cc +++ b/src/libutil/logging.cc @@ -273,7 +273,7 @@ bool handleJSONLogMessage(const std::string & msg, } } catch (std::exception & e) { - logError({ + logError({ .name = "Json log message", .hint = hintfmt("bad log message from builder: %s", e.what()) }); diff --git a/src/libutil/util.cc b/src/libutil/util.cc index a2281237b..667dd2edb 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -314,7 +314,7 @@ string readFile(const Path & path) void readFile(const Path & path, Sink & sink) { AutoCloseFD fd = open(path.c_str(), O_RDONLY | O_CLOEXEC); - if (!fd) + if (!fd) throw SysError("opening file '%s'", path); drainFD(fd.get(), sink); } diff --git a/src/nix-daemon/nix-daemon.cc b/src/nix-daemon/nix-daemon.cc index 582c78d14..bcb86cbce 100644 --- a/src/nix-daemon/nix-daemon.cc +++ b/src/nix-daemon/nix-daemon.cc @@ -36,7 +36,7 @@ using namespace nix::daemon; #define SPLICE_F_MOVE 0 static ssize_t splice(int fd_in, void *off_in, int fd_out, void *off_out, size_t len, unsigned int flags) { - // We ignore most parameters, we just have them for conformance with the linux syscall + // We ignore most parameters, we just have them for conformance with the linux syscall std::vector buf(8192); auto read_count = read(fd_in, buf.data(), buf.size()); if (read_count == -1) @@ -57,7 +57,7 @@ static void sigChldHandler(int sigNo) { // Ensure we don't modify errno of whatever we've interrupted auto saved_errno = errno; - // Reap all dead children. + // Reap all dead children. while (waitpid(-1, 0, WNOHANG) > 0) ; errno = saved_errno; } @@ -106,7 +106,7 @@ struct PeerInfo }; -// Get the identity of the caller, if possible. +// Get the identity of the caller, if possible. static PeerInfo getPeerInfo(int remote) { PeerInfo peer = { false, 0, false, 0, false, 0 }; @@ -154,12 +154,12 @@ static void daemonLoop(char * * argv) if (chdir("/") == -1) throw SysError("cannot change current directory"); - // Get rid of children automatically; don't let them become zombies. + // Get rid of children automatically; don't let them become zombies. setSigChldAction(true); AutoCloseFD fdSocket; - // Handle socket-based activation by systemd. + // Handle socket-based activation by systemd. auto listenFds = getEnv("LISTEN_FDS"); if (listenFds) { if (getEnv("LISTEN_PID") != std::to_string(getpid()) || listenFds != "1") @@ -168,17 +168,17 @@ static void daemonLoop(char * * argv) closeOnExec(fdSocket.get()); } - // Otherwise, create and bind to a Unix domain socket. + // Otherwise, create and bind to a Unix domain socket. else { createDirs(dirOf(settings.nixDaemonSocketFile)); fdSocket = createUnixDomainSocket(settings.nixDaemonSocketFile, 0666); } - // Loop accepting connections. + // Loop accepting connections. while (1) { try { - // Accept a connection. + // Accept a connection. struct sockaddr_un remoteAddr; socklen_t remoteAddrLen = sizeof(remoteAddr); @@ -214,7 +214,7 @@ static void daemonLoop(char * * argv) % (peer.pidKnown ? std::to_string(peer.pid) : "") % (peer.uidKnown ? user : "")); - // Fork a child to handle the connection. + // Fork a child to handle the connection. ProcessOptions options; options.errorPrefix = "unexpected Nix daemon error: "; options.dieWithParent = false; @@ -223,20 +223,20 @@ static void daemonLoop(char * * argv) startProcess([&]() { fdSocket = -1; - // Background the daemon. + // Background the daemon. if (setsid() == -1) throw SysError("creating a new session"); - // Restore normal handling of SIGCHLD. + // Restore normal handling of SIGCHLD. setSigChldAction(false); - // For debugging, stuff the pid into argv[1]. + // For debugging, stuff the pid into argv[1]. if (peer.pidKnown && argv[1]) { string processName = std::to_string(peer.pid); strncpy(argv[1], processName.c_str(), strlen(argv[1])); } - // Handle the connection. + // Handle the connection. FdSource from(remote.get()); FdSink to(remote.get()); processConnection(openUncachedStore(), from, to, trusted, NotRecursive, user, peer.uid); @@ -263,7 +263,7 @@ static int _main(int argc, char * * argv) parseCmdLine(argc, argv, [&](Strings::iterator & arg, const Strings::iterator & end) { if (*arg == "--daemon") - ; // ignored for backwards compatibility + ; // ignored for backwards compatibility else if (*arg == "--help") showManPage("nix-daemon"); else if (*arg == "--version") @@ -278,7 +278,7 @@ static int _main(int argc, char * * argv) if (stdio) { if (getStoreType() == tDaemon) { - // Forward on this connection to the real daemon + // Forward on this connection to the real daemon auto socketPath = settings.nixDaemonSocketFile; auto s = socket(PF_UNIX, SOCK_STREAM, 0); if (s == -1) diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc index 7ab5ba500..2c27d97f5 100644 --- a/src/nix-env/nix-env.cc +++ b/src/nix-env/nix-env.cc @@ -123,7 +123,7 @@ static void getAllExprs(EvalState & state, if (hasSuffix(attrName, ".nix")) attrName = string(attrName, 0, attrName.size() - 4); if (!attrs.insert(attrName).second) { - logError({ + logError({ .name = "Name collision", .hint = hintfmt("warning: name collision in input Nix expressions, skipping '%1%'", path2) }); @@ -874,7 +874,7 @@ static void queryJSON(Globals & globals, vector & elems) auto placeholder = metaObj.placeholder(j); Value * v = i.queryMeta(j); if (!v) { - logError({ + logError({ .name = "Invalid meta attribute", .hint = hintfmt("derivation '%s' has invalid meta attribute '%s'", i.queryName(), j) @@ -1128,8 +1128,8 @@ static void opQuery(Globals & globals, Strings opFlags, Strings opArgs) XMLAttrs attrs2; attrs2["name"] = j; Value * v = i.queryMeta(j); - if (!v) - logError({ + if (!v) + logError({ .name = "Invalid meta attribute", .hint = hintfmt( "derivation '%s' has invalid meta attribute '%s'", diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc index dea53b52f..6d2139526 100644 --- a/src/nix-store/nix-store.cc +++ b/src/nix-store/nix-store.cc @@ -704,7 +704,7 @@ static void opVerify(Strings opFlags, Strings opArgs) else throw UsageError("unknown flag '%1%'", i); if (store->verifyStore(checkContents, repair)) { - logWarning({ + logWarning({ .name = "Store consistency", .description = "not all errors were fixed" }); @@ -729,7 +729,7 @@ static void opVerifyPath(Strings opFlags, Strings opArgs) store->narFromPath(path, sink); auto current = sink.finish(); if (current.first != info->narHash) { - logError({ + logError({ .name = "Hash mismatch", .hint = hintfmt( "path '%s' was modified! expected hash '%s', got '%s'", diff --git a/src/nix/verify.cc b/src/nix/verify.cc index 246b4b480..001401ac2 100644 --- a/src/nix/verify.cc +++ b/src/nix/verify.cc @@ -99,12 +99,12 @@ struct CmdVerify : StorePathsCommand if (hash.first != info->narHash) { corrupted++; act2.result(resCorruptedPath, store->printStorePath(info->path)); - logError({ + logError({ .name = "Hash error - path modified", .hint = hintfmt( "path '%s' was modified! expected hash '%s', got '%s'", store->printStorePath(info->path), - info->narHash.to_string(Base32, true), + info->narHash.to_string(Base32, true), hash.first.to_string(Base32, true)) }); } @@ -154,7 +154,7 @@ struct CmdVerify : StorePathsCommand if (!good) { untrusted++; act2.result(resUntrustedPath, store->printStorePath(info->path)); - logError({ + logError({ .name = "Untrusted path", .hint = hintfmt("path '%s' is untrusted", store->printStorePath(info->path)) diff --git a/src/resolve-system-dependencies/resolve-system-dependencies.cc b/src/resolve-system-dependencies/resolve-system-dependencies.cc index 82feacb3d..434ad80a6 100644 --- a/src/resolve-system-dependencies/resolve-system-dependencies.cc +++ b/src/resolve-system-dependencies/resolve-system-dependencies.cc @@ -39,7 +39,7 @@ std::set runResolver(const Path & filename) throw SysError("statting '%s'", filename); if (!S_ISREG(st.st_mode)) { - logError({ + logError({ .name = "Regular MACH file", .hint = hintfmt("file '%s' is not a regular file", filename) }); @@ -47,7 +47,7 @@ std::set runResolver(const Path & filename) } if (st.st_size < sizeof(mach_header_64)) { - logError({ + logError({ .name = "File too short", .hint = hintfmt("file '%s' is too short for a MACH binary", filename) }); @@ -72,7 +72,7 @@ std::set runResolver(const Path & filename) } } if (mach64_offset == 0) { - logError({ + logError({ .name = "No mach64 blobs", .hint = hintfmt("Could not find any mach64 blobs in file '%1%', continuing...", filename) }); @@ -81,7 +81,7 @@ std::set runResolver(const Path & filename) } else if (magic == MH_MAGIC_64 || magic == MH_CIGAM_64) { mach64_offset = 0; } else { - logError({ + logError({ .name = "Magic number", .hint = hintfmt("Object file has unknown magic number '%1%', skipping it...", magic) });