Subject: Re: bug#26238: core-updates: Fix time zone bug in `date` 8.26

From: Marius Bakke <[email-masked]>
Date: Tue, 18 Apr 2017 20:37:04 +0200

Ludovic Courtès <[email-masked]> writes:

> Morning!
>
> Marius Bakke <[email-masked]> skribis:
>
>> Ludovic Courtès <[email-masked]> writes:
>>
>>> Hi Leo!
>>>
>>> [email-masked] (Ludovic Courtès) skribis:
>>>
>>>> Leo Famulari <[email-masked]> skribis:
>>>>
>>>>> From 466a0ebad18ee5e38f280acf19ab19aadffa2206 Mon Sep 17 00:00:00 2001
>>>>> From: Leo Famulari <[email-masked]>
>>>>> Date: Fri, 24 Mar 2017 12:18:21 -0400
>>>>> Subject: [PATCH] gnu: coreutils: Fix a time-zone bug in date 8.26.
>>>>>
>>>>> * gnu/packages/base.scm (coreutils)[replacement]: New field.
>>>>> (coreutils/fixed): New variable.
>>>>> (coreutils-minimal)[source]: Use the source of coreutils/fixed.
>>>>> * gnu/packages/commencement.scm (coreutils-final)[replacement]: New field.
>>>>> * gnu/packages/patches/coreutils-fix-time-zone-conversion.patch: New file.
>>>>> * gnu/local.mk (dist_patch_DATA): Add it.
>>>>
>>>> LGTM, thanks!
>>>
>>> Was there anything wrong with this patch?  Otherwise I still think it’s
>>> worth applying to ‘master’.
>>
>> It depends on this gnulib patch, which does not apply cleanly and needs
>> a rather difficult backport:
>>
>> https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=4e6e16b3f43ce96302b1e52e48730c1f15e18c14
>
> Oh right, sorry for being sloppy.
>
> A while back you suggested using directly 8.27 as the replacement:
>
>   https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26238#32
>
> I think it would be a good idea.
>
> Thoughts?

Here is a WIP patch that adds a graft for coreutils 8.27. I stole Leos
code for the (gnu packages commencement) part. It builds with
`./pre-inst-env guix build coreutils`, but my after reconfiguring my
system on it, `date --version` still shows 8.26.

Any idea what's wrong?

From 2636e565fa4847dc0d1c786345e98053cf783cc1 Mon Sep 17 00:00:00 2001
From: Marius Bakke <[email-masked]>
Date: Tue, 18 Apr 2017 20:13:45 +0200
Subject: [PATCH] gnu: coreutils: Replace with 8.27.

* gnu/packages/base.scm (coreutils-8.27): New variable.
(coreutils)[replacement]: New field.
(coreutils-minimal)[source]: Inherit from COREUTILS-8.27.
[replacement]: New field.
* gnu/packages/commencement.scm (coreutils-final): Set replacement #f on
coreutils derivation.

Co-authored-by: Leo Famulari <[email-masked]>
---
 gnu/packages/base.scm         | 15 +++++++++++++++
 gnu/packages/commencement.scm | 20 ++++++++++++--------
 2 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 5c36b612f..36eaabb36 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -285,6 +285,7 @@ used to apply commands with arbitrarily long arguments.")
   (package
    (name "coreutils")
    (version "8.26")
+   (replacement coreutils-8.27)
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/coreutils/coreutils-"
@@ -361,11 +362,25 @@ functionality beyond that which is outlined in the POSIX standard.")
    (license gpl3+)
    (home-page "https://www.gnu.org/software/coreutils/")))
 
+(define coreutils-8.27
+  (package
+    (inherit coreutils)
+    (version "8.27")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://gnu/coreutils/coreutils-"
+                                  version ".tar.xz"))
+              (sha256
+               (base32
+                "0sv547572iq8ayy8klir4hnngnx92a9nsazmf1wgzfc7xr4x74c8"))))))
+
 (define-public coreutils-minimal
   ;; Coreutils without its optional dependencies.
   (package
     (inherit coreutils)
     (name "coreutils-minimal")
+    (replacement #f)
+    (source (package-source coreutils-8.27))
     (outputs '("out"))
     (inputs '())))
 
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 92f6e6c2e..c9d851c4d 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -868,15 +868,19 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
   ;; The final Coreutils.  Treat them specially because some packages, such as
   ;; Findutils, keep a reference to the Coreutils they were built with.
   (package-with-bootstrap-guile
-   (package-with-explicit-inputs coreutils
-                                 %boot5-inputs
-                                 (current-source-location)
 
-                                 ;; Use the final Guile, linked against the
-                                 ;; final libc with working iconv, so that
-                                 ;; 'substitute*' works well when touching
-                                 ;; test files in Gettext.
-                                 #:guile guile-final)))
+
+   (let ((p (package-with-explicit-inputs coreutils
+                                          %boot5-inputs
+                                          (current-source-location)
+
+                                          ;; Use the final Guile, linked against the
+                                          ;; final libc with working iconv, so that
+                                          ;; 'substitute*' works well when touching
+                                          ;; test files in Gettext.
+                                          #:guile guile-final)))
+           (package (inherit p)
+                    (replacement #f)))))
 
 (define grep-final
   ;; The final grep.  Gzip holds a reference to it (via zgrep), so it must be
-- 
2.12.2