summary refs log tree commit diff
path: root/nix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-10-02 22:53:47 +0200
committerLudovic Courtès <ludo@gnu.org>2018-10-02 23:08:30 +0200
commit7eca7892014d173ff523417138b90aeff5b7dec1 (patch)
tree8f0883077c4f8f7d084f0be92d3bd6a83d56a22b /nix
parent2bc8b2af8947502d147fb3b67a0a40a5565c3707 (diff)
downloadguix-7eca7892014d173ff523417138b90aeff5b7dec1.tar.gz
daemon: Remove "case hack" for nars.
This code has never been of any use in Guix.

* nix/libutil/archive.cc (useCaseHack): Remove.
(parse): Keep only the alternate branch in "if (useCaseHack)".
Diffstat (limited to 'nix')
-rw-r--r--nix/libutil/archive.cc31
-rw-r--r--nix/libutil/archive.hh5
2 files changed, 1 insertions, 35 deletions
diff --git a/nix/libutil/archive.cc b/nix/libutil/archive.cc
index 4e3d99356a..2599030454 100644
--- a/nix/libutil/archive.cc
+++ b/nix/libutil/archive.cc
@@ -21,14 +21,6 @@
 
 namespace nix {
 
-
-bool useCaseHack =
-#if __APPLE__
-    true;
-#else
-    false;
-#endif
-
 static string archiveVersion1 = "nix-archive-1";
 
 static string caseHackSuffix = "~nix~case~hack~";
@@ -85,19 +77,7 @@ static void dump(const Path & path, Sink & sink, PathFilter & filter)
            the case hack applied by restorePath(). */
         std::map<string, string> unhacked;
         for (auto & i : readDirectory(path))
-            if (useCaseHack) {
-                string name(i.name);
-                size_t pos = i.name.find(caseHackSuffix);
-                if (pos != string::npos) {
-                    printMsg(lvlDebug, format("removing case hack suffix from `%1%'") % (path + "/" + i.name));
-                    name.erase(pos);
-                }
-                if (unhacked.find(name) != unhacked.end())
-                    throw Error(format("file name collision in between `%1%' and `%2%'")
-                        % (path + "/" + unhacked[name]) % (path + "/" + i.name));
-                unhacked[name] = i.name;
-            } else
-                unhacked[i.name] = i.name;
+	    unhacked[i.name] = i.name;
 
         for (auto & i : unhacked)
             if (filter(path + "/" + i.first)) {
@@ -251,15 +231,6 @@ static void parse(ParseSink & sink, Source & source, const Path & path)
                     if (name <= prevName)
                         throw Error("NAR directory is not sorted");
                     prevName = name;
-                    if (useCaseHack) {
-                        auto i = names.find(name);
-                        if (i != names.end()) {
-                            printMsg(lvlDebug, format("case collision between `%1%' and `%2%'") % i->first % name);
-                            name += caseHackSuffix;
-                            name += std::to_string(++i->second);
-                        } else
-                            names[name] = 0;
-                    }
                 } else if (s == "node") {
                     if (s.empty()) throw badArchive("entry name missing");
                     parse(sink, source, path + "/" + name);
diff --git a/nix/libutil/archive.hh b/nix/libutil/archive.hh
index c216e9768f..9b83a5f288 100644
--- a/nix/libutil/archive.hh
+++ b/nix/libutil/archive.hh
@@ -71,9 +71,4 @@ void parseDump(ParseSink & sink, Source & source);
 
 void restorePath(const Path & path, Source & source);
 
-
-// FIXME: global variables are bad m'kay.
-extern bool useCaseHack;
-
-
 }