From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christopher Allan Webber Subject: Re: Missing patch on savannah means coreutils can't build Date: Sat, 20 Feb 2016 15:19:46 -0800 Message-ID: <871t87c6kn.fsf@dustycloud.org> References: <877fhzw8df.fsf@dustycloud.org> <20160220225045.3f56c93d@debian-netbook> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46078) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXGpE-0002PJ-Tv for guix-devel@gnu.org; Sat, 20 Feb 2016 18:20:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aXGpD-0005b7-18 for guix-devel@gnu.org; Sat, 20 Feb 2016 18:20:32 -0500 Received: from dustycloud.org ([2600:3c02::f03c:91ff:feae:cb51]:51982) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXGpC-0005at-Fz for guix-devel@gnu.org; Sat, 20 Feb 2016 18:20:30 -0500 In-reply-to: <20160220225045.3f56c93d@debian-netbook> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Efraim Flashner Cc: guix-devel@gnu.org --=-=-= Content-Type: text/plain Efraim Flashner writes: > On Sat, 20 Feb 2016 10:19:51 -0800 > Christopher Allan Webber wrote: > >> Earlier today I tried doing a build without substitutes. I was >> surprised to see this error: >> >> Starting download of /gnu/store/hg3692jqq4jmhg4qx8d7y67fspimy898-?id=3ba68f9e64fa2eb8af22d510437a0c6441feb5e0 >> From http://git.savannah.gnu.org/cgit/coreutils.git/patch/?id=3ba68f9e64fa2eb8af22d510437a0c6441feb5e0... >> patch 1.2MiB/s 00:00 | 1KiB transferred >> output path `/gnu/store/hg3692jqq4jmhg4qx8d7y67fspimy898-?id=3ba68f9e64fa2eb8af22d510437a0c6441feb5e0' should have sha256 hash `1dnlszhc8lihhg801i9sz896mlrgfsjfcz62636prb27k5hmixqz', instead has `0zygncr1z1nswmny2vl1havfqswm40vzj0vjvhf5yndavhzr267j' >> >> From the coreutils definition: >> (patches >> (list (origin >> (method url-fetch) >> (uri "http://git.savannah.gnu.org/cgit/coreutils.git/\ >> patch/?id=3ba68f9e64fa2eb8af22d510437a0c6441feb5e0") >> (sha256 >> (base32 >> "1dnlszhc8lihhg801i9sz896mlrgfsjfcz62636prb27k5hmixqz")) >> (file-name "coreutils-tail-inotify-race.patch")))))) >> >> But indeed, it's not surprising that there's a hash mismatch... there's >> nothing here! >> >> http://git.savannah.gnu.org/cgit/coreutils.git/patch/?id=3ba68f9e64fa2eb8af22d510437a0c6441feb5e0 >> > > I updated coreutils on core-updates which included removing the patch from > the package definition. Thanks! In case it's useful, here's a patch which includes the patch itself rather than pulling it down via http. I can't verify if it works until tomorrow though. --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: inline; filename=0001-gnu-coreutils-Include-tail_forever_inotify-patch.patch Content-Transfer-Encoding: quoted-printable >From 5b4ce9e2e495afe14861db22d427b15623db4de1 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sat, 20 Feb 2016 10:52:36 -0800 Subject: [PATCH] gnu: coreutils: Include tail_forever_inotify patch. Rather than call out to git.savannah.gnu.org to fetch the patch over http= , we now include this patch locally. This is because the patch became unavailable at its prior link, probably because of an issue with cgit or = its configuration. * gnu/packages/patches/coreutils-tail-handle-kernel-dentry-unlink-race.pa= tch: New file. * gnu-system.am: Add it. * gnu/packages/base.scm (coreutils): Adjust to point to local patch path. --- gnu-system.am | 1 + gnu/packages/base.scm | 11 +-- ...ils-tail-handle-kernel-dentry-unlink-race.patch | 99 ++++++++++++++++= ++++++ 3 files changed, 103 insertions(+), 8 deletions(-) create mode 100644 gnu/packages/patches/coreutils-tail-handle-kernel-den= try-unlink-race.patch diff --git a/gnu-system.am b/gnu-system.am index 33032e9..75ae897 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -436,6 +436,7 @@ dist_patch_DATA =3D \ gnu/packages/patches/clang-libc-search-path.patch \ gnu/packages/patches/clucene-pkgconfig.patch \ gnu/packages/patches/cmake-fix-tests.patch \ + gnu/packages/patches/coreutils-tail-handle-kernel-dentry-unlink-race.p= atch \ gnu/packages/patches/cpio-gets-undeclared.patch \ gnu/packages/patches/cpio-CVE-2016-2037.patch \ gnu/packages/patches/cpufrequtils-fix-aclocal.patch \ diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index 7cef8bf..e181bd8 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -6,6 +6,7 @@ ;;; Copyright =C2=A9 2014 Alex Kost ;;; Copyright =C2=A9 2014, 2015 Manolis Fragkiskos Ragkousis ;;; Copyright =C2=A9 2016 Efraim Flashner +;;; Copyright =C2=A9 2016 Christopher Allan Webber ;;; ;;; This file is part of GNU Guix. ;;; @@ -254,14 +255,8 @@ used to apply commands with arbitrarily long argumen= ts.") (base32 "0w11jw3fb5sslf0f72kxy7llxgk1ia3a6bcw0c9kmvxrlj355mx2")) (patches - (list (origin - (method url-fetch) - (uri "http://git.savannah.gnu.org/cgit/coreutils.gi= t/\ -patch/?id=3D3ba68f9e64fa2eb8af22d510437a0c6441feb5e0") - (sha256 - (base32 - "1dnlszhc8lihhg801i9sz896mlrgfsjfcz62636prb27k5hm= ixqz")) - (file-name "coreutils-tail-inotify-race.patch")))))= ) + (list (search-patch + "coreutils-tail-handle-kernel-dentry-unlink-race.pat= ch"))))) (build-system gnu-build-system) (inputs `(("acl" ,acl) ; TODO: add SELinux ("gmp" ,gmp) ;bignums in 'expr', ya= y! diff --git a/gnu/packages/patches/coreutils-tail-handle-kernel-dentry-unl= ink-race.patch b/gnu/packages/patches/coreutils-tail-handle-kernel-dentry= -unlink-race.patch new file mode 100644 index 0000000..2452d86 --- /dev/null +++ b/gnu/packages/patches/coreutils-tail-handle-kernel-dentry-unlink-rac= e.patch @@ -0,0 +1,99 @@ +From 3ba68f9e64fa2eb8af22d510437a0c6441feb5e0 Mon Sep 17 00:00:00 2001 +From: =3D?UTF-8?q?P=3DC3=3DA1draig=3D20Brady?=3D +Date: Thu, 2 Jul 2015 08:41:25 +0100 +Subject: [PATCH] tail: handle kernel dentry unlink race +MIME-Version: 1.0 +Content-Type: text/plain; charset=3DUTF-8 +Content-Transfer-Encoding: 8bit + +Avoid the intermittent loss of "... has become inaccessible" messages. +That would cause tests/tail-2/assert.sh to fail sometimes, +mainly on uniprocessor systems. + +* src/tail.c (tail_forever_inotify): Also monitor IN_DELETE +events on the directory, to avoid a dentry unlink()..open() race, +where the open() on the deleted file was seen to succeed after an, +unlink() and a subsequent IN_ATTRIB, was sent to tail. Note an +IN_ATTRIB is sent on the monitored file to indicate the change in +number of links, and we can't just use a decrease in the number of +links to determine the file being unlinked, due to the possibility +of the file having multiple links. + +Reported by Assaf Gordon and Ludovic Court=C3=A8s. +Fixes http://bugs.gnu.org/21460 +--- + src/tail.c | 30 +++++++++++++++++++++++------- + 1 file changed, 23 insertions(+), 7 deletions(-) + +diff --git a/src/tail.c b/src/tail.c +index f916d74..2fa0ae0 100644 +--- a/src/tail.c ++++ b/src/tail.c +@@ -1429,8 +1429,8 @@ tail_forever_inotify (int wd, struct File_spec *f,= size_t n_files, + /* It's fine to add the same directory more than once. + In that case the same watch descriptor is returned. = */ + f[i].parent_wd =3D inotify_add_watch (wd, dirlen ? f[i].n= ame : ".", +- (IN_CREATE | IN_MOVED= _TO +- | IN_ATTRIB)); ++ (IN_CREATE | IN_DELET= E ++ | IN_MOVED_TO | IN_A= TTRIB)); +=20 + f[i].name[dirlen] =3D prev; +=20 +@@ -1619,9 +1619,16 @@ tail_forever_inotify (int wd, struct File_spec *f= , size_t n_files, +=20 + fspec =3D &(f[j]); +=20 +- /* Adding the same inode again will look up any existing wd. = */ +- int new_wd =3D inotify_add_watch (wd, f[j].name, inotify_wd_m= ask); +- if (new_wd < 0) ++ int new_wd =3D -1; ++ bool deleting =3D !! (ev->mask & IN_DELETE); ++ ++ if (! deleting) ++ { ++ /* Adding the same inode again will look up any existing = wd. */ ++ new_wd =3D inotify_add_watch (wd, f[j].name, inotify_wd_m= ask); ++ } ++ ++ if (! deleting && new_wd < 0) + { + if (errno =3D=3D ENOSPC || errno =3D=3D ENOMEM) + { +@@ -1639,7 +1646,8 @@ tail_forever_inotify (int wd, struct File_spec *f,= size_t n_files, + } +=20 + /* This will be false if only attributes of file change. */ +- bool new_watch =3D fspec->wd < 0 || new_wd !=3D fspec->wd; ++ bool new_watch; ++ new_watch =3D (! deleting) && (fspec->wd < 0 || new_wd !=3D f= spec->wd); +=20 + if (new_watch) + { +@@ -1683,7 +1691,7 @@ tail_forever_inotify (int wd, struct File_spec *f,= size_t n_files, + if (! fspec) + continue; +=20 +- if (ev->mask & (IN_ATTRIB | IN_DELETE_SELF | IN_MOVE_SELF)) ++ if (ev->mask & (IN_ATTRIB | IN_DELETE | IN_DELETE_SELF | IN_MOVE_= SELF)) + { + /* Note for IN_MOVE_SELF (the file we're watching has + been clobbered via a rename) we leave the watch +@@ -1695,6 +1703,14 @@ tail_forever_inotify (int wd, struct File_spec *f= , size_t n_files, + hash_delete (wd_to_name, fspec); + } +=20 ++ /* Note we get IN_ATTRIB for unlink() as st_nlink decrements. ++ The usual path is a close() done in recheck() triggers ++ an IN_DELETE_SELF event as the inode is removed. ++ However sometimes open() will succeed as even though ++ st_nlink is decremented, the dentry (cache) is not updated= . ++ Thus we depend on the IN_DELETE event on the directory ++ to trigger processing for the removed file. */ ++ + recheck (fspec, false); +=20 + continue; +--=20 +2.1.4 + --=20 2.1.4 --=-=-=--