Subject: bug#27308: [PATCH] gnu: gnutls: Replace with 3.5.13.

From: Marius Bakke <[email-masked]>
Date: Sat, 10 Jun 2017 18:37:19 +0200

Marius Bakke <[email-masked]> writes:

> I tested this graft on my profile, but apparently the grafting code
> checks the store item length and refuses since the .13 is one byte
> longer than .9:

[...]

> ERROR: In procedure scm-error:
> ERROR: replacement length differs from the original length "56dbd2gw33g3wdxmq78lr39lamg8gxnq-gnutls-3.5.9" "78kvf0ma45z3h14850wzkcvz3zqg59xy-gnutls-3.5.13"

The attached patch allows the graft to proceed, but I'm not sure about
the sanity of it all. Thoughts?

From 5f122f6e1b73fb7a664142a20ac70890cb6956f9 Mon Sep 17 00:00:00 2001
From: Marius Bakke <[email-masked]>
Date: Sat, 10 Jun 2017 18:31:03 +0200
Subject: [PATCH] build: graft: Allow longer replacement store names.

* guix/build/graft.scm (rewrite-directory): Only fail if replacement name is shorter.
---
 guix/build/graft.scm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/guix/build/graft.scm b/guix/build/graft.scm
index 16df169ec..2b3b99cb1 100644
--- a/guix/build/graft.scm
+++ b/guix/build/graft.scm
@@ -263,9 +263,9 @@ file name pairs."
              (((= hash+rest (origin-hash origin-string))
                .
                (= hash+rest (replacement-hash replacement-string)))
-              (unless (= (string-length origin-string)
-                         (string-length replacement-string))
-                (error "replacement length differs from the original length"
+              (unless (<= (string-length origin-string)
+                          (string-length replacement-string))
+                (error "replacement length is shorter than the original length"
                        origin-string replacement-string))
               (cons origin-hash (string->utf8 replacement-string)))
              ((origin . replacement)
-- 
2.13.1