diff options
author | Chris Marusich <cmmarusich@gmail.com> | 2020-06-04 23:26:19 -0700 |
---|---|---|
committer | Chris Marusich <cmmarusich@gmail.com> | 2020-06-06 15:43:35 -0700 |
commit | d445c30ea6f9693454ca96bae9089ba8738a6f78 (patch) | |
tree | 25a4cccb66ef31337f3c6673508e0674235003de /nix/libstore | |
parent | c39693d76099c159df856ffb5b2c43765fd6f2dd (diff) |
daemon: Handle EXDEV when moving to trash directory.
Fixes <https://bugs.gnu.org/41607>.
Reported by Stephen Scheck <singularsyntax@gmail.com>.
* nix/libstore/gc.cc (LocalStore::deletePathRecursive): When we try to
move a dead directory into the trashDir using rename(2) but it returns
an EXDEV error, just delete the directory instead. This can happen in a
Docker container when the directory is not on the "top layer".
Diffstat (limited to 'nix/libstore')
-rw-r--r-- | nix/libstore/gc.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/nix/libstore/gc.cc b/nix/libstore/gc.cc index 8bc4e01eb0..e1d0765154 100644 --- a/nix/libstore/gc.cc +++ b/nix/libstore/gc.cc @@ -455,7 +455,10 @@ void LocalStore::deletePathRecursive(GCState & state, const Path & path) throw SysError(format("unable to rename `%1%' to `%2%'") % path % tmp); state.bytesInvalidated += size; } catch (SysError & e) { - if (e.errNo == ENOSPC) { + /* In a Docker container, rename(2) returns EXDEV when the source + and destination are not both on the "top layer". See: + https://bugs.gnu.org/41607 */ + if (e.errNo == ENOSPC || e.errNo == EXDEV) { printMsg(lvlInfo, format("note: can't create move `%1%': %2%") % path % e.msg()); deleteGarbage(state, path); } |