From def5160b614a59a0aa96fe2252e3daa00146e061 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 3 Jan 2013 12:59:23 +0100 Subject: 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. --- src/libstore/optimise-store.cc | 9 --------- 1 file changed, 9 deletions(-) (limited to 'src/libstore/optimise-store.cc') diff --git a/src/libstore/optimise-store.cc b/src/libstore/optimise-store.cc index 43b3c9b4fbc3..e91c2b1ce52c 100644 --- a/src/libstore/optimise-store.cc +++ b/src/libstore/optimise-store.cc @@ -2,7 +2,6 @@ #include "util.hh" #include "local-store.hh" -#include "immutable.hh" #include "globals.hh" #include @@ -20,7 +19,6 @@ static void makeWritable(const Path & path) struct stat st; if (lstat(path.c_str(), &st)) throw SysError(format("getting attributes of path `%1%'") % path); - if (S_ISDIR(st.st_mode) || S_ISREG(st.st_mode)) makeMutable(path); if (chmod(path.c_str(), st.st_mode | S_IWUSR) == -1) throw SysError(format("changing writability of `%1%'") % path); } @@ -91,7 +89,6 @@ void LocalStore::optimisePath_(OptimiseStats & stats, const Path & path) if (!pathExists(linkPath)) { /* Nope, create a hard link in the links directory. */ - makeMutable(path); if (link(path.c_str(), linkPath.c_str()) == 0) return; if (errno != EEXIST) throw SysError(format("cannot link `%1%' to `%2%'") % linkPath % path); @@ -123,12 +120,6 @@ void LocalStore::optimisePath_(OptimiseStats & stats, const Path & path) its timestamp back to 0. */ MakeReadOnly makeReadOnly(mustToggle ? dirOf(path) : ""); - /* If ‘linkPath’ is immutable, we can't create hard links to it, - so make it mutable first. We also have to make ‘path’ mutable, - otherwise rename() will fail to delete it. */ - makeMutable(path); - makeMutable(linkPath); - Path tempLink = (format("%1%/.tmp-link-%2%-%3%") % settings.nixStore % getpid() % rand()).str(); -- cgit 1.4.1