diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-06-21 07:55:38 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-06-21 07:55:38 +0000 |
commit | bf87cc44b4484df74388b526c89884fea166ab7f (patch) | |
tree | 18a9a0e77d2e2a027eac094b3cdb43d6dd988cf4 /src/libstore | |
parent | d1f6c0cbe39b509545f809f08cbd580859f38e34 (diff) | |
parent | b57189174f6e11c3e9e0f7c65c08a72f689fe194 (diff) |
* Sync with the trunk.
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/build.cc | 2 | ||||
-rw-r--r-- | src/libstore/local-store.cc | 4 | ||||
-rw-r--r-- | src/libstore/optimise-store.cc | 16 | ||||
-rw-r--r-- | src/libstore/store-api.hh | 2 |
4 files changed, 20 insertions, 4 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc index a482ace00..8ce8c873d 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/local-store.cc b/src/libstore/local-store.cc index cf0d559bd..c7530f1b1 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -1036,6 +1036,8 @@ void LocalStore::exportPath(const Path & path, bool sign, writeInt(1, hashAndWriteSink); Path tmpDir = createTempDir(); + PathLocks tmpDirLock(singleton<PathSet, Path>(tmpDir)); + tmpDirLock.setDeletion(true); AutoDelete delTmp(tmpDir); Path hashFile = tmpDir + "/hash"; writeFile(hashFile, printHash(hash)); @@ -1085,6 +1087,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<PathSet, Path>(tmpDir)); + tmpDirLock.setDeletion(true); AutoDelete delTmp(tmpDir); /* !!! could be GC'ed! */ Path unpacked = tmpDir + "/unpacked"; diff --git a/src/libstore/optimise-store.cc b/src/libstore/optimise-store.cc index d15049201..3ed54e24d 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, ino_t>(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); diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh index fbe0cce81..3b81bfa39 100644 --- a/src/libstore/store-api.hh +++ b/src/libstore/store-api.hh @@ -16,8 +16,6 @@ namespace nix { typedef std::map<Path, Path> Roots; - - struct GCOptions { /* Garbage collector operation: |