diff options
Diffstat (limited to 'third_party/nix/src/libstore')
-rw-r--r-- | third_party/nix/src/libstore/binary-cache-store.cc | 3 | ||||
-rw-r--r-- | third_party/nix/src/libstore/build.cc | 3 | ||||
-rw-r--r-- | third_party/nix/src/libstore/builtins/buildenv.cc | 6 | ||||
-rw-r--r-- | third_party/nix/src/libstore/derivations.cc | 3 | ||||
-rw-r--r-- | third_party/nix/src/libstore/download.cc | 7 | ||||
-rw-r--r-- | third_party/nix/src/libstore/gc.cc | 4 | ||||
-rw-r--r-- | third_party/nix/src/libstore/globals.cc | 6 | ||||
-rw-r--r-- | third_party/nix/src/libstore/local-store.cc | 8 | ||||
-rw-r--r-- | third_party/nix/src/libstore/local-store.hh | 4 | ||||
-rw-r--r-- | third_party/nix/src/libstore/machines.cc | 20 | ||||
-rw-r--r-- | third_party/nix/src/libstore/nar-info-disk-cache.cc | 7 | ||||
-rw-r--r-- | third_party/nix/src/libstore/nar-info.cc | 3 | ||||
-rw-r--r-- | third_party/nix/src/libstore/parsed-derivations.cc | 3 | ||||
-rw-r--r-- | third_party/nix/src/libstore/ssh.cc | 3 | ||||
-rw-r--r-- | third_party/nix/src/libstore/store-api.cc | 3 |
15 files changed, 48 insertions, 35 deletions
diff --git a/third_party/nix/src/libstore/binary-cache-store.cc b/third_party/nix/src/libstore/binary-cache-store.cc index b862ea005870..fce4dc0e112c 100644 --- a/third_party/nix/src/libstore/binary-cache-store.cc +++ b/third_party/nix/src/libstore/binary-cache-store.cc @@ -42,7 +42,8 @@ void BinaryCacheStore::init() { upsertFile(cacheInfoFile, "StoreDir: " + storeDir + "\n", "text/x-nix-cache-info"); } else { - for (auto& line : absl::StrSplit(*cacheInfo, absl::ByChar('\n'))) { + for (auto& line : + absl::StrSplit(*cacheInfo, absl::ByChar('\n'), absl::SkipEmpty())) { size_t colon = line.find(':'); if (colon == std::string::npos) { continue; diff --git a/third_party/nix/src/libstore/build.cc b/third_party/nix/src/libstore/build.cc index 27d6aa611f6f..9bff3b8345df 100644 --- a/third_party/nix/src/libstore/build.cc +++ b/third_party/nix/src/libstore/build.cc @@ -2485,7 +2485,8 @@ void DerivationGoal::initTmpDir() { there is no size constraint). */ if (!parsedDrv->getStructuredAttrs()) { std::set<std::string> passAsFile = - absl::StrSplit(get(drv->env, "passAsFile"), absl::ByAnyChar(" \t\n\r")); + absl::StrSplit(get(drv->env, "passAsFile"), absl::ByAnyChar(" \t\n\r"), + absl::SkipEmpty()); for (auto& i : drv->env) { if (passAsFile.find(i.first) == passAsFile.end()) { env[i.first] = i.second; diff --git a/third_party/nix/src/libstore/builtins/buildenv.cc b/third_party/nix/src/libstore/builtins/buildenv.cc index 95f915227bb1..7ef7e2c25a59 100644 --- a/third_party/nix/src/libstore/builtins/buildenv.cc +++ b/third_party/nix/src/libstore/builtins/buildenv.cc @@ -137,7 +137,7 @@ static void addPkg(const Path& pkgDir, int priority) { try { for (auto p : absl::StrSplit( readFile(pkgDir + "/nix-support/propagated-user-env-packages"), - absl::ByAnyChar(" \n"))) { + absl::ByAnyChar(" \n"), absl::SkipEmpty())) { auto pkg = std::string(p); if (!done.count(pkg)) { postponed.insert(pkg); @@ -175,8 +175,8 @@ void builtinBuildenv(const BasicDerivation& drv) { /* Convert the stuff we get from the environment back into a * coherent data type. */ Packages pkgs; - Strings derivations = - absl::StrSplit(getAttr("derivations"), absl::ByAnyChar(" \t\n\r")); + Strings derivations = absl::StrSplit( + getAttr("derivations"), absl::ByAnyChar(" \t\n\r"), absl::SkipEmpty()); while (!derivations.empty()) { /* !!! We're trusting the caller to structure derivations env var correctly */ diff --git a/third_party/nix/src/libstore/derivations.cc b/third_party/nix/src/libstore/derivations.cc index 0e8b637fa78f..b7dcded3de5e 100644 --- a/third_party/nix/src/libstore/derivations.cc +++ b/third_party/nix/src/libstore/derivations.cc @@ -421,7 +421,8 @@ DrvPathWithOutputs parseDrvPathWithOutputs(absl::string_view path) { return DrvPathWithOutputs( path.substr(0, pos), - absl::StrSplit(path.substr(pos + 1), absl::ByChar(','))); + absl::StrSplit(path.substr(pos + 1), absl::ByChar(','), + absl::SkipEmpty())); } Path makeDrvPathWithOutputs(const Path& drvPath, diff --git a/third_party/nix/src/libstore/download.cc b/third_party/nix/src/libstore/download.cc index fdc14b376235..cf64a6bad722 100644 --- a/third_party/nix/src/libstore/download.cc +++ b/third_party/nix/src/libstore/download.cc @@ -181,7 +181,8 @@ struct CurlDownloader : public Downloader { << "': " << absl::StripAsciiWhitespace(line); if (line.compare(0, 5, "HTTP/") == 0) { // new response starts result.etag = ""; - std::vector<std::string> ss = absl::StrSplit(line, absl::ByChar(' ')); + std::vector<std::string> ss = + absl::StrSplit(line, absl::ByChar(' '), absl::SkipEmpty()); status = ss.size() >= 2 ? ss[1] : ""; result.data = std::make_shared<std::string>(); result.bodySize = 0; @@ -896,8 +897,8 @@ CachedDownloadResult Downloader::downloadCached( storePath = readLink(fileLink); store->addTempRoot(storePath); if (store->isValidPath(storePath)) { - std::vector<std::string> ss = - absl::StrSplit(readFile(dataFile), absl::ByChar('\n')); + std::vector<std::string> ss = absl::StrSplit( + readFile(dataFile), absl::ByChar('\n'), absl::SkipEmpty()); if (ss.size() >= 3 && ss[0] == url) { time_t lastChecked; if (absl::SimpleAtoi(ss[2], &lastChecked) && diff --git a/third_party/nix/src/libstore/gc.cc b/third_party/nix/src/libstore/gc.cc index 9a6d97eb73c9..a491d7e32c48 100644 --- a/third_party/nix/src/libstore/gc.cc +++ b/third_party/nix/src/libstore/gc.cc @@ -423,8 +423,8 @@ void LocalStore::findRuntimeRoots(Roots& roots, bool censor) { try { auto mapFile = fmt("/proc/%s/maps", ent->d_name); - std::vector<std::string> mapLines = - absl::StrSplit(readFile(mapFile, true), absl::ByChar('\n')); + std::vector<std::string> mapLines = absl::StrSplit( + readFile(mapFile, true), absl::ByChar('\n'), absl::SkipEmpty()); for (const auto& line : mapLines) { auto match = std::smatch{}; if (std::regex_match(line, match, mapRegex)) { diff --git a/third_party/nix/src/libstore/globals.cc b/third_party/nix/src/libstore/globals.cc index 06ef3dd0402a..1e194135cc9a 100644 --- a/third_party/nix/src/libstore/globals.cc +++ b/third_party/nix/src/libstore/globals.cc @@ -59,14 +59,14 @@ Settings::Settings() auto s = getEnv("NIX_REMOTE_SYSTEMS"); if (!s.empty()) { Strings ss; - for (auto p : absl::StrSplit(s, absl::ByChar(':'))) { + for (auto p : absl::StrSplit(s, absl::ByChar(':'), absl::SkipEmpty())) { ss.push_back(absl::StrCat("@", p)); } builders = concatStringsSep(" ", ss); } - sandboxPaths = - absl::StrSplit("/bin/sh=" SANDBOX_SHELL, absl::ByAnyChar(" \t\n\r")); + sandboxPaths = absl::StrSplit("/bin/sh=" SANDBOX_SHELL, + absl::ByAnyChar(" \t\n\r"), absl::SkipEmpty()); } void loadConfFile() { diff --git a/third_party/nix/src/libstore/local-store.cc b/third_party/nix/src/libstore/local-store.cc index 3ad574186bf7..9b19e078b86f 100644 --- a/third_party/nix/src/libstore/local-store.cc +++ b/third_party/nix/src/libstore/local-store.cc @@ -468,9 +468,9 @@ static void canonicalisePathMetaData_(const Path& path, uid_t fromUid, throw SysError("querying extended attributes of '%s'", path); } - for (auto& eaName : - absl::StrSplit(std::string(eaBuf.data(), eaSize), - absl::ByString(std::string("\000", 1)))) { + for (auto& eaName : absl::StrSplit(std::string(eaBuf.data(), eaSize), + absl::ByString(std::string("\000", 1)), + absl::SkipEmpty())) { /* Ignore SELinux security labels since these cannot be removed even by root. */ if (eaName == "security.selinux") { @@ -702,7 +702,7 @@ void LocalStore::queryPathInfoUncached( s = (const char*)sqlite3_column_text(state->stmtQueryPathInfo, 6); if (s != nullptr) { - info->sigs = absl::StrSplit(s, absl::ByChar(' ')); + info->sigs = absl::StrSplit(s, absl::ByChar(' '), absl::SkipEmpty()); } s = (const char*)sqlite3_column_text(state->stmtQueryPathInfo, 7); diff --git a/third_party/nix/src/libstore/local-store.hh b/third_party/nix/src/libstore/local-store.hh index 7ad9de3a8a3e..731cf1764cf6 100644 --- a/third_party/nix/src/libstore/local-store.hh +++ b/third_party/nix/src/libstore/local-store.hh @@ -97,8 +97,8 @@ class LocalStore : public LocalFSStore { public: // Hack for build-remote.cc. // TODO(tazjin): remove this when we've got gRPC - PathSet locksHeld = - absl::StrSplit(getEnv("NIX_HELD_LOCKS"), absl::ByAnyChar(" \t\n\r")); + PathSet locksHeld = absl::StrSplit( + getEnv("NIX_HELD_LOCKS"), absl::ByAnyChar(" \t\n\r"), absl::SkipEmpty()); /* Initialise the local store, upgrading the schema if necessary. */ diff --git a/third_party/nix/src/libstore/machines.cc b/third_party/nix/src/libstore/machines.cc index e5d22c534c36..57c89e06924b 100644 --- a/third_party/nix/src/libstore/machines.cc +++ b/third_party/nix/src/libstore/machines.cc @@ -52,7 +52,8 @@ bool Machine::mandatoryMet(const std::set<std::string>& features) const { } void parseMachines(const std::string& s, Machines& machines) { - for (auto line : absl::StrSplit(s, absl::ByAnyChar("\n;"))) { + for (auto line : + absl::StrSplit(s, absl::ByAnyChar("\n;"), absl::SkipEmpty())) { // Skip empty lines & comments line = absl::StripAsciiWhitespace(line); if (line.empty() || line[line.find_first_not_of(" \t")] == '#') { @@ -73,7 +74,7 @@ void parseMachines(const std::string& s, Machines& machines) { } std::vector<std::string> tokens = - absl::StrSplit(line, absl::ByAnyChar(" \t\n\r")); + absl::StrSplit(line, absl::ByAnyChar(" \t\n\r"), absl::SkipEmpty()); auto sz = tokens.size(); if (sz < 1) { throw FormatError("bad machine specification '%s'", line); @@ -86,14 +87,17 @@ void parseMachines(const std::string& s, Machines& machines) { // TODO(tazjin): what??? machines.emplace_back( tokens[0], - isSet(1) ? absl::StrSplit(tokens[1], absl::ByChar(',')) - : std::vector<std::string>{settings.thisSystem}, + isSet(1) + ? absl::StrSplit(tokens[1], absl::ByChar(','), absl::SkipEmpty()) + : std::vector<std::string>{settings.thisSystem}, isSet(2) ? tokens[2] : "", isSet(3) ? std::stoull(tokens[3]) : 1LL, isSet(4) ? std::stoull(tokens[4]) : 1LL, - isSet(5) ? absl::StrSplit(tokens[5], absl::ByChar(',')) - : std::set<std::string>{}, - isSet(6) ? absl::StrSplit(tokens[6], absl::ByChar(',')) - : std::set<std::string>{}, + isSet(5) + ? absl::StrSplit(tokens[5], absl::ByChar(','), absl::SkipEmpty()) + : std::set<std::string>{}, + isSet(6) + ? absl::StrSplit(tokens[6], absl::ByChar(','), absl::SkipEmpty()) + : std::set<std::string>{}, isSet(7) ? tokens[7] : ""); } } diff --git a/third_party/nix/src/libstore/nar-info-disk-cache.cc b/third_party/nix/src/libstore/nar-info-disk-cache.cc index a09ed3c0b68f..b284fc698dcc 100644 --- a/third_party/nix/src/libstore/nar-info-disk-cache.cc +++ b/third_party/nix/src/libstore/nar-info-disk-cache.cc @@ -232,14 +232,15 @@ class NarInfoDiskCacheImpl final : public NarInfoDiskCache { auto hash_ = Hash::deserialize(queryNAR.getStr(6)); narInfo->narHash = Hash::unwrap_throw(hash_); narInfo->narSize = queryNAR.getInt(7); - for (auto r : absl::StrSplit(queryNAR.getStr(8), absl::ByChar(' '))) { + for (auto r : absl::StrSplit(queryNAR.getStr(8), absl::ByChar(' '), + absl::SkipEmpty())) { narInfo->references.insert(absl::StrCat(cache.storeDir, "/", r)); } if (!queryNAR.isNull(9)) { narInfo->deriver = cache.storeDir + "/" + queryNAR.getStr(9); } - for (auto& sig : - absl::StrSplit(queryNAR.getStr(10), absl::ByChar(' '))) { + for (auto& sig : absl::StrSplit( + queryNAR.getStr(10), absl::ByChar(' '), absl::SkipEmpty())) { narInfo->sigs.insert(std::string(sig)); } narInfo->ca = queryNAR.getStr(11); diff --git a/third_party/nix/src/libstore/nar-info.cc b/third_party/nix/src/libstore/nar-info.cc index ec9f882f4fb4..d42167dbfa69 100644 --- a/third_party/nix/src/libstore/nar-info.cc +++ b/third_party/nix/src/libstore/nar-info.cc @@ -62,7 +62,8 @@ NarInfo::NarInfo(const Store& store, const std::string& s, corrupt(); } } else if (name == "References") { - std::vector<std::string> refs = absl::StrSplit(value, absl::ByChar(' ')); + std::vector<std::string> refs = + absl::StrSplit(value, absl::ByChar(' '), absl::SkipEmpty()); if (!references.empty()) { corrupt(); } diff --git a/third_party/nix/src/libstore/parsed-derivations.cc b/third_party/nix/src/libstore/parsed-derivations.cc index 9ee93b6a6d6e..6989a21fee5c 100644 --- a/third_party/nix/src/libstore/parsed-derivations.cc +++ b/third_party/nix/src/libstore/parsed-derivations.cc @@ -88,7 +88,8 @@ std::optional<Strings> ParsedDerivation::getStringsAttr( if (i == drv.env.end()) { return {}; } - return absl::StrSplit(i->second, absl::ByAnyChar(" \t\n\r")); + return absl::StrSplit(i->second, absl::ByAnyChar(" \t\n\r"), + absl::SkipEmpty()); } } diff --git a/third_party/nix/src/libstore/ssh.cc b/third_party/nix/src/libstore/ssh.cc index e84944c4c9cd..8f27f5eb2286 100644 --- a/third_party/nix/src/libstore/ssh.cc +++ b/third_party/nix/src/libstore/ssh.cc @@ -22,7 +22,8 @@ SSHMaster::SSHMaster(const std::string& host, std::string keyFile, void SSHMaster::addCommonSSHOpts(Strings& args) { for (auto& i : - absl::StrSplit(getEnv("NIX_SSHOPTS"), absl::ByAnyChar(" \t\n\r"))) { + absl::StrSplit(getEnv("NIX_SSHOPTS"), absl::ByAnyChar(" \t\n\r"), + absl::SkipEmpty())) { args.push_back(std::string(i)); } if (!keyFile.empty()) { diff --git a/third_party/nix/src/libstore/store-api.cc b/third_party/nix/src/libstore/store-api.cc index ab7128227244..4f4083f64f67 100644 --- a/third_party/nix/src/libstore/store-api.cc +++ b/third_party/nix/src/libstore/store-api.cc @@ -960,7 +960,8 @@ std::pair<std::string, Store::Params> splitUriAndParams( Store::Params params; auto q = uri.find('?'); if (q != std::string::npos) { - Strings parts = absl::StrSplit(uri.substr(q + 1), absl::ByChar('&')); + Strings parts = + absl::StrSplit(uri.substr(q + 1), absl::ByChar('&'), absl::SkipEmpty()); for (const auto& s : parts) { auto e = s.find('='); if (e != std::string::npos) { |