From 937a54ae4a79a41bde728b39e15571d7d04e9a8f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 12 Apr 2005 10:56:02 +0000 Subject: [PATCH] * Merge critical bug fixes from trunk (r2536, r2537). --- scripts/download-using-manifests.pl.in | 2 +- src/libstore/store.cc | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/download-using-manifests.pl.in b/scripts/download-using-manifests.pl.in index ed3290c18..8c75ab109 100644 --- a/scripts/download-using-manifests.pl.in +++ b/scripts/download-using-manifests.pl.in @@ -76,7 +76,7 @@ addToQueue $targetPath; sub isValidPath { my $p = shift; - system "@bindir@/nix-store --isvalid '$p' 2> /dev/null"; + system "@bindir@/nix-store --check-validity '$p' 2> /dev/null"; return $? == 0; } diff --git a/src/libstore/store.cc b/src/libstore/store.cc index 4e531bc41..d61c3e454 100644 --- a/src/libstore/store.cc +++ b/src/libstore/store.cc @@ -737,10 +737,10 @@ void deleteFromStore(const Path & _path) Transaction txn(nixDB); if (isValidPathTxn(txn, path)) { PathSet referers = getReferers(txn, path); - if (referers.size() > 1 || - (referers.size() == 1 && - *referers.begin() != path)) - throw Error(format("cannot delete path `%1%' because it is in use") % path); + for (PathSet::iterator i = referers.begin(); + i != referers.end(); ++i) + if (*i != path && isValidPathTxn(txn, *i)) + throw Error(format("cannot delete path `%1%' because it is in use by path `%2%'") % path % *i); invalidatePath(txn, path); } txn.commit();