about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-07-08T20·26+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-07-08T20·26+0000
commit9a99dc736d814f41d2b3ceb92da2435ae2dd5632 (patch)
tree13b525d2a48c164950a71fe3fdf762f8030ea6cf /src
parentcab3f4977a412681a77767ec7307ee642b61332d (diff)
* Canonicalise paths so that Fix produces identical Nix
  expressions for identical inputs.

Diffstat (limited to 'src')
-rw-r--r--src/fix.cc3
-rw-r--r--src/fstate.cc2
-rw-r--r--src/store.cc2
3 files changed, 4 insertions, 3 deletions
diff --git a/src/fix.cc b/src/fix.cc
index 508a441167bc..b4626f71f329 100644
--- a/src/fix.cc
+++ b/src/fix.cc
@@ -170,7 +170,8 @@ static Expr evalExpr(Expr e)
         if (name == "")
             throw badTerm("no package name specified", nf);
         
-        string out = nixStore + "/" + ((string) hash).c_str() + "-" + name;
+        string out = 
+            canonPath(nixStore + "/" + ((string) hash).c_str() + "-" + name);
 
         env = ATinsert(env, ATmake("(<str>, <str>)", "out", out.c_str()));
 
diff --git a/src/fstate.cc b/src/fstate.cc
index 731493fd35cb..344197748444 100644
--- a/src/fstate.cc
+++ b/src/fstate.cc
@@ -163,7 +163,7 @@ Hash writeTerm(ATerm t)
     if (!ATwriteToNamedTextFile(t, path.c_str()))
         throw Error(format("cannot write aterm %1%") % path);
     Hash hash = hashPath(path);
-    string path2 = nixStore + "/" + (string) hash + ".nix";
+    string path2 = canonPath(nixStore + "/" + (string) hash + ".nix");
     if (rename(path.c_str(), path2.c_str()) == -1)
         throw SysError(format("renaming %1% to %2%") % path % path2);
     registerPath(path2, hash);
diff --git a/src/store.cc b/src/store.cc
index bb945e037ad3..095d20430777 100644
--- a/src/store.cc
+++ b/src/store.cc
@@ -177,7 +177,7 @@ void addToStore(string srcPath, string & dstPath, Hash & hash)
     }
     
     string baseName = baseNameOf(srcPath);
-    dstPath = nixStore + "/" + (string) hash + "-" + baseName;
+    dstPath = canonPath(nixStore + "/" + (string) hash + "-" + baseName);
 
     copyPath(srcPath, dstPath);