diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-01-03T11·59+0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-01-03T11·59+0100 |
commit | def5160b614a59a0aa96fe2252e3daa00146e061 (patch) | |
tree | 3ec0b2ade78dfbf00399246fea86d3706ce0db93 /src/libstore/build.cc | |
parent | 0a4e90395c3286a246b816575351b9f2016976ba (diff) |
Clear any immutable bits in the Nix store
Doing this once makes subsequent operations like garbage collecting more efficient since we don't have to call makeMutable() first.
Diffstat (limited to 'src/libstore/build.cc')
-rw-r--r-- | src/libstore/build.cc | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc index 6ff38b0c04f3..75802c324ef9 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -7,7 +7,6 @@ #include "local-store.hh" #include "util.hh" #include "archive.hh" -#include "immutable.hh" #include <map> #include <sstream> @@ -1383,10 +1382,8 @@ void replaceValidPath(const Path & storePath, const Path tmpPath) way first. We'd better not be interrupted here, because if we're repairing (say) Glibc, we end up with a broken system. */ Path oldPath = (format("%1%.old-%2%-%3%") % storePath % getpid() % rand()).str(); - if (pathExists(storePath)) { - makeMutable(storePath); + if (pathExists(storePath)) rename(storePath.c_str(), oldPath.c_str()); - } if (rename(tmpPath.c_str(), storePath.c_str()) == -1) throw SysError(format("moving `%1%' to `%2%'") % tmpPath % storePath); if (pathExists(oldPath)) @@ -1911,10 +1908,6 @@ void DerivationGoal::startBuilder() if (S_ISDIR(st.st_mode)) dirsInChroot[*i] = *i; else { - /* Creating a hard link to *i is impossible if its - immutable bit is set. So clear it first. */ - makeMutable(*i); - Path p = chrootRootDir + *i; if (link(i->c_str(), p.c_str()) == -1) { /* Hard-linking fails if we exceed the maximum |