GNU bug report logs - #56322
Ruby packaging issues

Previous Next

Package: guix;

Reported by: Maxime Devos <maximedevos <at> telenet.be>

Date: Thu, 30 Jun 2022 11:16:01 UTC

Severity: normal

To reply to this bug, email your comments to 56322 AT debbugs.gnu.org.

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

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


Report forwarded to bug-guix <at> gnu.org:
bug#56322; Package guix. (Thu, 30 Jun 2022 11:16:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Maxime Devos <maximedevos <at> telenet.be>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Thu, 30 Jun 2022 11:16:02 GMT) Full text and rfc822 format available.

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

From: Maxime Devos <maximedevos <at> telenet.be>
To: bug-guix <at> gnu.org
Subject: Ruby packaging issues
Date: Thu, 30 Jun 2022 13:15:13 +0200
[Message part 1 (text/plain, inline)]
I noticed that:

  * Ruby has Autotools ./configure scripts that aren't regenerated.
  * Ruby bundles zlib.
  * Ruby contains some things generated by bison or such.

Greetings,
Maxime.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#56322; Package guix. (Wed, 24 Aug 2022 15:26:01 GMT) Full text and rfc822 format available.

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

From: Remco van 't Veer <remco <at> remworks.net>
To: 56322 <at> debbugs.gnu.org, Maxime Devos <maximedevos <at> telenet.be>
Subject: Re: Ruby packaging issues
Date: Wed, 24 Aug 2022 17:24:46 +0200
Maxime Devos wrote on 30 Jun 13:15 +0200

> I noticed that:
>
>   * Ruby has Autotools ./configure scripts that aren't regenerated.

I'll make a patch for that.  I also noticed unbundling of libffi is not
applied to all versions, will fix that too.

>   * Ruby bundles zlib.

Can you point out where it is in the source tree?  Looking at the
sources I can only find a (very beefy) wrapper around zlib which seems
to implement all kinds of zlib stuff but also depends on the zlib
library.  I dunno how to determine if this is bundling or not.

  https://github.com/ruby/ruby/blob/master/ext/zlib/zlib.c

>   * Ruby contains some things generated by bison or such.

It seems the generated parse.c file (from parse.y) is included in the
tarballs as a service to workaround a bootstrap problem; generating the
parser requires ruby.  See also:

  https://github.com/ruby/ruby/blob/master/common.mk#L910

I don't know how to deal with this properly.  The only thing I can think
of is compiling in two phases: first with the supplied parse.c and after
without.  Or try it with mruby as a native-input but that seems to
require ruby to compile too.  What's to gain by this?

Cheers,
Remco




Information forwarded to bug-guix <at> gnu.org:
bug#56322; Package guix. (Wed, 24 Aug 2022 15:29:01 GMT) Full text and rfc822 format available.

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

From: Remco van 't Veer <remco <at> remworks.net>
To: 56322 <at> debbugs.gnu.org,
	Maxime Devos <maximedevos <at> telenet.be>
Cc: Remco van 't Veer <remco <at> remworks.net>
Subject: [PATCH 0/2] Ruby packaging issues
Date: Wed, 24 Aug 2022 17:27:45 +0200
Guix style messed up the formatting and thus the diff a bit.  Sorry
about that.

Remco van 't Veer (2):
  gnu: ruby: trigger autotools bootstrap
  gnu: ruby: fix unbundling of libffi for inheriting rubies

 gnu/packages/ruby.scm | 206 ++++++++++++++++++++----------------------
 1 file changed, 98 insertions(+), 108 deletions(-)

-- 
2.37.2





Information forwarded to bug-guix <at> gnu.org:
bug#56322; Package guix. (Wed, 24 Aug 2022 15:29:02 GMT) Full text and rfc822 format available.

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

From: Remco van 't Veer <remco <at> remworks.net>
To: 56322 <at> debbugs.gnu.org,
	Maxime Devos <maximedevos <at> telenet.be>
Cc: Remco van 't Veer <remco <at> remworks.net>
Subject: [PATCH 2/2] gnu: ruby: fix unbundling of libffi for inheriting rubies
Date: Wed, 24 Aug 2022 17:27:47 +0200
* gnu/packages/ruby.scm (ruby-2.4, ruby-2.5, ruby-3.0, ruby-3.1): Inherit package-source to ensure inclusion of unbundling snippet
---
 gnu/packages/ruby.scm | 77 ++++++++++++++++++++-----------------------
 1 file changed, 36 insertions(+), 41 deletions(-)

diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index ad8ef3d390..e98814da6d 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -187,62 +187,57 @@ (define-public ruby-3.0
   (package
     (inherit ruby-2.7)
     (version "3.0.2")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (string-append "http://cache.ruby-lang.org/pub/ruby/"
-                           (version-major+minor version)
-                           "/ruby-" version ".tar.xz"))
-       (sha256
-        (base32
-         "0h2w2ms4gx2s96v3lzdr3add94bd2qqkhdjzaycmaqhg21rpf3jp"))))))
+    (source (origin
+              (inherit (package-source ruby-2.7))
+              (method url-fetch)
+              (uri (string-append "http://cache.ruby-lang.org/pub/ruby/"
+                                  (version-major+minor version) "/ruby-"
+                                  version ".tar.xz"))
+              (sha256
+               (base32
+                "0h2w2ms4gx2s96v3lzdr3add94bd2qqkhdjzaycmaqhg21rpf3jp"))))))
 
 (define-public ruby-3.1
   (package
     (inherit ruby-2.7)
     (version "3.1.1")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (string-append "http://cache.ruby-lang.org/pub/ruby/"
-                           (version-major+minor version)
-                           "/ruby-" version ".tar.xz"))
-       (sha256
-        (base32
-         "1akcl7vhmwfm6ybj7493kzy58ykh2r39ri9f4xfm2xmhg1msmvvs"))))))
+    (source (origin
+              (inherit (package-source ruby-2.7))
+              (method url-fetch)
+              (uri (string-append "http://cache.ruby-lang.org/pub/ruby/"
+                                  (version-major+minor version) "/ruby-"
+                                  version ".tar.xz"))
+              (sha256
+               (base32
+                "1akcl7vhmwfm6ybj7493kzy58ykh2r39ri9f4xfm2xmhg1msmvvs"))))))
 
 (define-public ruby-2.5
   (package
     (inherit ruby-2.6)
     (version "2.5.9")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (string-append "http://cache.ruby-lang.org/pub/ruby/"
-                           (version-major+minor version)
-                           "/ruby-" version ".tar.xz"))
-       (sha256
-        (base32
-         "1w2qncacm7h3f3il1whghdabwnv9fvwmz9f1a9vcg32006ljyzx8"))))))
+    (source (origin
+              (inherit (package-source ruby-2.6))
+              (method url-fetch)
+              (uri (string-append "http://cache.ruby-lang.org/pub/ruby/"
+                                  (version-major+minor version) "/ruby-"
+                                  version ".tar.xz"))
+              (sha256
+               (base32
+                "1w2qncacm7h3f3il1whghdabwnv9fvwmz9f1a9vcg32006ljyzx8"))))))
 
 (define-public ruby-2.4
   (package
     (inherit ruby-2.6)
     (version "2.4.10")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (string-append "http://cache.ruby-lang.org/pub/ruby/"
-                           (version-major+minor version)
-                           "/ruby-" version ".tar.xz"))
-       (sha256
-        (base32
-         "1prhqlgik1zmw9lakl6hkriqslspw48pvhxff17h7ns42p8qwrnm"))
-       (modules '((guix build utils)))
-       (snippet `(begin
-                   ;; Remove bundled libffi
-                   (delete-file-recursively "ext/fiddle/libffi-3.2.1")
-                   #t))))))
+    (source (origin
+              (inherit (package-source ruby-2.6))
+              (method url-fetch)
+              (uri (string-append "http://cache.ruby-lang.org/pub/ruby/"
+                                  (version-major+minor version) "/ruby-"
+                                  version ".tar.xz"))
+              (sha256
+               (base32
+                "1prhqlgik1zmw9lakl6hkriqslspw48pvhxff17h7ns42p8qwrnm"))))))
 
 (define-public ruby ruby-2.7)
 
-- 
2.37.2





Information forwarded to bug-guix <at> gnu.org:
bug#56322; Package guix. (Wed, 24 Aug 2022 15:29:02 GMT) Full text and rfc822 format available.

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

From: Remco van 't Veer <remco <at> remworks.net>
To: 56322 <at> debbugs.gnu.org,
	Maxime Devos <maximedevos <at> telenet.be>
Cc: Remco van 't Veer <remco <at> remworks.net>
Subject: [PATCH 1/2] gnu: ruby: trigger autotools bootstrap
Date: Wed, 24 Aug 2022 17:27:46 +0200
* gnu/packages/ruby.scm (ruby-2.6, ruby-2.7): Remove autotools artifacts
---
 gnu/packages/ruby.scm | 129 ++++++++++++++++++++----------------------
 1 file changed, 62 insertions(+), 67 deletions(-)

diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index cc95bd8d6e..ad8ef3d390 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -29,6 +29,7 @@
 ;;; Copyright © 2020 Tomás Ortín Fernández <tomasortin <at> mailbox.org>
 ;;; Copyright © 2021 Giovanni Biscuolo <g <at> xelera.eu>
 ;;; Copyright © 2022 Philip McGrath <philip <at> philipmcgrath.com>
+;;; Copyright © 2022 Remco van 't Veer <remco <at> remworks.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -101,45 +102,44 @@ (define-public ruby-2.6
   (package
     (name "ruby")
     (version "2.6.5")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (string-append "http://cache.ruby-lang.org/pub/ruby/"
-                           (version-major+minor version)
-                           "/ruby-" version ".tar.xz"))
-       (sha256
-        (base32
-         "0qhsw2mr04f3lqinkh557msr35pb5rdaqy4vdxcj91flgxqxmmnm"))
-       (modules '((guix build utils)))
-       (snippet `(begin
-                   ;; Remove bundled libffi
-                   (delete-file-recursively "ext/fiddle/libffi-3.2.1")
-                   #t))))
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://cache.ruby-lang.org/pub/ruby/"
+                                  (version-major+minor version) "/ruby-"
+                                  version ".tar.xz"))
+              (sha256
+               (base32
+                "0qhsw2mr04f3lqinkh557msr35pb5rdaqy4vdxcj91flgxqxmmnm"))
+              (modules '((guix build utils)))
+              (snippet `(begin
+                          ;; Remove bundled libffi
+                          (delete-file-recursively "ext/fiddle/libffi-3.2.1")
+                          ;; Trigger bootstap
+                          (delete-file "configure")
+                          (delete-file "aclocal.m4")
+                          #t))))
     (build-system gnu-build-system)
     (arguments
      `(#:test-target "test"
-       #:configure-flags '("--enable-shared") ; dynamic linking
-       #:phases
-       (modify-phases %standard-phases
-         (add-before 'configure 'replace-bin-sh-and-remove-libffi
-           (lambda _
-             (substitute* '("Makefile.in"
-                            "ext/pty/pty.c"
-                            "io.c"
-                            "lib/mkmf.rb"
-                            "process.c"
-                            "test/rubygems/test_gem_ext_configure_builder.rb"
-                            "test/rdoc/test_rdoc_parser.rb"
-                            "test/ruby/test_rubyoptions.rb"
-                            "test/ruby/test_process.rb"
-                            "test/ruby/test_system.rb"
-                            "tool/rbinstall.rb")
-               (("/bin/sh") (which "sh")))
-             #t)))))
-    (inputs
-     (list readline openssl libffi gdbm))
-    (propagated-inputs
-     (list zlib))
+       #:configure-flags '("--enable-shared") ;dynamic linking
+       #:phases (modify-phases %standard-phases
+                  (add-before 'configure 'replace-bin-sh-and-remove-libffi
+                    (lambda _
+                      (substitute* '("Makefile.in" "ext/pty/pty.c"
+                                     "io.c"
+                                     "lib/mkmf.rb"
+                                     "process.c"
+                                     "test/rubygems/test_gem_ext_configure_builder.rb"
+                                     "test/rdoc/test_rdoc_parser.rb"
+                                     "test/ruby/test_rubyoptions.rb"
+                                     "test/ruby/test_process.rb"
+                                     "test/ruby/test_system.rb"
+                                     "tool/rbinstall.rb")
+                        (("/bin/sh")
+                         (which "sh"))) #t)))))
+    (inputs (list readline openssl libffi gdbm))
+    (propagated-inputs (list zlib))
+    (native-inputs (list autoconf automake))
     (native-search-paths
      (list (search-path-specification
             (variable "GEM_PATH")
@@ -154,39 +154,34 @@ (define-public ruby-2.7
   (package
     (inherit ruby-2.6)
     (version "2.7.4")
-    (source
-     (origin
-       (inherit (package-source ruby-2.6))
-       (uri (string-append "https://cache.ruby-lang.org/pub/ruby/"
-                           (version-major+minor version)
-                           "/ruby-" version ".tar.gz"))
-       (sha256
-        (base32
-         "0nxwkxh7snmjqf787qsp4i33mxd1rbf9yzyfiky5k230i680jhrh"))))
+    (source (origin
+              (inherit (package-source ruby-2.6))
+              (uri (string-append "https://cache.ruby-lang.org/pub/ruby/"
+                                  (version-major+minor version) "/ruby-"
+                                  version ".tar.gz"))
+              (sha256
+               (base32
+                "0nxwkxh7snmjqf787qsp4i33mxd1rbf9yzyfiky5k230i680jhrh"))))
     (arguments
      `(#:test-target "test"
-       #:configure-flags '("--enable-shared") ; dynamic linking
-       #:phases
-       (modify-phases %standard-phases
-         (add-before 'configure 'replace-bin-sh-and-remove-libffi
-           (lambda _
-             (substitute* '("configure.ac"
-                            "template/Makefile.in"
-                            "lib/rubygems/installer.rb"
-                            "ext/pty/pty.c"
-                            "io.c"
-                            "lib/mkmf.rb"
-                            "process.c"
-                            "test/rubygems/test_gem_ext_configure_builder.rb"
-                            "test/rdoc/test_rdoc_parser.rb"
-                            "test/ruby/test_rubyoptions.rb"
-                            "test/ruby/test_process.rb"
-                            "test/ruby/test_system.rb"
-                            "tool/rbinstall.rb")
-               (("/bin/sh") (which "sh")))
-             #t)))))
-    (native-inputs
-     (list autoconf))))
+       #:configure-flags '("--enable-shared") ;dynamic linking
+       #:phases (modify-phases %standard-phases
+                  (add-before 'configure 'replace-bin-sh-and-remove-libffi
+                    (lambda _
+                      (substitute* '("configure.ac" "template/Makefile.in"
+                                     "lib/rubygems/installer.rb"
+                                     "ext/pty/pty.c"
+                                     "io.c"
+                                     "lib/mkmf.rb"
+                                     "process.c"
+                                     "test/rubygems/test_gem_ext_configure_builder.rb"
+                                     "test/rdoc/test_rdoc_parser.rb"
+                                     "test/ruby/test_rubyoptions.rb"
+                                     "test/ruby/test_process.rb"
+                                     "test/ruby/test_system.rb"
+                                     "tool/rbinstall.rb")
+                        (("/bin/sh")
+                         (which "sh"))) #t)))))))
 
 (define-public ruby-3.0
   (package
-- 
2.37.2





Information forwarded to bug-guix <at> gnu.org:
bug#56322; Package guix. (Wed, 24 Aug 2022 18:39:01 GMT) Full text and rfc822 format available.

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

From: Maxime Devos <maximedevos <at> telenet.be>
To: Remco van 't Veer <remco <at> remworks.net>, 56322 <at> debbugs.gnu.org
Subject: Re: Ruby packaging issues
Date: Wed, 24 Aug 2022 20:38:43 +0200
[Message part 1 (text/plain, inline)]
On 24-08-2022 17:24, Remco van 't Veer wrote:
> [...]
>>    * Ruby bundles zlib.
> Can you point out where it is in the source tree?  Looking at the
> sources I can only find a (very beefy) wrapper around zlib which seems
> to implement all kinds of zlib stuff but also depends on the zlib
> library.  I dunno how to determine if this is bundling or not.
>
>    https://github.com/ruby/ruby/blob/master/ext/zlib/zlib.c

I probably confused the wrapper for a local copy of zlib, nevermind.

There's a zlib-1.2.11-mswin.patch though, I wonder what's up with that.

>>    * Ruby contains some things generated by bison or such.
> It seems the generated parse.c file (from parse.y) is included in the
> tarballs as a service to workaround a bootstrap problem; generating the
> parser requires ruby.  See also:
>
>    https://github.com/ruby/ruby/blob/master/common.mk#L910
>
> I don't know how to deal with this properly.  The only thing I can think
> of is compiling in two phases: first with the supplied parse.c and after
> without.  Or try it with mruby as a native-input but that seems to
> require ruby to compile too.

We have a bunch of old rubies packaged, maybe it can be generated with 
one of the old versions? Though possibly the old versions have the same 
problem, I haven't checked.

If not: fully properly generating it might not be possible, but 
something in-between could be an option:

1. First, use the pre-generated parse.c.
2. Once ruby is built, regenerate the parse.c, and verify that it is
   the same as the old parse.c (ignoring the timestamp)

> What's to gain by this?

(1) I would assume it is much easier to hide malware in a generated file 
like parse.c than in the real source code (*) (IIRC, the .c code 
generated by bison is much longer than the .y). By generating the 
parse.c, the potential issue is side-stepped; any security reviewers 
wouldn't even have to look at parse.c because the pre-generated parse.c 
isn't used, it's regenerated.

(2) Also: generators like Bison can have bugs, fixed in later versions. 
Now imagine that Bison had, say, a buffer overflow bug, and that 
distro's just used the pre-generated parse.c. Then once a fixed version 
of Bison comes out, we would have to check every package to see if it 
has a pre-generated parser. It would be much less stressful to just 
always generate parsers from source, then once the version of Bison in 
Guix is updated then all packages automatically get the buffer overflow fix.

I don't think my in-between proposal helps much with (1) in case of a 
competent attacker (though it could stop some insufficiently 
sophisticated attacks where the parse.c malware doesn't try to subvert 
the later check), but it still helps with (2) -- it at least detects if 
ruby used an old bison (and hence that a patch might be in order)

Greetings,
Maxime.

(*) Caveat: I don't have any statistics on this.

[Message part 2 (text/html, inline)]
[OpenPGP_0x49E3EE22191725EE.asc (application/pgp-keys, attachment)]
[OpenPGP_signature (application/pgp-signature, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#56322; Package guix. (Wed, 24 Aug 2022 18:42:02 GMT) Full text and rfc822 format available.

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

From: Maxime Devos <maximedevos <at> telenet.be>
To: Remco van 't Veer <remco <at> remworks.net>, 56322 <at> debbugs.gnu.org
Subject: Re: Ruby packaging issues
Date: Wed, 24 Aug 2022 20:41:14 +0200
[Message part 1 (text/plain, inline)]
On 24-08-2022 17:24, Remco van 't Veer wrote:
>>    * Ruby contains some things generated by bison or such.
> It seems the generated parse.c file (from parse.y) is included in the
> tarballs as a service to workaround a bootstrap problem; generating the
> parser requires ruby.  See also:
>
>    https://github.com/ruby/ruby/blob/master/common.mk#L910

See my other reply, and also:

Even if generating the .c from the .y from the Ruby code would be ideal, 
at least generating the .c from the .y (and using the pre-generated the 
.y) is still an improvement, it would at least help with the 'buggy 
bison' scenario.

Greetings,
Maxime.

[Message part 2 (text/html, inline)]
[OpenPGP_0x49E3EE22191725EE.asc (application/pgp-keys, attachment)]
[OpenPGP_signature (application/pgp-signature, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#56322; Package guix. (Thu, 25 Aug 2022 10:45:02 GMT) Full text and rfc822 format available.

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

From: Remco van 't Veer <remco <at> remworks.net>
To: Maxime Devos <maximedevos <at> telenet.be>
Cc: 56322 <at> debbugs.gnu.org
Subject: Re: Ruby packaging issues
Date: Thu, 25 Aug 2022 12:44:26 +0200
2022/08/24 20:38, Maxime Devos:

> We have a bunch of old rubies packaged, maybe it can be generated with
> one of the old versions? Though possibly the old versions have the
> same problem, I haven't checked.

Older rubies need ruby to compile too, I checked.  To totally getting
rid of parse.c is not easy.

> If not: fully properly generating it might not be possible, but
> something in-between could be an option:
>
> 1. First, use the pre-generated parse.c.
> 2. Once ruby is built, regenerate the parse.c, and verify that it is
>    the same as the old parse.c (ignoring the timestamp)
>
>> What's to gain by this?
>
> (1) I would assume it is much easier to hide malware in a generated
> file like parse.c than in the real source code (*) (IIRC, the .c code
> generated by bison is much longer than the .y). By generating the
> parse.c, the potential issue is side-stepped; any security reviewers
> wouldn't even have to look at parse.c because the pre-generated
> parse.c isn't used, it's regenerated.

By using one ruby to support compiling the others said security reviewer
can focus on one particular parse.c.  It's big but reviewing it seems
doable but I am no security reviewer.

> (2) Also: generators like Bison can have bugs, fixed in later
> versions. Now imagine that Bison had, say, a buffer overflow bug, and
> that distro's just used the pre-generated parse.c. Then once a fixed
> version of Bison comes out, we would have to check every package to
> see if it has a pre-generated parser. It would be much less stressful
> to just always generate parsers from source, then once the version of
> Bison in Guix is updated then all packages automatically get the
> buffer overflow fix.
>
> I don't think my in-between proposal helps much with (1) in case of a
> competent attacker (though it could stop some insufficiently
> sophisticated attacks where the parse.c malware doesn't try to subvert
> the later check), but it still helps with (2) -- it at least detects
> if ruby used an old bison (and hence that a patch might be in order)

The two phase build approach (first building with parse.c and then using
that ruby as native-input for a package with parse.c removed) seems to
work but with some notes.  Rubies 2.7 and up work fine with bison
current in guix (bison-3.7.6) but ruby-2.6 (and possibly down) don't
because they trigger some incompatibility between bison-3.5.1 (stated as
parse.c generator in ruby-2.6) and bison-3.7.6.

I tried bison-3.0 from gnu/packages/bison for ruby-2.6 and it works but
using that kinda defeats the ".. automatically get the buffer overflow
fix" argument.  I'd say, it doesn't really matter for ruby-2.6 and down
since they are EOL anyway and should at some point be removed from guix.

I'll post a patch after this message for feedback.  In it a new package
is introduced based on ruby-2.7 named baseruby which is compiled with
the parse.c from the tarball, ruby-2.7 and up will delete parse.c before
build and have extra native-inputs on baseruby and bison to support the
magic.

Cheers,
Remco




Information forwarded to bug-guix <at> gnu.org:
bug#56322; Package guix. (Thu, 25 Aug 2022 10:46:01 GMT) Full text and rfc822 format available.

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

From: Remco van 't Veer <remco <at> remworks.net>
To: 56322 <at> debbugs.gnu.org,
	Maxime Devos <maximedevos <at> telenet.be>
Cc: Remco van 't Veer <remco <at> remworks.net>
Subject: [PATCH] gnu: ruby: regenerate parse.c
Date: Thu, 25 Aug 2022 12:45:10 +0200
* gnu/packages/ruby.scm (baseruby, ruby-2.7): Use bootstrap baseruby to regenerate parse.c
---
 gnu/packages/ruby.scm | 30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index e98814da6d..8de6cda257 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -161,7 +161,16 @@ (define-public ruby-2.7
                                   version ".tar.gz"))
               (sha256
                (base32
-                "0nxwkxh7snmjqf787qsp4i33mxd1rbf9yzyfiky5k230i680jhrh"))))
+                "0nxwkxh7snmjqf787qsp4i33mxd1rbf9yzyfiky5k230i680jhrh"))
+              (snippet `(begin
+                          ;; Remove bundled libffi
+                          (delete-file-recursively "ext/fiddle/libffi-3.2.1")
+                          ;; Trigger bootstap
+                          (delete-file "configure")
+                          (delete-file "aclocal.m4")
+                          ;; Trigger rebuild of parse.c from parse.y
+                          (delete-file "parse.c")
+                          #t))))
     (arguments
      `(#:test-target "test"
        #:configure-flags '("--enable-shared") ;dynamic linking
@@ -181,7 +190,24 @@ (define-public ruby-2.7
                                      "test/ruby/test_system.rb"
                                      "tool/rbinstall.rb")
                         (("/bin/sh")
-                         (which "sh"))) #t)))))))
+                         (which "sh"))) #t)))))
+    (native-inputs (list autoconf automake baseruby bison))))
+
+(define baseruby ;; used to build ruby by parser generator
+  (package
+    (inherit ruby-2.7)
+    (name "baseruby")
+    (source (origin
+              (inherit (package-source ruby-2.7))
+              ;; override snippet to not include deletion of bundled parse.c
+              (snippet `(begin
+                          ;; Remove bundled libffi
+                          (delete-file-recursively "ext/fiddle/libffi-3.2.1")
+                          ;; Trigger bootstap
+                          (delete-file "configure")
+                          (delete-file "aclocal.m4")
+                          #t))))
+    (native-inputs (list autoconf automake))))
 
 (define-public ruby-3.0
   (package
-- 
2.37.2





Information forwarded to bug-guix <at> gnu.org:
bug#56322; Package guix. (Sat, 08 Oct 2022 10:03:01 GMT) Full text and rfc822 format available.

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

From: Remco van 't Veer <remco <at> remworks.net>
To: 56322 <at> debbugs.gnu.org, Maxime Devos <maximedevos <at> telenet.be>
Subject: Debbug 56322, Ruby packaging issues, ping?
Date: Sat, 08 Oct 2022 12:01:55 +0200
Do the patches[1][2] need more work?


[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=56322#11
[2] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=56322#29




Information forwarded to bug-guix <at> gnu.org:
bug#56322; Package guix. (Sun, 09 Oct 2022 09:16:02 GMT) Full text and rfc822 format available.

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

From: Maxime Devos <maximedevos <at> telenet.be>
To: Remco van 't Veer <remco <at> remworks.net>, 56322 <at> debbugs.gnu.org
Subject: Re: Debbug 56322, Ruby packaging issues, ping?
Date: Sun, 9 Oct 2022 11:15:08 +0200
[Message part 1 (text/plain, inline)]

On 08-10-2022 12:01, Remco van 't Veer wrote:
> Do the patches[1][2] need more work?
> 
> 
> [1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=56322#11
> [2] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=56322#29

Trailing #t haven' been necessary since a long time, and  ...

> + (define baseruby ;; used to build ruby by parser generator

... I don't think this is quite grammatical, maybe ';; for bootstrapping 
ruby's parser generator' or ';; used to build ruby's parser generator'?

Otherwise, not that I know of, these patches appear straightforward. 
They might need to be done on core-updates though -- unless this has 
changed, IIRC ruby-asciidoctor is deep in the package graph.

Greetings,
Maxime.
[OpenPGP_0x49E3EE22191725EE.asc (application/pgp-keys, attachment)]
[OpenPGP_signature (application/pgp-signature, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#56322; Package guix. (Mon, 10 Oct 2022 05:06:01 GMT) Full text and rfc822 format available.

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

From: Remco van 't Veer <remco <at> remworks.net>
To: Maxime Devos <maximedevos <at> telenet.be>
Cc: 56322 <at> debbugs.gnu.org
Subject: Re: Debbug 56322, Ruby packaging issues, ping?
Date: Mon, 10 Oct 2022 07:05:09 +0200
Hi Maxime,

Thanks for taking a look again.  I'll make a new patchset to correct the
things you mentioned.

2022/10/09 11:15, Maxime Devos:

> Otherwise, not that I know of, these patches appear
> straightforward. They might need to be done on core-updates though --
> unless this has changed, IIRC ruby-asciidoctor is deep in the package
> graph.

What's the protocol for "doing on core-updates"?  I guess I can rebase
on that but who will or should pick up these patches?  Is there somebody
I need to ping?

Remco




Information forwarded to bug-guix <at> gnu.org:
bug#56322; Package guix. (Mon, 10 Oct 2022 10:28:02 GMT) Full text and rfc822 format available.

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

From: Maxime Devos <maximedevos <at> telenet.be>
To: Remco van 't Veer <remco <at> remworks.net>
Cc: 56322 <at> debbugs.gnu.org
Subject: Re: Debbug 56322, Ruby packaging issues, ping?
Date: Mon, 10 Oct 2022 12:27:29 +0200
[Message part 1 (text/plain, inline)]
On 10-10-2022 07:05, Remco van 't Veer wrote:
> Hi Maxime,
> 
> Thanks for taking a look again.  I'll make a new patchset to correct the
> things you mentioned.
> 
> 2022/10/09 11:15, Maxime Devos:
> 
>> Otherwise, not that I know of, these patches appear
>> straightforward. They might need to be done on core-updates though --
>> unless this has changed, IIRC ruby-asciidoctor is deep in the package
>> graph.
> 
> What's the protocol for "doing on core-updates"?  I guess I can rebase
> on that but who will or should pick up these patches?  Is there somebody
> I need to ping?

It's the same as master (no separate people), but to avoid someone 
accidentally applying it to the wrong patch, it is recommended to prefix 
the subject with [PATCH core-updates] instead of [PATCH].

The manual has some information on when something should be on 
core-updates or master.

Greetings,
Maxime.
[OpenPGP_0x49E3EE22191725EE.asc (application/pgp-keys, attachment)]
[OpenPGP_signature (application/pgp-signature, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#56322; Package guix. (Wed, 12 Oct 2022 13:36:02 GMT) Full text and rfc822 format available.

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

From: Remco van 't Veer <remco <at> remworks.net>
To: 56322 <at> debbugs.gnu.org
Cc: Maxime Devos <maximedevos <at> telenet.be>,
 Remco van 't Veer <remco <at> remworks.net>
Subject: [PATCH core-updates 0/3]  Ruby packaging issues
Date: Wed, 12 Oct 2022 15:35:26 +0200
Applied changes from feedback by Maxime Devos and rebased on
core-updates.

Remco van 't Veer (3):
  gnu: ruby: trigger autotools bootstrap
  gnu: ruby: fix unbundling of libffi for inheriting rubies
  gnu: ruby: regenerate parse.c

 gnu/packages/ruby.scm | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)


base-commit: 685110045c04a60bf18163aab1c230f944c871c9
-- 
2.37.3





Information forwarded to bug-guix <at> gnu.org:
bug#56322; Package guix. (Wed, 12 Oct 2022 13:36:02 GMT) Full text and rfc822 format available.

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

From: Remco van 't Veer <remco <at> remworks.net>
To: 56322 <at> debbugs.gnu.org
Cc: Maxime Devos <maximedevos <at> telenet.be>,
 Remco van 't Veer <remco <at> remworks.net>
Subject: [PATCH core-updates 1/3] gnu: ruby: trigger autotools bootstrap
Date: Wed, 12 Oct 2022 15:35:27 +0200
* gnu/packages/ruby.scm (ruby-2.6, ruby-2.7): Remove autotools artifacts
---
 gnu/packages/ruby.scm | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index e1b71a0a1a..25d7aba933 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -116,7 +116,9 @@ (define-public ruby-2.6
        (snippet `(begin
                    ;; Remove bundled libffi
                    (delete-file-recursively "ext/fiddle/libffi-3.2.1")
-                   #t))))
+                   ;; Trigger bootstap
+                   (delete-file "configure")
+                   (delete-file "aclocal.m4")))))
     (build-system gnu-build-system)
     (arguments
      `(#:test-target "test"
@@ -142,6 +144,7 @@ (define-public ruby-2.6
      (list readline openssl-1.1 libffi gdbm))
     (propagated-inputs
      (list zlib))
+    (native-inputs (list autoconf automake))
     (native-search-paths
      (list (search-path-specification
             (variable "GEM_PATH")
@@ -185,10 +188,7 @@ (define-public ruby-2.7
                             "test/ruby/test_process.rb"
                             "test/ruby/test_system.rb"
                             "tool/rbinstall.rb")
-               (("/bin/sh") (which "sh")))
-             #t)))))
-    (native-inputs
-     (list autoconf))))
+               (("/bin/sh") (which "sh"))))))))))
 
 (define-public ruby-3.0
   (package
-- 
2.37.3





Information forwarded to bug-guix <at> gnu.org:
bug#56322; Package guix. (Wed, 12 Oct 2022 13:36:02 GMT) Full text and rfc822 format available.

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

From: Remco van 't Veer <remco <at> remworks.net>
To: 56322 <at> debbugs.gnu.org
Cc: Maxime Devos <maximedevos <at> telenet.be>,
 Remco van 't Veer <remco <at> remworks.net>
Subject: [PATCH core-updates 2/3] gnu: ruby: fix unbundling of libffi for
 inheriting rubies
Date: Wed, 12 Oct 2022 15:35:28 +0200
* gnu/packages/ruby.scm (ruby-3.0, ruby-3.1): Inherit package-source to ensure inclusion of unbundling snippet
---
 gnu/packages/ruby.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 25d7aba933..bd55d5ac6d 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -196,6 +196,7 @@ (define-public ruby-3.0
     (version "3.0.4")
     (source
      (origin
+       (inherit (package-source ruby-2.7))
        (method url-fetch)
        (uri (string-append "http://cache.ruby-lang.org/pub/ruby/"
                            (version-major+minor version)
@@ -213,6 +214,7 @@ (define-public ruby-3.1
     (version "3.1.2")
     (source
      (origin
+       (inherit (package-source ruby-3.0))
        (method url-fetch)
        (uri (string-append "http://cache.ruby-lang.org/pub/ruby/"
                            (version-major+minor version)
-- 
2.37.3





Information forwarded to bug-guix <at> gnu.org:
bug#56322; Package guix. (Wed, 12 Oct 2022 13:36:03 GMT) Full text and rfc822 format available.

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

From: Remco van 't Veer <remco <at> remworks.net>
To: 56322 <at> debbugs.gnu.org
Cc: Maxime Devos <maximedevos <at> telenet.be>,
 Remco van 't Veer <remco <at> remworks.net>
Subject: [PATCH core-updates 3/3] gnu: ruby: regenerate parse.c
Date: Wed, 12 Oct 2022 15:35:29 +0200
* gnu/packages/ruby.scm (baseruby, ruby-2.7): Use bootstrap baseruby to regenerate parse.c
---
 gnu/packages/ruby.scm | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index bd55d5ac6d..497271f442 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -188,7 +188,23 @@ (define-public ruby-2.7
                             "test/ruby/test_process.rb"
                             "test/ruby/test_system.rb"
                             "tool/rbinstall.rb")
-               (("/bin/sh") (which "sh"))))))))))
+               (("/bin/sh") (which "sh"))))))))
+    (native-inputs (list autoconf automake baseruby bison))))
+
+(define baseruby ;; for bootstrapping ruby's parser generator
+  (package
+    (inherit ruby-2.7)
+    (name "baseruby")
+    (source (origin
+              (inherit (package-source ruby-2.7))
+              ;; override snippet to not include deletion of bundled parse.c
+              (snippet `(begin
+                          ;; Remove bundled libffi
+                          (delete-file-recursively "ext/fiddle/libffi-3.2.1")
+                          ;; Trigger bootstap
+                          (delete-file "configure")
+                          (delete-file "aclocal.m4")))))
+    (native-inputs (list autoconf automake))))
 
 (define-public ruby-3.0
   (package
-- 
2.37.3





This bug report was last modified 2 years and 247 days ago.

Previous Next


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