From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Subject: bug#39727: statx error running 'guix gc' on CentOS 7 Date: Mon, 24 Feb 2020 16:12:07 +0100 Message-ID: <87h7zgm33s.fsf@gnu.org> References: <87sgj3ze3y.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:56797) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6FPq-0006j4-UA for bug-guix@gnu.org; Mon, 24 Feb 2020 10:13:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6FPp-00076W-T3 for bug-guix@gnu.org; Mon, 24 Feb 2020 10:13:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:47962) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j6FPp-00076K-QB for bug-guix@gnu.org; Mon, 24 Feb 2020 10:13:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1j6FPp-0004zu-J7 for bug-guix@gnu.org; Mon, 24 Feb 2020 10:13:01 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: (Paul Garlick's message of "Mon, 24 Feb 2020 12:52:42 +0000") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane-mx.org@gnu.org Sender: "bug-Guix" To: Paul Garlick Cc: 39727@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Paul, Paul Garlick 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=3D=E2=80=A6 then run: guix gc -C42 and confirm that it works for you? Thanks! Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: 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; --=-=-=--