GNU bug report logs - #27893
[PATCH] gnu: julia: Work around some test failures related to libgit2.

Previous Next

Package: guix-patches;

Reported by: Leo Famulari <leo <at> famulari.name>

Date: Tue, 1 Aug 2017 00:15:02 UTC

Severity: normal

Tags: patch

Done: ludo <at> gnu.org (Ludovic Courtès)

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 27893 in the body.
You can then email your comments to 27893 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#27893; Package guix-patches. (Tue, 01 Aug 2017 00:15:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo Famulari <leo <at> famulari.name>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Tue, 01 Aug 2017 00:15:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Leo Famulari <leo <at> famulari.name>
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: julia: Work around some test failures related to libgit2.
Date: Mon, 31 Jul 2017 20:14:10 -0400
* gnu/packages/version-control.scm (libgit2-0.25): New variable.
* gnu/packages/julia.scm (julia)[inputs]: Replace LIBGIT2 with LIBGIT2-0.25.
* gnu/packages/patches/libgit2-use-after-free.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
---
 gnu/local.mk                                      |  1 +
 gnu/packages/julia.scm                            |  2 +-
 gnu/packages/patches/libgit2-use-after-free.patch | 24 +++++++++++++++++++++++
 gnu/packages/version-control.scm                  | 16 +++++++++++++++
 4 files changed, 42 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/libgit2-use-after-free.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 3fb8f168d..df8252b16 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -754,6 +754,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/libevent-2.1-dns-tests.patch		\
   %D%/packages/patches/libevent-2.1-skip-failing-test.patch	\
   %D%/packages/patches/libgit2-0.25.1-mtime-0.patch		\
+  %D%/packages/patches/libgit2-use-after-free.patch		\
   %D%/packages/patches/libgdata-fix-tests.patch			\
   %D%/packages/patches/libgdata-glib-duplicate-tests.patch	\
   %D%/packages/patches/libjxr-fix-function-signature.patch	\
diff --git a/gnu/packages/julia.scm b/gnu/packages/julia.scm
index f6df2817d..dd8ebce77 100644
--- a/gnu/packages/julia.scm
+++ b/gnu/packages/julia.scm
@@ -310,7 +310,7 @@
        ("libunwind" ,libunwind-for-julia)
        ("openlibm" ,openlibm)
        ("openspecfun" ,openspecfun)
-       ("libgit2" ,libgit2)
+       ("libgit2" ,libgit2-0.25) ; XXX Julia's libgit2 tests fail with libgit 0.26.0.
        ("fftw" ,fftw)
        ("fftwf" ,fftwf)
        ("fortran" ,gfortran)
diff --git a/gnu/packages/patches/libgit2-use-after-free.patch b/gnu/packages/patches/libgit2-use-after-free.patch
new file mode 100644
index 000000000..580af8781
--- /dev/null
+++ b/gnu/packages/patches/libgit2-use-after-free.patch
@@ -0,0 +1,24 @@
+This patch is taken from <https://github.com/libgit2/libgit2/pull/4122>;
+we need it to fix the use-after-free error in 'git_commit_extract_signature'
+reported at <https://github.com/libgit2/libgit2/issues/4118>.
+
+From ade0d9c658fdfc68d8046935f6908f033fe7a529 Mon Sep 17 00:00:00 2001
+From: Patrick Steinhardt <ps <at> pks.im>
+Date: Mon, 13 Feb 2017 13:46:17 +0100
+Subject: [PATCH 3/3] commit: avoid possible use-after-free
+
+diff --git a/src/commit.c b/src/commit.c
+index 89a4db1..05b70a9 100644
+--- a/src/commit.c
++++ b/src/commit.c
+@@ -766,8 +766,9 @@ int git_commit_extract_signature(git_buf *signature, git_buf *signed_data, git_r
+ 		if (git_buf_oom(signature))
+ 			goto oom;
+ 
++		error = git_buf_puts(signed_data, eol+1);
+ 		git_odb_object_free(obj);
+-		return git_buf_puts(signed_data, eol+1);
++		return error;
+ 	}
+ 
+ 	giterr_set(GITERR_OBJECT, "this commit is not signed");
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 9667b2f3e..a161a9662 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -380,6 +380,22 @@ write native speed custom Git applications in any language with bindings.")
     ;; GPLv2 with linking exception
     (license license:gpl2)))
 
