From: Christopher Marusich <cmmarusich@gmail.com>
To: Chris Marusich <cmmarusich@gmail.com>
Cc: 41607@debbugs.gnu.org, Stephen Scheck <singularsyntax@gmail.com>
Subject: bug#41607: Deleted store items are not actually deleted
Date: Fri, 05 Jun 2020 02:32:20 -0700 [thread overview]
Message-ID: <87pnad6eor.fsf@gmail.com> (raw)
In-Reply-To: <87r1uu1x9e.fsf@gmail.com> (Chris Marusich's message of "Thu, 04 Jun 2020 11:50:05 -0700")
[-- Attachment #1.1: Type: text/plain, Size: 1483 bytes --]
Chris Marusich <cmmarusich@gmail.com> writes:
> Ludovic Courtès <ludo@gnu.org> writes:
>
>>> Should Guix do anything about this? We could change guix-daemon to take
>>> correct action in the face of an XDEV error. We could also improve the
>>> logging, since currently it silently swallows the XDEV error.
>>
>> I guess we could delete recursively right away upon EXDEV. It should be
>> just two lines of code, right?
>
> I'll try making the change and report back. Yes, there are other cases
> where we immediately delete without moving into the trash directory
> (e.g., when the trash directory fails to be created), so it seems OK.
Here is a patch. Turns out it's was just a one line change! If nobody
has any further feedback on it, I'll go ahead and merge it to the master
branch in the next couple days.
I tested it in one of the Docker containers provided by Stephen which
exhibited the problem. I built the new Guix inside the Docker container
and verified that a path which was previously unable to be GC'd due to
the EXDEV error, was now able to be successfully GC'd.
My understanding is that the only reason why the guix-daemon attempts to
move dead directories to the trash directory is to save time on
deleting, since large directories could take a while to fully delete.
If there is any reason why it might be unsafe to delete the directories
directly in case of EXDEV (I cannot think of any), please let me know.
--
Chris
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-daemon-Handle-EXDEV-when-moving-to-trash-directory.patch --]
[-- Type: text/x-patch, Size: 1572 bytes --]
From 505481a6a22819a42320f693988c3f8e13ded080 Mon Sep 17 00:00:00 2001
From: Chris Marusich <cmmarusich@gmail.com>
Date: Thu, 4 Jun 2020 23:26:19 -0700
Subject: [PATCH] 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".
---
nix/libstore/gc.cc | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/nix/libstore/gc.cc b/nix/libstore/gc.cc
index 8bc4e01eb0..845fe278c7 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);
}
--
2.26.2
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2020-06-05 9:33 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-27 19:41 Guix Docker image inflation Stephen Scheck
2020-05-28 18:10 ` Leo Famulari
2020-05-29 16:19 ` Stephen Scheck
2020-05-29 17:08 ` Leo Famulari
2020-05-29 17:56 ` Stephen Scheck
2020-05-29 18:02 ` Leo Famulari
2020-05-29 18:21 ` Marius Bakke
2020-05-29 18:37 ` Leo Famulari
2020-05-29 18:44 ` zimoun
2020-05-29 21:24 ` Stephen Scheck
2020-05-29 18:29 ` Stephen Scheck
2020-05-29 19:09 ` bug#41607: Deleted store items are not actually deleted Leo Famulari
2020-05-31 4:56 ` Chris Marusich
2020-05-31 9:27 ` zimoun
2020-06-04 11:58 ` Ludovic Courtès
2020-06-04 18:50 ` Chris Marusich
2020-06-05 9:32 ` Christopher Marusich [this message]
2020-06-05 9:36 ` zimoun
2020-06-05 16:05 ` Stephen Scheck
2020-06-05 16:21 ` Ludovic Courtès
2020-06-07 1:31 ` Chris Marusich
2020-06-07 10:07 ` zimoun
2020-06-08 7:43 ` Chris Marusich
2020-05-29 17:12 ` Guix Docker image inflation zimoun
2020-05-29 17:36 ` Stephen Scheck
2020-05-29 18:08 ` zimoun
2020-05-29 18:47 ` Stephen Scheck
2020-05-29 20:02 ` zimoun
2020-05-29 21:04 ` Stephen Scheck
2020-05-29 21:54 ` zimoun
2020-05-29 22:11 ` Stephen Scheck
2020-05-29 23:36 ` bug#41607: Deleted store items are not actually deleted zimoun
2020-05-29 23:30 ` Guix Docker image inflation Chris Marusich
2020-05-29 23:55 ` zimoun
2020-05-30 17:13 ` Stephen Scheck
2020-05-31 9:37 ` zimoun
2020-05-31 18:30 ` Stephen Scheck
2020-05-31 18:51 ` zimoun
2020-05-31 19:43 ` Stephen Scheck
2020-05-31 23:27 ` zimoun
2020-05-31 21:04 ` Chris Marusich
2020-06-01 0:37 ` zimoun
2020-05-30 17:02 ` Stephen Scheck
2020-05-31 4:31 ` Chris Marusich
2020-05-31 9:08 ` zimoun
2020-05-31 17:50 ` Stephen Scheck
2020-05-31 18:33 ` zimoun
2020-05-31 8:24 ` zimoun
2020-05-31 10:50 ` Vincent Legoll
2020-05-31 17:58 ` zimoun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pnad6eor.fsf@gmail.com \
--to=cmmarusich@gmail.com \
--cc=41607@debbugs.gnu.org \
--cc=singularsyntax@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.