about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--third_party/nix/src/libexpr/primops.cc3
-rw-r--r--third_party/nix/src/libexpr/primops/fetchGit.cc2
-rw-r--r--third_party/nix/src/libexpr/primops/fetchMercurial.cc4
-rw-r--r--third_party/nix/src/libstore/binary-cache-store.cc3
-rw-r--r--third_party/nix/src/libstore/build.cc3
-rw-r--r--third_party/nix/src/libstore/builtins/buildenv.cc6
-rw-r--r--third_party/nix/src/libstore/derivations.cc3
-rw-r--r--third_party/nix/src/libstore/download.cc7
-rw-r--r--third_party/nix/src/libstore/gc.cc4
-rw-r--r--third_party/nix/src/libstore/globals.cc6
-rw-r--r--third_party/nix/src/libstore/local-store.cc8
-rw-r--r--third_party/nix/src/libstore/local-store.hh4
-rw-r--r--third_party/nix/src/libstore/machines.cc20
-rw-r--r--third_party/nix/src/libstore/nar-info-disk-cache.cc7
-rw-r--r--third_party/nix/src/libstore/nar-info.cc3
-rw-r--r--third_party/nix/src/libstore/parsed-derivations.cc3
-rw-r--r--third_party/nix/src/libstore/ssh.cc3
-rw-r--r--third_party/nix/src/libstore/store-api.cc3
-rw-r--r--third_party/nix/src/libutil/config.cc4
-rw-r--r--third_party/nix/src/libutil/util.cc2
-rw-r--r--third_party/nix/src/nix-build/nix-build.cc8
-rw-r--r--third_party/nix/src/nix-channel/nix-channel.cc5
-rw-r--r--third_party/nix/src/nix-daemon/nix-daemon-legacy.cc3
-rw-r--r--third_party/nix/src/nix/doctor.cc6
-rw-r--r--third_party/nix/src/nix/edit.cc3
-rw-r--r--third_party/nix/src/nix/run.cc6
-rw-r--r--third_party/nix/src/nix/upgrade-nix.cc3
-rw-r--r--third_party/nix/src/tests/language-tests.cc3
28 files changed, 80 insertions, 55 deletions
diff --git a/third_party/nix/src/libexpr/primops.cc b/third_party/nix/src/libexpr/primops.cc
index a1c1f25179..04ccf7623b 100644
--- a/third_party/nix/src/libexpr/primops.cc
+++ b/third_party/nix/src/libexpr/primops.cc
@@ -620,7 +620,8 @@ static void prim_derivationStrict(EvalState& state, const Pos& pos,
           } else if (i->name == state.sOutputHashMode) {
             handleHashMode(s);
           } else if (i->name == state.sOutputs) {
-            handleOutputs(absl::StrSplit(s, absl::ByAnyChar(" \t\n\r")));
+            handleOutputs(absl::StrSplit(s, absl::ByAnyChar(" \t\n\r"),
+                                         absl::SkipEmpty()));
           }
         }
       }