+(define-public libgit2-0.25
+  (package
+    (inherit libgit2)
+    (name "libgit2")
+    (version "0.25.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/libgit2/libgit2/"
+                                  "archive/v" version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "1cdwcw38frc1wf28x5ppddazv9hywc718j92f3xa3ybzzycyds3s"))
+              (patches (search-patches "libgit2-use-after-free.patch"
+                                       "libgit2-0.25.1-mtime-0.patch"))))))
+
 (define-public git-crypt
   (package
     (name "git-crypt")
-- 
2.13.3





Information forwarded to guix-patches <at> gnu.org:
bug#27893; Package guix-patches. (Tue, 01 Aug 2017 09:48:02 GMT) Full text and rfc822 format available.

Message #8 received at 27893 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Leo Famulari <leo <at> famulari.name>
Cc: 27893 <at> debbugs.gnu.org
Subject: Re: [bug#27893] [PATCH] gnu: julia: Work around some test failures
 related to libgit2.
Date: Tue, 01 Aug 2017 11:46:44 +0200
[Message part 1 (text/plain, inline)]
Hi Leo,

Leo Famulari <leo <at> famulari.name> skribis:

> * gnu/packages/version-control.scm (libgit2-0.25): New variable.
> * gnu/packages/julia.scm (julia)[inputs]: Replace LIBGIT2 with LIBGIT2-0.25.
> * gnu/packages/patches/libgit2-use-after-free.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Add it.

Sorry for not noticing the breakage!  I wonder if it would be
easier/safer to fix Julia than to keep the old libgit2.

Does this upstream commit fix the failures that you saw?

[Message part 2 (text/x-patch, inline)]
commit 782460f9bab4af35097c13c4dbab61cb263490b9
Author: Milan Bouchet-Valat <nalimilan <at> club.fr>
Date:   Tue Jul 11 10:02:32 2017 +0200

    Fix libgit2 test failure with system libgit2 and OpenSSL (#22722)
    
    The first letter of the error message is in lowercase in some systems,
    notably Fedora Rawhide with libgit2 0.26 and OpenSSL 1.1.0f.

diff --git a/test/libgit2.jl b/test/libgit2.jl
index d7e32d21a9..f5104e9ec7 100644
--- a/test/libgit2.jl
+++ b/test/libgit2.jl
@@ -1905,7 +1905,8 @@ mktempdir() do dir
                         deserialize(f)
                     end
                     @test err.code == LibGit2.Error.ECERTIFICATE
-                    @test startswith(err.msg, "The SSL certificate is invalid")
+                    @test startswith(lowercase(err.msg),
+                                     lowercase("The SSL certificate is invalid"))
 
                     rm(errfile)
[Message part 3 (text/plain, inline)]
Ludo’.

Information forwarded to guix-patches <at> gnu.org:
bug#27893; Package guix-patches. (Tue, 01 Aug 2017 20:32:02 GMT) Full text and rfc822 format available.

Message #11 received at 27893 <at> debbugs.gnu.org (full text, mbox):

From: Leo Famulari <leo <at> famulari.name>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 27893 <at> debbugs.gnu.org
Subject: Re: [bug#27893] [PATCH] gnu: julia: Work around some test failures
 related to libgit2.
Date: Tue, 1 Aug 2017 16:31:40 -0400
[Message part 1 (text/plain, inline)]
On Tue, Aug 01, 2017 at 11:46:44AM +0200, Ludovic Courtès wrote:
> Hi Leo,
> 
> Leo Famulari <leo <at> famulari.name> skribis:
> 
> > * gnu/packages/version-control.scm (libgit2-0.25): New variable.
> > * gnu/packages/julia.scm (julia)[inputs]: Replace LIBGIT2 with LIBGIT2-0.25.
> > * gnu/packages/patches/libgit2-use-after-free.patch: New file.
> > * gnu/local.mk (dist_patch_DATA): Add it.
> 
> Sorry for not noticing the breakage!  I wonder if it would be
> easier/safer to fix Julia than to keep the old libgit2.
> 
> Does this upstream commit fix the failures that you saw?

The context of this patch actually doesn't exist in the Julia release.

Based on the very large number of changes to this test between releases,
my impression is that Julia is just not ready for libgit2 0.26.0, even
though there are some commits addressing libgit2 0.26.0 in Julia.

The thing is, I found this test failure building locally but on Hydra
there are different failures [0]. So, even if we fix this issue, we still
probably won't be offering a Julia substitute. Thus, I don't mind
carrying this libgit2-0.25 package privately for now.

[0]
Has anyone got the Julia test suite to pass at all? Spill the beans! :)
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#27893; Package guix-patches. (Wed, 18 Oct 2017 21:32:02 GMT) Full text and rfc822 format available.

Message #14 received at 27893 <at> debbugs.gnu.org (full text, mbox):

From: Ricardo Wurmus <rekado <at> elephly.net>
To: Leo Famulari <leo <at> famulari.name>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 27893 <at> debbugs.gnu.org
Subject: Re: [bug#27893] [PATCH] gnu: julia: Work around some test failures
 related to libgit2.
Date: Wed, 18 Oct 2017 23:15:40 +0200
Leo Famulari <leo <at> famulari.name> writes:

> Has anyone got the Julia test suite to pass at all? Spill the beans! :)

I have, repeatedly, but it’s been a while since I’ve built Julia
locally.  The tests are a bit memory-hungry if I recall correctly, but
they did pass on my workstation in the office.  I always made sure that
the tests pass and the few known failing tests were disabled.

About this patch: I’d prefer if this version of libgit were a private
variable in the julia module, just like libunwind-for-julia and
libuv-julia.

--
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
https://elephly.net






Reply sent to ludo <at> gnu.org (Ludovic Courtès):
You have taken responsibility. (Wed, 07 Mar 2018 14:04:01 GMT) Full text and rfc822 format available.

Notification sent to Leo Famulari <leo <at> famulari.name>:
bug acknowledged by developer. (Wed, 07 Mar 2018 14:04:02 GMT) Full text and rfc822 format available.

Message #19 received at 27893-done <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Leo Famulari <leo <at> famulari.name>
Cc: 27893-done <at> debbugs.gnu.org
Subject: Re: [bug#27893] [PATCH] gnu: julia: Work around some test failures
 related to libgit2.
Date: Wed, 07 Mar 2018 15:03:14 +0100
Hello,

ludo <at> gnu.org (Ludovic Courtès) skribis:

> Leo Famulari <leo <at> famulari.name> skribis:
>
>> * gnu/packages/version-control.scm (libgit2-0.25): New variable.
>> * gnu/packages/julia.scm (julia)[inputs]: Replace LIBGIT2 with LIBGIT2-0.25.
>> * gnu/packages/patches/libgit2-use-after-free.patch: New file.
>> * gnu/local.mk (dist_patch_DATA): Add it.
>
> Sorry for not noticing the breakage!  I wonder if it would be
> easier/safer to fix Julia than to keep the old libgit2.
>
> Does this upstream commit fix the failures that you saw?
>
> commit 782460f9bab4af35097c13c4dbab61cb263490b9
> Author: Milan Bouchet-Valat <nalimilan <at> club.fr>
> Date:   Tue Jul 11 10:02:32 2017 +0200
>
>     Fix libgit2 test failure with system libgit2 and OpenSSL (#22722)
>     
>     The first letter of the error message is in lowercase in some systems,
>     notably Fedora Rawhide with libgit2 0.26 and OpenSSL 1.1.0f.
>
> diff --git a/test/libgit2.jl b/test/libgit2.jl
> index d7e32d21a9..f5104e9ec7 100644
> --- a/test/libgit2.jl
> +++ b/test/libgit2.jl
> @@ -1905,7 +1905,8 @@ mktempdir() do dir
>                          deserialize(f)
>                      end
>                      @test err.code == LibGit2.Error.ECERTIFICATE
> -                    @test startswith(err.msg, "The SSL certificate is invalid")
> +                    @test startswith(lowercase(err.msg),
> +                                     lowercase("The SSL certificate is invalid"))

As it turns out, I later fixed this in a different way, having forgotten
about this discussion, in commit d40b5684c533e0188ffa213b20f2d3c88406d895.

Case closed!

Note that there are other issues discussed at
<https://bugs.gnu.org/30282>.

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 05 Apr 2018 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 359 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.