guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Missing patch on savannah means coreutils can't build


From: Christopher Allan Webber
Subject: Re: Missing patch on savannah means coreutils can't build
Date: Sat, 20 Feb 2016 15:19:46 -0800

Efraim Flashner writes:

> On Sat, 20 Feb 2016 10:19:51 -0800
> Christopher Allan Webber <address@hidden> 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.

>From 5b4ce9e2e495afe14861db22d427b15623db4de1 Mon Sep 17 00:00:00 2001
From: Christopher Allan Webber <address@hidden>
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.patch:
  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-dentry-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 =                                           
\
   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.patch   
\
   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 © 2014 Alex Kost <address@hidden>
 ;;; Copyright © 2014, 2015 Manolis Fragkiskos Ragkousis <address@hidden>
 ;;; Copyright © 2016 Efraim Flashner <address@hidden>
+;;; Copyright © 2016 Christopher Allan Webber <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -254,14 +255,8 @@ used to apply commands with arbitrarily long arguments.")
              (base32
               "0w11jw3fb5sslf0f72kxy7llxgk1ia3a6bcw0c9kmvxrlj355mx2"))
             (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"))))))
+             (list (search-patch
+                    
"coreutils-tail-handle-kernel-dentry-unlink-race.patch")))))
    (build-system gnu-build-system)
    (inputs `(("acl"  ,acl)                        ; TODO: add SELinux
              ("gmp"  ,gmp)                        ;bignums in 'expr', yay!
diff --git 
a/gnu/packages/patches/coreutils-tail-handle-kernel-dentry-unlink-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-race.patch
@@ -0,0 +1,99 @@
+From 3ba68f9e64fa2eb8af22d510437a0c6441feb5e0 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?P=C3=A1draig=20Brady?= <address@hidden>
+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=UTF-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ès.
+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 = inotify_add_watch (wd, dirlen ? f[i].name : 
".",
+-                                                  (IN_CREATE | IN_MOVED_TO
+-                                                   | IN_ATTRIB));
++                                                  (IN_CREATE | IN_DELETE
++                                                   | IN_MOVED_TO | 
IN_ATTRIB));
+ 
+               f[i].name[dirlen] = prev;
+ 
+@@ -1619,9 +1619,16 @@ tail_forever_inotify (int wd, struct File_spec *f, 
size_t n_files,
+ 
+           fspec = &(f[j]);
+ 
+-          /* Adding the same inode again will look up any existing wd.  */
+-          int new_wd = inotify_add_watch (wd, f[j].name, inotify_wd_mask);
+-          if (new_wd < 0)
++          int new_wd = -1;
++          bool deleting = !! (ev->mask & IN_DELETE);
++
++          if (! deleting)
++            {
++              /* Adding the same inode again will look up any existing wd.  */
++              new_wd = inotify_add_watch (wd, f[j].name, inotify_wd_mask);
++            }
++
++          if (! deleting && new_wd < 0)
+             {
+               if (errno == ENOSPC || errno == ENOMEM)
+                 {
+@@ -1639,7 +1646,8 @@ tail_forever_inotify (int wd, struct File_spec *f, 
size_t n_files,
+             }
+ 
+           /* This will be false if only attributes of file change.  */
+-          bool new_watch = fspec->wd < 0 || new_wd != fspec->wd;
++          bool new_watch;
++          new_watch = (! deleting) && (fspec->wd < 0 || new_wd != fspec->wd);
+ 
+           if (new_watch)
+             {
+@@ -1683,7 +1691,7 @@ tail_forever_inotify (int wd, struct File_spec *f, 
size_t n_files,
+       if (! fspec)
+         continue;
+ 
+-      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);
+             }
+ 
++          /* 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);
+ 
+           continue;
+-- 
+2.1.4
+
-- 
2.1.4


reply via email to

[Prev in Thread] Current Thread [Next in Thread]