diff --git a/third_party/nix/src/libexpr/primops/fetchGit.cc b/third_party/nix/src/libexpr/primops/fetchGit.cc
index 7262a29155..d0e0d389cc 100644
--- a/third_party/nix/src/libexpr/primops/fetchGit.cc
+++ b/third_party/nix/src/libexpr/primops/fetchGit.cc
@@ -57,7 +57,7 @@ GitInfo exportGit(ref<Store> store, const std::string& uri,
 
       std::set<std::string> files =
           absl::StrSplit(runProgram("git", true, {"-C", uri, "ls-files", "-z"}),
-                         absl::ByChar('\0'));
+                         absl::ByChar('\0'), absl::SkipEmpty());
 
       PathFilter filter = [&](const Path& p) -> bool {
         assert(absl::StartsWith(p, uri));
diff --git a/third_party/nix/src/libexpr/primops/fetchMercurial.cc b/third_party/nix/src/libexpr/primops/fetchMercurial.cc
index 3ece094e6a..0367b2120b 100644
--- a/third_party/nix/src/libexpr/primops/fetchMercurial.cc
+++ b/third_party/nix/src/libexpr/primops/fetchMercurial.cc
@@ -53,7 +53,7 @@ HgInfo exportMercurial(ref<Store> store, const std::string& uri,
           runProgram("hg", true,
                      {"status", "-R", uri, "--clean", "--modified", "--added",
                       "--no-status", "--print0"}),
-          absl::ByChar('\0'));
+          absl::ByChar('\0'), absl::SkipEmpty());
 
       PathFilter filter = [&](const Path& p) -> bool {
         assert(absl::StartsWith(p, uri));
@@ -129,7 +129,7 @@ HgInfo exportMercurial(ref<Store> store, const std::string& uri,
       absl::StrSplit(runProgram("hg", true,
                                 {"log", "-R", cacheDir, "-r", rev, "--template",
                                  "{node} {rev} {branch}"}),
-                     absl::ByAnyChar(" \t\n\r"));
+                     absl::ByAnyChar(" \t\n\r"), absl::SkipEmpty());
   assert(tokens.size() == 3);
 
   HgInfo hgInfo;
diff --git a/third_party/nix/src/libstore/binary-cache-store.cc b/third_party/nix/src/libstore/binary-cache-store.cc
index b862ea0058..fce4dc0e11 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 27d6aa611f..9bff3b8345 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 95f915227b..7ef7e2c25a 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 0e8b637fa7..b7dcded3de 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 fdc14b3762..cf64a6bad7 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 9a6d97eb73..a491d7e32c 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 06ef3dd040..1e194135cc 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 3ad574186b..9b19e078b8 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 7ad9de3a8a..731cf1764c 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 e5d22c534c..57c89e0692 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 a09ed3c0b6..b284fc698d 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 ec9f882f4f..d42167dbfa 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 9ee93b6a6d..6989a21fee 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 e84944c4c9..8f27f5eb22 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 ab71282272..4f4083f64f 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) {
diff --git a/third_party/nix/src/libutil/config.cc b/third_party/nix/src/libutil/config.cc
index 5d28b7a20f..7c6e7af487 100644
--- a/third_party/nix/src/libutil/config.cc
+++ b/third_party/nix/src/libutil/config.cc
@@ -262,7 +262,7 @@ void BaseSetting<bool>::convertToArg(Args& args, const std::string& category) {
 
 template <>
 void BaseSetting<Strings>::set(const std::string& str) {
-  value = absl::StrSplit(str, absl::ByAnyChar(" \t\n\r"));
+  value = absl::StrSplit(str, absl::ByAnyChar(" \t\n\r"), absl::SkipEmpty());
 }
 
 template <>
@@ -280,7 +280,7 @@ void BaseSetting<Strings>::toJSON(JSONPlaceholder& out) {
 
 template <>
 void BaseSetting<StringSet>::set(const std::string& str) {
-  value = absl::StrSplit(str, absl::ByAnyChar(" \t\n\r"));
+  value = absl::StrSplit(str, absl::ByAnyChar(" \t\n\r"), absl::SkipEmpty());
 }
 
 template <>
diff --git a/third_party/nix/src/libutil/util.cc b/third_party/nix/src/libutil/util.cc
index 75a8e73eac..3e88fd29b9 100644
--- a/third_party/nix/src/libutil/util.cc
+++ b/third_party/nix/src/libutil/util.cc
@@ -547,7 +547,7 @@ std::vector<Path> getConfigDirs() {
   Path configHome = getConfigDir();
   std::string configDirs = getEnv("XDG_CONFIG_DIRS");
   std::vector<std::string> result =
-      absl::StrSplit(configDirs, absl::ByChar(':'));
+      absl::StrSplit(configDirs, absl::ByChar(':'), absl::SkipEmpty());
   result.insert(result.begin(), configHome);
   return result;
 }
diff --git a/third_party/nix/src/nix-build/nix-build.cc b/third_party/nix/src/nix-build/nix-build.cc
index 7ebb14e1f3..dde03c52cb 100644
--- a/third_party/nix/src/nix-build/nix-build.cc
+++ b/third_party/nix/src/nix-build/nix-build.cc
@@ -114,7 +114,8 @@ static void _main(int argc, char** argv) {
       !std::regex_search(argv[1], std::regex("nix-shell"))) {
     script = argv[1];
     try {
-      Strings lines = absl::StrSplit(readFile(script), absl::ByChar('\n'));
+      Strings lines = absl::StrSplit(readFile(script), absl::ByChar('\n'),
+                                     absl::SkipEmpty());
       if (std::regex_search(lines.front(), std::regex("^#!"))) {
         lines.pop_front();
         inShebang = true;
@@ -443,8 +444,9 @@ static void _main(int argc, char** argv) {
     env["NIX_STORE"] = store->storeDir;
     env["NIX_BUILD_CORES"] = std::to_string(settings.buildCores);
 
-    StringSet passAsFile = absl::StrSplit(get(drv.env, "passAsFile", ""),
-                                          absl::ByAnyChar(" \t\n\r"));
+    StringSet passAsFile =
+        absl::StrSplit(get(drv.env, "passAsFile", ""),
+                       absl::ByAnyChar(" \t\n\r"), absl::SkipEmpty());
 
     bool keepTmp = false;
     int fileNr = 0;
diff --git a/third_party/nix/src/nix-channel/nix-channel.cc b/third_party/nix/src/nix-channel/nix-channel.cc
index 837fb861d3..8afdc16ac0 100644
--- a/third_party/nix/src/nix-channel/nix-channel.cc
+++ b/third_party/nix/src/nix-channel/nix-channel.cc
@@ -26,14 +26,15 @@ static void readChannels() {
   auto channelsFile = readFile(channelsList);
 
   std::vector<std::string> lines =
-      absl::StrSplit(channelsFile, absl::ByChar('\n'));
+      absl::StrSplit(channelsFile, absl::ByChar('\n'), absl::SkipEmpty());
 
   for (auto& line : lines) {
     line = absl::StripTrailingAsciiWhitespace(line);
     if (std::regex_search(line, std::regex("^\\s*\\#"))) {
       continue;
     }
-    std::vector<std::string> split = absl::StrSplit(line, absl::ByChar(' '));
+    std::vector<std::string> split =
+        absl::StrSplit(line, absl::ByChar(' '), absl::SkipEmpty());
     auto url = std::regex_replace(split[0], std::regex("/*$"), "");
     auto name = split.size() > 1 ? split[1] : baseNameOf(url);
     channels[name] = url;
diff --git a/third_party/nix/src/nix-daemon/nix-daemon-legacy.cc b/third_party/nix/src/nix-daemon/nix-daemon-legacy.cc
index cbd64a69aa..97cf5195d3 100644
--- a/third_party/nix/src/nix-daemon/nix-daemon-legacy.cc
+++ b/third_party/nix/src/nix-daemon/nix-daemon-legacy.cc
@@ -533,7 +533,8 @@ static void performOp(TunnelLogger* logger, const ref<Store>& store,
             trusted.insert(s);
           }
           Strings subs;
-          Strings ss = absl::StrSplit(value, absl::ByAnyChar(" \t\n\r"));
+          Strings ss = absl::StrSplit(value, absl::ByAnyChar(" \t\n\r"),
+                                      absl::SkipEmpty());
           for (auto& s : ss) {
             if (trusted.count(s) != 0u) {
               subs.push_back(s);
diff --git a/third_party/nix/src/nix/doctor.cc b/third_party/nix/src/nix/doctor.cc
index 97c31d0376..0105b05e97 100644
--- a/third_party/nix/src/nix/doctor.cc
+++ b/third_party/nix/src/nix/doctor.cc
@@ -48,7 +48,8 @@ struct CmdDoctor final : StoreCommand {
   static bool checkNixInPath() {
     PathSet dirs;
 
-    for (auto& dir : absl::StrSplit(getEnv("PATH"), absl::ByChar(':'))) {
+    for (auto& dir :
+         absl::StrSplit(getEnv("PATH"), absl::ByChar(':'), absl::SkipEmpty())) {
       if (pathExists(absl::StrCat(dir, "/nix-env"))) {
         dirs.insert(dirOf(canonPath(absl::StrCat(dir, "/nix-env"), true)));
       }
@@ -71,7 +72,8 @@ struct CmdDoctor final : StoreCommand {
   static bool checkProfileRoots(const ref<Store>& store) {
     PathSet dirs;
 
-    for (auto dir : absl::StrSplit(getEnv("PATH"), absl::ByChar(':'))) {
+    for (auto dir :
+         absl::StrSplit(getEnv("PATH"), absl::ByChar(':'), absl::SkipEmpty())) {
       Path profileDir = dirOf(dir);
       try {
         Path userEnv = canonPath(profileDir, true);
diff --git a/third_party/nix/src/nix/edit.cc b/third_party/nix/src/nix/edit.cc
index 958e8aec49..a18cba292e 100644
--- a/third_party/nix/src/nix/edit.cc
+++ b/third_party/nix/src/nix/edit.cc
@@ -55,7 +55,8 @@ struct CmdEdit final : InstallableCommand {
 
     auto editor = getEnv("EDITOR", "cat");
 
-    Strings args = absl::StrSplit(editor, absl::ByAnyChar(" \t\n\r"));
+    Strings args =
+        absl::StrSplit(editor, absl::ByAnyChar(" \t\n\r"), absl::SkipEmpty());
 
     if (editor.find("emacs") != std::string::npos ||
         editor.find("nano") != std::string::npos ||
diff --git a/third_party/nix/src/nix/run.cc b/third_party/nix/src/nix/run.cc
index 241e0a2d78..e76f8834cf 100644
--- a/third_party/nix/src/nix/run.cc
+++ b/third_party/nix/src/nix/run.cc
@@ -123,7 +123,8 @@ struct CmdRun final : InstallablesCommand {
       todo.push(path);
     }
 
-    Strings unixPath = absl::StrSplit(getEnv("PATH"), absl::ByChar(':'));
+    Strings unixPath =
+        absl::StrSplit(getEnv("PATH"), absl::ByChar(':'), absl::SkipEmpty());
 
     while (!todo.empty()) {
       Path path = todo.front();
@@ -137,7 +138,8 @@ struct CmdRun final : InstallablesCommand {
       auto propPath = path + "/nix-support/propagated-user-env-packages";
       if (accessor->stat(propPath).type == FSAccessor::tRegular) {
         for (auto p :
-             absl::StrSplit(readFile(propPath), absl::ByAnyChar(" \t\n\r"))) {
+             absl::StrSplit(readFile(propPath), absl::ByAnyChar(" \t\n\r"),
+                            absl::SkipEmpty())) {
           todo.push(std::string(p));
         }
       }
diff --git a/third_party/nix/src/nix/upgrade-nix.cc b/third_party/nix/src/nix/upgrade-nix.cc
index 3e3b55789d..158e3cd1c2 100644
--- a/third_party/nix/src/nix/upgrade-nix.cc
+++ b/third_party/nix/src/nix/upgrade-nix.cc
@@ -103,7 +103,8 @@ struct CmdUpgradeNix final : MixDryRun, StoreCommand {
   static Path getProfileDir(const ref<Store>& store) {
     Path where;
 
-    for (auto& dir : absl::StrSplit(getEnv("PATH"), absl::ByChar(':'))) {
+    for (auto& dir :
+         absl::StrSplit(getEnv("PATH"), absl::ByChar(':'), absl::SkipEmpty())) {
       if (pathExists(absl::StrCat(dir, "/nix-env"))) {
         where = dir;
         break;
diff --git a/third_party/nix/src/tests/language-tests.cc b/third_party/nix/src/tests/language-tests.cc
index af4a7dbfa8..5b0e808d19 100644
--- a/third_party/nix/src/tests/language-tests.cc
+++ b/third_party/nix/src/tests/language-tests.cc
@@ -80,7 +80,8 @@ std::string TestNameFor(
     const testing::TestParamInfo<std::filesystem::path>& info) {
   std::string name;
 
-  for (auto part : absl::StrSplit(info.param.stem().string(), '-')) {
+  for (auto part :
+       absl::StrSplit(info.param.stem().string(), '-', absl::SkipEmpty())) {
     std::string part_owned(part);
     part_owned[0] = absl::ascii_toupper(part_owned[0]);
     absl::StrAppend(&name, part_owned);