1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-22 02:09:36 +01:00

* Sync with the trunk.

This commit is contained in:
Eelco Dolstra 2010-06-21 07:55:38 +00:00
commit bf87cc44b4
16 changed files with 140 additions and 16 deletions

View file

@ -267,7 +267,7 @@ public:
MakeError(SubstError, Error)
MakeError(BuildError, Error) /* denoted a permanent build failure */
MakeError(BuildError, Error) /* denotes a permanent build failure */
//////////////////////////////////////////////////////////////////////

View file

@ -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";

View file

@ -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);

View file

@ -16,8 +16,6 @@ namespace nix {
typedef std::map<Path, Path> Roots;
struct GCOptions
{
/* Garbage collector operation: