From: "Ludovic Courtès" <ludo@gnu.org>
To: Paul Garlick <pgarlick@tourbillion-technology.com>
Cc: 39727@debbugs.gnu.org
Subject: bug#39727: statx error running 'guix gc' on CentOS 7
Date: Mon, 24 Feb 2020 16:12:07 +0100 [thread overview]
Message-ID: <87h7zgm33s.fsf@gnu.org> (raw)
In-Reply-To: <da3144c34f55171b7f4e92564997469a88da9c53.camel@tourbillion-technology.com> (Paul Garlick's message of "Mon, 24 Feb 2020 12:52:42 +0000")
[-- Attachment #1: Type: text/plain, Size: 492 bytes --]
Hi Paul,
Paul Garlick <pgarlick@tourbillion-technology.com> skribis:
> Initially, with the AT_STATX_DONT_SYNC flag, the output is:
>
> $ failed: Invalid argument
>
> Then, without the AT_STATX_DONT_SYNC flag, the program runs and there
> is no output.
Great. Could you apply the following patch, run the daemon with:
sudo -E ./pre-inst-env guix-daemon --build-users-group=…
then run:
guix gc -C42
and confirm that it works for you?
Thanks!
Ludo’.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1233 bytes --]
diff --git a/nix/libstore/gc.cc b/nix/libstore/gc.cc
index 77d7fa2dc7..8bc4e01eb0 100644
--- a/nix/libstore/gc.cc
+++ b/nix/libstore/gc.cc
@@ -581,15 +581,27 @@ void LocalStore::removeUnusedLinks(const GCState & state)
#ifdef HAVE_STATX
# define st_size stx_size
# define st_nlink stx_nlink
+ static int statx_flags = AT_SYMLINK_NOFOLLOW | AT_STATX_DONT_SYNC;
struct statx st;
- if (statx(AT_FDCWD, path.c_str(),
- AT_SYMLINK_NOFOLLOW | AT_STATX_DONT_SYNC,
- STATX_SIZE | STATX_NLINK, &st) == -1)
+
+ if (statx(AT_FDCWD, path.c_str(), statx_flags,
+ STATX_SIZE | STATX_NLINK, &st) == -1) {
+ if (errno == EINVAL) {
+ /* Old 3.10 kernels (CentOS 7) don't support
+ AT_STATX_DONT_SYNC, so try again without it. */
+ statx_flags &= ~AT_STATX_DONT_SYNC;
+ if (statx(AT_FDCWD, path.c_str(), statx_flags,
+ STATX_SIZE | STATX_NLINK, &st) == -1)
+ throw SysError(format("statting `%1%'") % path);
+ } else {
+ throw SysError(format("statting `%1%'") % path);
+ }
+ }
#else
struct stat st;
if (lstat(path.c_str(), &st) == -1)
-#endif
throw SysError(format("statting `%1%'") % path);
+#endif
if (st.st_nlink != 1) {
actualSize += st.st_size;
next prev parent reply other threads:[~2020-02-24 15:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-21 22:49 bug#39727: statx error running 'guix gc' on CentOS 7 Paul Garlick
2020-02-21 23:59 ` Ludovic Courtès
2020-02-24 12:52 ` Paul Garlick
2020-02-24 15:12 ` Ludovic Courtès [this message]
2020-02-24 19:51 ` Paul Garlick
2020-02-26 21:07 ` Ludovic Courtès
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=87h7zgm33s.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=39727@debbugs.gnu.org \
--cc=pgarlick@tourbillion-technology.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.