From 89865da76d87292e5bc61f324b1ac892d40236e7 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 1 Jun 2010 11:19:32 +0000 Subject: * Turn build errors during evaluation into EvalErrors. --- src/libstore/build.cc | 2 +- src/libstore/store-api.hh | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'src/libstore') diff --git a/src/libstore/build.cc b/src/libstore/build.cc index 412640670de7..f901c1f7d99e 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -267,7 +267,7 @@ public: MakeError(SubstError, Error) -MakeError(BuildError, Error) /* denoted a permanent build failure */ +MakeError(BuildError, Error) /* denotes a permanent build failure */ ////////////////////////////////////////////////////////////////////// diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh index 8506d47e36a7..0590f448c0e2 100644 --- a/src/libstore/store-api.hh +++ b/src/libstore/store-api.hh @@ -16,8 +16,6 @@ namespace nix { typedef std::map Roots; - - struct GCOptions { /* Garbage collector operation: -- cgit 1.4.1 From 07ca66cf242eef3c7a6396e9353e48037034498b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 4 Jun 2010 13:56:11 +0000 Subject: * Applied a patch from David Brown to prevent `nix-store --optimise' from failing on rename() on BtrFS. --- src/libstore/optimise-store.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/libstore') diff --git a/src/libstore/optimise-store.cc b/src/libstore/optimise-store.cc index d15049201ea4..3ed54e24d773 100644 --- a/src/libstore/optimise-store.cc +++ b/src/libstore/optimise-store.cc @@ -119,9 +119,23 @@ static void hashAndLink(bool dryRun, HashToPath & hashToPath, } /* Atomically replace the old file with the new hard link. */ - if (rename(tempLink.c_str(), path.c_str()) == -1) + if (rename(tempLink.c_str(), path.c_str()) == -1) { + if (errno == EMLINK) { + /* Some filesystems generate too many links on the + rename, rather than on the original link. + (Probably it temporarily increases the st_nlink + field before decreasing it again.) */ + printMsg(lvlInfo, format("`%1%' has maximum number of links") % prevPath.first); + hashToPath[hash] = std::pair(path, st.st_ino); + + /* Unlink the temp link. */ + if (unlink(tempLink.c_str()) == -1) + printMsg(lvlError, format("unable to unlink `%1%'") % tempLink); + return; + } throw SysError(format("cannot rename `%1%' to `%2%'") % tempLink % path); + } } else printMsg(lvlTalkative, format("would link `%1%' to `%2%'") % path % prevPath.first); -- cgit 1.4.1 From b57189174f6e11c3e9e0f7c65c08a72f689fe194 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 14 Jun 2010 08:34:48 +0000 Subject: * In importPath() and exportPath(), lock the temporary directory to prevent it from being deleted by the garbage collector. --- src/libstore/local-store.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/libstore') diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index 2c0aa3579293..f430492fd407 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -873,6 +873,8 @@ void LocalStore::exportPath(const Path & path, bool sign, writeInt(1, hashAndWriteSink); Path tmpDir = createTempDir(); + PathLocks tmpDirLock(singleton(tmpDir)); + tmpDirLock.setDeletion(true); AutoDelete delTmp(tmpDir); Path hashFile = tmpDir + "/hash"; writeFile(hashFile, printHash(hash)); @@ -922,6 +924,8 @@ Path LocalStore::importPath(bool requireSignature, Source & source) store path follows the archive data proper), and besides, we don't know yet whether the signature is valid. */ Path tmpDir = createTempDir(nixStore); + PathLocks tmpDirLock(singleton(tmpDir)); + tmpDirLock.setDeletion(true); AutoDelete delTmp(tmpDir); /* !!! could be GC'ed! */ Path unpacked = tmpDir + "/unpacked"; -- cgit 1.4.1