GNU bug report logs - #39727
statx error running 'guix gc' on CentOS 7

Previous Next

Package: guix;

Reported by: Paul Garlick <pgarlick <at> tourbillion-technology.com>

Date: Fri, 21 Feb 2020 22:50:02 UTC

Severity: normal

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: Paul Garlick <pgarlick <at> tourbillion-technology.com>
Cc: 39727 <at> debbugs.gnu.org
Subject: bug#39727: statx error running 'guix gc' on CentOS 7
Date: Mon, 24 Feb 2020 16:12:07 +0100
[Message part 1 (text/plain, inline)]
Hi Paul,

Paul Garlick <pgarlick <at> 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’.

[Message part 2 (text/x-patch, inline)]
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;

This bug report was last modified 5 years and 168 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.