GNU bug report logs - #39146
[PATCH] gnu: icecat: Remove compiler paths from about:buildconfig

Previous Next

Package: guix-patches;

Reported by: Jakub Kądziołka <kuba <at> kadziolka.net>

Date: Wed, 15 Jan 2020 22:22:01 UTC

Severity: normal

Tags: patch

Done: Jakub Kądziołka <kuba <at> kadziolka.net>

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 39146 in the body.
You can then email your comments to 39146 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#39146; Package guix-patches. (Wed, 15 Jan 2020 22:22:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jakub Kądziołka <kuba <at> kadziolka.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Wed, 15 Jan 2020 22:22:02 GMT) Full text and rfc822 format available.

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

From: Jakub Kądziołka <kuba <at> kadziolka.net>
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: icecat: Remove compiler paths from about:buildconfig
Date: Wed, 15 Jan 2020 23:21:15 +0100
* gnu/packages/gnuzilla.scm
  (icecat)[arguments](dont-store-compiler-paths): New phase.
---
 gnu/packages/gnuzilla.scm | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm
index c619cd5d55..ae155e51ba 100644
--- a/gnu/packages/gnuzilla.scm
+++ b/gnu/packages/gnuzilla.scm
@@ -890,6 +890,16 @@ from forcing GEXP-PROMISE."
              (substitute* '("browser/confvars.sh")
                (("MOZ_SERVICES_SYNC=0") "MOZ_SERVICES_SYNC=1"))
              #t))
+         (add-after 'unpack 'dont-store-compiler-paths
+           (lambda _
+             ;; Remove references to the compilers used from the output. Reduces
+             ;; `guix size icecat' by 1 GiB on x86-64.
+             (let ((zap "Store reference removed"))
+               (substitute* "toolkit/content/buildconfig.html"
+                 (("@CC@") zap)
+                 (("@CXX@") zap)
+                 (("@RUSTC@") zap)
+                 (("@MOZ_CONFIGURE_OPTIONS@") zap)))))
          (add-after 'unpack 'apply-guix-specific-patches
            (lambda* (#:key inputs native-inputs #:allow-other-keys)
              (let ((patch (string-append (assoc-ref (or native-inputs inputs)
-- 
2.24.1





Information forwarded to guix-patches <at> gnu.org:
bug#39146; Package guix-patches. (Tue, 21 Jan 2020 17:38:01 GMT) Full text and rfc822 format available.

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

From: Jakub Kądziołka <kuba <at> kadziolka.net>
To: 39146 <at> debbugs.gnu.org
Subject: [PATCH v2] gnu: icecat: Remove compiler paths from about:buildconfig
Date: Tue, 21 Jan 2020 18:37:11 +0100
* gnu/packages/gnuzilla.scm
  (icecat)[arguments](dont-store-compiler-paths): New phase.
---
 gnu/packages/gnuzilla.scm | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm
index ae0c58eedb..d32333ca96 100644
--- a/gnu/packages/gnuzilla.scm
+++ b/gnu/packages/gnuzilla.scm
@@ -11,6 +11,7 @@
 ;;; Copyright © 2018 Ricardo Wurmus <rekado <at> elephly.net>
 ;;; Copyright © 2019 Ivan Petkov <ivanppetkov <at> gmail.com>
 ;;; Copyright © 2020 Oleg Pykhalov <go.wigust <at> gmail.com>
+;;; Copyright © 2020 Jakub Kądziołka <kuba <at> kadziolka.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -906,6 +907,16 @@ from forcing GEXP-PROMISE."
                                       "-p1" "--input" file))))
                          (or native-inputs inputs)))
              #t))
+         (add-after 'unpack 'dont-store-compiler-paths
+           (lambda _
+             ;; Remove references to the compilers used from the output. Reduces
+             ;; `guix size icecat' by 1 GiB on x86-64.
+             (let ((zap "Store reference removed"))
+               (substitute* "toolkit/content/buildconfig.html"
+                 (("@CC@") zap)
+                 (("@CXX@") zap)
+                 (("@RUSTC@") zap)
+                 (("@MOZ_CONFIGURE_OPTIONS@") zap)))))
          (add-after 'apply-guix-specific-patches 'remove-bundled-libraries
            (lambda _
              ;; Remove bundled libraries that we don't use, since they may
-- 
2.25.0





Information forwarded to guix-patches <at> gnu.org:
bug#39146; Package guix-patches. (Tue, 21 Jan 2020 17:53:02 GMT) Full text and rfc822 format available.

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

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: Mark H Weaver <mhw <at> netris.org>
Cc: Jakub Kądziołka <kuba <at> kadziolka.net>,
 Marius Bakke <mbakke <at> fastmail.com>, 39146 <at> debbugs.gnu.org
Subject: Re: [bug#39146] [PATCH v2] gnu: icecat: Remove compiler paths from
 about:buildconfig
Date: Tue, 21 Jan 2020 18:52:02 +0100
[Message part 1 (text/plain, inline)]
Hi Mark,

since we have to touch Rust anyway, the icecat patch from Jakub below could also
go to guix staging.

Is the patch OK?  Should we do it?
[Message part 2 (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#39146; Package guix-patches. (Tue, 21 Jan 2020 18:07:01 GMT) Full text and rfc822 format available.

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

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: 39146 <at> debbugs.gnu.org
Subject: Re: [bug#39146] [PATCH v2] gnu: icecat: Remove compiler paths from
 about:buildconfig
Date: Tue, 21 Jan 2020 19:05:52 +0100
[Message part 1 (text/plain, inline)]
Jakub,

Jakub Kądziołka 写道:
> +         (add-after 'unpack 'dont-store-compiler-paths
> +           (lambda _
> +             ;; Remove references to the compilers used from 
> the output. Reduces
> +             ;; `guix size icecat' by 1 GiB on x86-64.
> +             (let ((zap "Store reference removed"))
> +               (substitute* "toolkit/content/buildconfig.html"
> +                 (("@CC@") zap)
> +                 (("@CXX@") zap)
> +                 (("@RUSTC@") zap)
> +                 (("@MOZ_CONFIGURE_OPTIONS@") zap)))))

Thanks!  This is a fine fix, but I wonder if you know where/how 
this file is processed by the build system?  I think scanning for 
and neutralising any store reference in the final HTML would be 
less error-prone.

Thoughts?

Kind regards,

T G-R
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#39146; Package guix-patches. (Wed, 22 Jan 2020 01:35:02 GMT) Full text and rfc822 format available.

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

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: 39146 <at> debbugs.gnu.org
Cc: Jakub Kądziołka <kuba <at> kadziolka.net>
Subject: [PATCH] gnu: icecat: Remove about:buildconfig store references.
Date: Wed, 22 Jan 2020 02:34:06 +0100
* gnu/packages/gnuzilla.scm (icecat)[arguments]:
New ‘neutralise-store-references’ phase.

Reported-by: Jakub Kądziołka <kuba <at> kadziolka.net>
---

Jakub, IceCats,

What do you think of this attempt at robustness?  Any drawbacks I've missed?

Kind regards,

T G-R

 gnu/packages/gnuzilla.scm | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm
index ae0c58eedb..d4a793971c 100644
--- a/gnu/packages/gnuzilla.scm
+++ b/gnu/packages/gnuzilla.scm
@@ -11,6 +11,7 @@
 ;;; Copyright © 2018 Ricardo Wurmus <rekado <at> elephly.net>
 ;;; Copyright © 2019 Ivan Petkov <ivanppetkov <at> gmail.com>
 ;;; Copyright © 2020 Oleg Pykhalov <go.wigust <at> gmail.com>
+;;; Copyright © 2020 Jakub Kądziołka <kuba <at> kadziolka.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1067,6 +1068,15 @@ from forcing GEXP-PROMISE."
                                 (force-output)
                                 (retry (- remaining-attempts 1))))
                        (apply build args)))))))
+         (add-after 'build 'neutralise-store-references
+           (lambda _
+             ;; Mangle the store references to compilers & other build tools in
+             ;; about:buildconfig, reducing IceCat's closure by 1 GiB on x86-64.
+             (substitute*
+                 "dist/bin/chrome/toolkit/content/global/buildconfig.html"
+               (("(/gnu/store/)([0-9a-z]{32})" all store hash)
+                (string-append store (string-take hash 8) "…")))
+             #t))
          (add-before 'configure 'install-desktop-entry
            (lambda* (#:key outputs #:allow-other-keys)
              ;; Install the '.desktop' file.
-- 
2.23.0





Information forwarded to guix-patches <at> gnu.org:
bug#39146; Package guix-patches. (Wed, 22 Jan 2020 14:40:01 GMT) Full text and rfc822 format available.

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

From: Jakub Kądziołka <kuba <at> kadziolka.net>
To: Tobias Geerinckx-Rice <me <at> tobias.gr>, 39146 <at> debbugs.gnu.org
Subject: Re: [PATCH] gnu: icecat: Remove about:buildconfig store references.
Date: Wed, 22 Jan 2020 15:39:28 +0100
On Wed, Jan 22, 2020 at 03:19:06PM +0100, Tobias Geerinckx-Rice wrote:
> Jakub,
> 
> Did you mean to send this off-list?  Either's fine by me.
Whoops, not at all. I need to configure mutt to default to
reply-to-all... adding the list back into CC.

> Jakub Kądziołka 写道:
> > Firstly, note that /gnu/store/ is not guaranteed to be the store path,
> > since this parameter can be changed by passing --with-store-dir to
> > ./configure.
> 
> Er, whoops, of course.  I was going to replace that after testing. By the
> time they'd finished I'd forgot.
> 
> > I assume you tested this patch? When I tried to do my substitutions
> > after the expansion is done, but before the files are packaged into
> > a zip-like file, I couldn't find a good place to hook in the build.
> 
> Indeed.  The result is stored in lib/icecat/omni.ja, which is an
> uncompressed (so GC works) zip file.
> 
> > Also, there's already some code to help with removing references in
> > guix/build/utils.scm (remove-store-references), but the result you get
> > with what you're proposing seems much more user-friendly.
> 
> Heh, thank you!  That's intentional.  :-)
> 
> Remove-store-references' length-preservation is great in some cases
> (compiled executables, binary data, weird code, …) but this wasn't a good
> fit.
> 
> Thanks for taking a look; I'll test & send a (%store-directory) fix.  Thanks
> for your enthousiastic contributions to Guix in general.

A short while after switching to Guix, I read this on Reddit:
| If you're looking to just use one of these distros without actively
| contributing back, I'd go with NixOS right now. If you're an enthusiast
| that wants to contribute to one of these two projects, GuixSD needs more
| help to reach critical mass.
( -- https://www.reddit.com/r/NixOS/comments/9zwiee/nixos_vs_guixsd/eb6zqcu/)
This, together with the fact that Guix is quite easy to hack on, has
inspired me to contribute.

> > Looks like you haven't updated your git in a while ;)
> 
> Nope, just other people's.
> 
> My Guix sqlite DB was corrupted beyond repair in December, I've been limping
> along using ‘guix pack’s from my build farm ever since, because it was never
> the ‘right time’ to reinstall…
>
> I blame Guix for making that even possible and relatively painless.
>
> Kind regards,
> 
> T G-R
> 




Information forwarded to guix-patches <at> gnu.org:
bug#39146; Package guix-patches. (Wed, 22 Jan 2020 20:14:01 GMT) Full text and rfc822 format available.

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

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: 39146 <at> debbugs.gnu.org
Cc: Jakub Kądziołka <kuba <at> kadziolka.net>
Subject: [PATCH v2] gnu: icecat: Remove about:buildconfig store references.
Date: Wed, 22 Jan 2020 21:13:13 +0100
* gnu/packages/gnuzilla.scm (icecat)[arguments]:
New ‘neutralise-store-references’ phase.

Reported-by: Jakub Kądziołka <kuba <at> kadziolka.net>
---

So,

Here's a version that correctly calls %store-directory.  Tested again, output looks the same.

Jakub: I accidentally kept your copyright line in v1, but didn't actually use your code (although part of your comment survives :-).  Is the Reported-by above acceptable?

Kind regards,

T G-R

 gnu/packages/gnuzilla.scm | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm
index ae0c58eedb..96c3c78e98 100644
--- a/gnu/packages/gnuzilla.scm
+++ b/gnu/packages/gnuzilla.scm
@@ -7,7 +7,7 @@
 ;;; Copyright © 2016 Alex Griffin <a <at> ajgrf.com>
 ;;; Copyright © 2017 Clément Lassieur <clement <at> lassieur.org>
 ;;; Copyright © 2017 ng0 <ng0 <at> n0.is>
-;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me <at> tobias.gr>
+;;; Copyright © 2017, 2018, 2020 Tobias Geerinckx-Rice <me <at> tobias.gr>
 ;;; Copyright © 2018 Ricardo Wurmus <rekado <at> elephly.net>
 ;;; Copyright © 2019 Ivan Petkov <ivanppetkov <at> gmail.com>
 ;;; Copyright © 2020 Oleg Pykhalov <go.wigust <at> gmail.com>
@@ -1067,6 +1067,15 @@ from forcing GEXP-PROMISE."
                                 (force-output)
                                 (retry (- remaining-attempts 1))))
                        (apply build args)))))))
+         (add-after 'build 'neutralise-store-references
+           (lambda _
+             ;; Mangle the store references to compilers & other build tools in
+             ;; about:buildconfig, reducing IceCat's closure by 1 GiB on x86-64.
+             (substitute*
+                 "dist/bin/chrome/toolkit/content/global/buildconfig.html"
+               (((format #f "(~a/)([0-9a-z]{32})" (%store-directory)) _ store hash)
+                (string-append store (string-take hash 8) "…")))
+             #t))
          (add-before 'configure 'install-desktop-entry
            (lambda* (#:key outputs #:allow-other-keys)
              ;; Install the '.desktop' file.
-- 
2.23.0





Information forwarded to guix-patches <at> gnu.org:
bug#39146; Package guix-patches. (Wed, 22 Jan 2020 20:29:02 GMT) Full text and rfc822 format available.

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

From: Marius Bakke <mbakke <at> fastmail.com>
To: Tobias Geerinckx-Rice <me <at> tobias.gr>, 39146 <at> debbugs.gnu.org
Cc: Jakub Kądziołka <kuba <at> kadziolka.net>
Subject: Re: [bug#39146] [PATCH v2] gnu: icecat: Remove about:buildconfig
 store references.
Date: Wed, 22 Jan 2020 21:28:02 +0100
[Message part 1 (text/plain, inline)]
Tobias Geerinckx-Rice via Guix-patches via <guix-patches <at> gnu.org>
writes:

> * gnu/packages/gnuzilla.scm (icecat)[arguments]:
> New ‘neutralise-store-references’ phase.

[...]

> +         (add-after 'build 'neutralise-store-references
> +           (lambda _
> +             ;; Mangle the store references to compilers & other build tools in
> +             ;; about:buildconfig, reducing IceCat's closure by 1 GiB on x86-64.
> +             (substitute*
> +                 "dist/bin/chrome/toolkit/content/global/buildconfig.html"
> +               (((format #f "(~a/)([0-9a-z]{32})" (%store-directory)) _ store hash)
> +                (string-append store (string-take hash 8) "…")))
> +             #t))

Is it possible to use 'remove-store-references' here?
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#39146; Package guix-patches. (Wed, 22 Jan 2020 20:51:01 GMT) Full text and rfc822 format available.

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

From: Jakub Kądziołka <kuba <at> kadziolka.net>
To: Tobias Geerinckx-Rice <me <at> tobias.gr>
Cc: 39146 <at> debbugs.gnu.org
Subject: Re: [PATCH v2] gnu: icecat: Remove about:buildconfig store references.
Date: Wed, 22 Jan 2020 21:50:47 +0100
On Wed, Jan 22, 2020 at 09:13:13PM +0100, Tobias Geerinckx-Rice wrote:
> Jakub: I accidentally kept your copyright line in v1, but didn't actually use your code (although part of your comment survives :-).  Is the Reported-by above acceptable?
I feel like Co-authored-by might fit better, but either is fine by me.

> +             ;; Mangle the store references to compilers & other build tools in
> +             ;; about:buildconfig, reducing IceCat's closure by 1 GiB on x86-64.
Minor² nit: I feel like this wording suggests this only matters on x64.
How about: reducing IceCat's closure by 1 GiB (measured on x86-64).

> +             (substitute*
> +                 "dist/bin/chrome/toolkit/content/global/buildconfig.html"
> +               (((format #f "(~a/)([0-9a-z]{32})" (%store-directory)) _ store hash)
> +                (string-append store (string-take hash 8) "…")))
> +             #t))
I don't know whether this is a supported use case, but... what if
(%store-directory) contains regex metacharacters?

Marius Bakke wrote:
> Is it possible to use 'remove-store-references' here?
For later reference, resolved on IRC:
http://logs.guix.gnu.org/guix/2020-01-22.log#213448

Regards,
Jakub Kądziołka




Information forwarded to guix-patches <at> gnu.org:
bug#39146; Package guix-patches. (Wed, 22 Jan 2020 21:26:01 GMT) Full text and rfc822 format available.

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

From: Mark H Weaver <mhw <at> netris.org>
To: Danny Milosavljevic <dannym <at> scratchpost.org>
Cc: Jakub Kądziołka <kuba <at> kadziolka.net>,
 Marius Bakke <mbakke <at> fastmail.com>, 39146 <at> debbugs.gnu.org
Subject: Re: [bug#39146] [PATCH v2] gnu: icecat: Remove compiler paths from
 about:buildconfig
Date: Wed, 22 Jan 2020 16:23:31 -0500
Hi Danny,

Thanks for checking in with me on this.

> since we have to touch Rust anyway, the icecat patch from Jakub below could also
> go to guix staging.
> 
> Is the patch OK?  Should we do it?

Instead of removing the build configuration information entirely, how
about transforming the store paths in some way that makes them invisible
to the reference scanner without losing information?  For example,
inserting a period (.) somewhere within the store hash would be
sufficient and fairly obvious.

What do you think?

Also, the new phase should end with #t.

     Thanks,
       Mark




Information forwarded to guix-patches <at> gnu.org:
bug#39146; Package guix-patches. (Thu, 23 Jan 2020 08:38:02 GMT) Full text and rfc822 format available.

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

From: Jakub Kądziołka <kuba <at> kadziolka.net>
To: Mark H Weaver <mhw <at> netris.org>
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>,
 Marius Bakke <mbakke <at> fastmail.com>, 39146 <at> debbugs.gnu.org
Subject: Re: [bug#39146] [PATCH v2] gnu: icecat: Remove compiler paths from
 about:buildconfig
Date: Thu, 23 Jan 2020 09:37:38 +0100
On Wed, Jan 22, 2020 at 04:23:31PM -0500, Mark H Weaver wrote:
> Hi Danny,
> 
> Thanks for checking in with me on this.
> 
> > since we have to touch Rust anyway, the icecat patch from Jakub below could also
> > go to guix staging.
> > 
> > Is the patch OK?  Should we do it?
> 
> Instead of removing the build configuration information entirely, how
> about transforming the store paths in some way that makes them invisible
> to the reference scanner without losing information?  For example,
> inserting a period (.) somewhere within the store hash would be
> sufficient and fairly obvious.
> 
> What do you think?
It wasn't clear to me how to transform the paths after they get
substituted, but nckx has suggested a better approach:
https://debbugs.gnu.org/39146

Regards,
Jakub Kądziołka




Information forwarded to guix-patches <at> gnu.org:
bug#39146; Package guix-patches. (Fri, 24 Jan 2020 02:56:01 GMT) Full text and rfc822 format available.

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

From: Mark H Weaver <mhw <at> netris.org>
To: Jakub Kądziołka <kuba <at> kadziolka.net>
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>,
 Marius Bakke <mbakke <at> fastmail.com>, Tobias Geerinckx-Rice <me <at> tobias.gr>,
 39146 <at> debbugs.gnu.org
Subject: Re: [bug#39146] [PATCH v2] gnu: icecat: Remove compiler paths from
 about:buildconfig
Date: Thu, 23 Jan 2020 21:53:48 -0500
I like the approach of Tobias' proposed patch, but to avoid losing
information (most of the hash), how about changing:

  (string-append store (string-take hash 8) "…")

to something like:

  (string-append store (string-take hash 2) "." (string-drop hash 2))

What do you think?  Anyway, I don't feel strongly about it, and I
acknowledge that neither approach is perfect.

      Regards,
        Mark




Information forwarded to guix-patches <at> gnu.org:
bug#39146; Package guix-patches. (Mon, 10 Feb 2020 18:39:01 GMT) Full text and rfc822 format available.

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

From: Jakub Kądziołka <kuba <at> kadziolka.net>
To: Mark H Weaver <mhw <at> netris.org>
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>,
 Marius Bakke <mbakke <at> fastmail.com>, Tobias Geerinckx-Rice <me <at> tobias.gr>,
 39146 <at> debbugs.gnu.org
Subject: Re: [bug#39146] [PATCH v2] gnu: icecat: Remove compiler paths from
 about:buildconfig
Date: Mon, 10 Feb 2020 19:38:31 +0100
[Message part 1 (text/plain, inline)]
On Thu, Jan 23, 2020 at 09:53:48PM -0500, Mark H Weaver wrote:
> I like the approach of Tobias' proposed patch, but to avoid losing
> information (most of the hash), how about changing:
> 
>   (string-append store (string-take hash 8) "…")
> 
> to something like:
> 
>   (string-append store (string-take hash 2) "." (string-drop hash 2))
> 
> What do you think?  Anyway, I don't feel strongly about it, and I
> acknowledge that neither approach is perfect.
I feel like the unicode character "…" makes it much more clear that the
path has been modified, but it's a moot point considering that if
someone might get confused by this, they probably won't be able to make
use of the hash.

However, now that I come back to this after some time, I realize that
there is another solution:

    (string-append store (string-take hash 8) "<span></span>"
                         (string-drop hash 8))

This would neuter the reference without having any user-visible impact on
about:buildconfig. What do you think?

Kind regards,
Jakub Kądziołka
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#39146; Package guix-patches. (Mon, 10 Feb 2020 20:26:02 GMT) Full text and rfc822 format available.

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

From: Mark H Weaver <mhw <at> netris.org>
To: Jakub Kądziołka <kuba <at> kadziolka.net>
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>,
 Marius Bakke <mbakke <at> fastmail.com>, Tobias Geerinckx-Rice <me <at> tobias.gr>,
 39146 <at> debbugs.gnu.org
Subject: Re: [bug#39146] [PATCH v2] gnu: icecat: Remove compiler paths from
 about:buildconfig
Date: Mon, 10 Feb 2020 15:24:09 -0500
Hi Jakub,

Jakub Kądziołka <kuba <at> kadziolka.net> wrote:
> However, now that I come back to this after some time, I realize that
> there is another solution:
> 
>     (string-append store (string-take hash 8) "<span></span>"
>                          (string-drop hash 8))
> 
> This would neuter the reference without having any user-visible impact on
> about:buildconfig. What do you think?

Great idea, I think this is the right approach.  Would you like to
propose a patch and test it?

    Thank you!
       Mark




Information forwarded to guix-patches <at> gnu.org:
bug#39146; Package guix-patches. (Mon, 10 Feb 2020 21:50:02 GMT) Full text and rfc822 format available.

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

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: Jakub Kądziołka <kuba <at> kadziolka.net>
Cc: Mark H Weaver <mhw <at> netris.org>, Marius Bakke <mbakke <at> fastmail.com>,
 39146 <at> debbugs.gnu.org, Danny Milosavljevic <dannym <at> scratchpost.org>
Subject: Re: [bug#39146] [PATCH v2] gnu: icecat: Remove compiler paths from
 about:buildconfig
Date: Mon, 10 Feb 2020 22:49:31 +0100
Jakub, all,

On Mon, Feb 10, 2020 at 7:38 PM, Jakub =?UTF-8?b?S8SFZHppb8WCa2E=?= 
<kuba <at> kadziolka.net> wrote:
> On Thu, Jan 23, 2020 at 09:53:48PM -0500, Mark H Weaver wrote:
>>  I like the approach of Tobias' proposed patch, but to avoid losing
>>  information (most of the hash), how about changing:
>> 
>>    (string-append store (string-take hash 8) "…")
>> 
>>  to something like:
>> 
>>    (string-append store (string-take hash 2) "." (string-drop hash 
>> 2))
>> 
>>  What do you think?  Anyway, I don't feel strongly about it, and I
>>  acknowledge that neither approach is perfect.
> I feel like the unicode character "…" makes it much more clear that 
> the
> path has been modified, but it's a moot point considering that if
> someone might get confused by this, they probably won't be able to 
> make
> use of the hash.
> 
> However, now that I come back to this after some time, I realize that
> there is another solution:
> 
>     (string-append store (string-take hash 8) "<span></span>"
>                          (string-drop hash 8))
> 
> This would neuter the reference without having any user-visible 
> impact on
> about:buildconfig. What do you think?

The truncation of these very long paths was fully intended as a 
feature, but if people do think they're actually useful I think this is 
a clever hack worthy of Guix :-)

Have you tested whether copying & pasting still works fine with this?

Kind regards,

T G-R, adrift without mu4e








Information forwarded to guix-patches <at> gnu.org:
bug#39146; Package guix-patches. (Wed, 12 Feb 2020 19:45:02 GMT) Full text and rfc822 format available.

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

From: Jakub Kądziołka <kuba <at> kadziolka.net>
To: 39146 <at> debbugs.gnu.org
Cc: Mark H Weaver <mhw <at> netris.org>, Marius Bakke <mbakke <at> fastmail.com>,
 Tobias Geerinckx-Rice <me <at> tobias.gr>,
 Danny Milosavljevic <dannym <at> scratchpost.org>
Subject: [PATCH v3] gnu: icecat: Remove about:buildconfig store references.
Date: Wed, 12 Feb 2020 20:45:25 +0100
[Message part 1 (text/plain, inline)]
* gnu/packages/gnuzilla.scm (icecat)[arguments]:
  New ‘neutralise-store-references’ phase.

Co-authored-by: Tobias Geerinckx-Rice <me <at> tobias.gr>
---

On Mon, Feb 10, 2020 at 10:49:31PM +0100, Tobias Geerinckx-Rice wrote:
> The truncation of these very long paths was fully intended as a feature, but
> if people do think they're actually useful I think this is a clever hack
> worthy of Guix :-)
> 
> Have you tested whether copying & pasting still works fine with this?
At the time it was just a rough idea, but here's a patch. After waiting
a while for IceCat to compile, I tested this and it's working
flawlessly. Selection and copy-paste are unhindered.

In the end, I decided to use a comment instead of an empty span, since
it'll be less mysterious should someone stumble upon it. It's also more
greppable.

(to be clear, I only tested the comment version, so perhaps the <span>
one wouldn't have even worked. Not that it matters...)

BTW, do you happen to know a good way to send a patch as a reply? I
ended up using `neomutt -H' and then specifying all the CC's manually...

 gnu/packages/gnuzilla.scm | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm
index ae0c58eedb..114e5e636c 100644
--- a/gnu/packages/gnuzilla.scm
+++ b/gnu/packages/gnuzilla.scm
@@ -7,10 +7,11 @@
 ;;; Copyright © 2016 Alex Griffin <a <at> ajgrf.com>
 ;;; Copyright © 2017 Clément Lassieur <clement <at> lassieur.org>
 ;;; Copyright © 2017 ng0 <ng0 <at> n0.is>
-;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me <at> tobias.gr>
+;;; Copyright © 2017, 2018, 2020 Tobias Geerinckx-Rice <me <at> tobias.gr>
 ;;; Copyright © 2018 Ricardo Wurmus <rekado <at> elephly.net>
 ;;; Copyright © 2019 Ivan Petkov <ivanppetkov <at> gmail.com>
 ;;; Copyright © 2020 Oleg Pykhalov <go.wigust <at> gmail.com>
+;;; Copyright © 2020 Jakub Kądziołka <kuba <at> kadziolka.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1067,6 +1068,17 @@ from forcing GEXP-PROMISE."
                                 (force-output)
                                 (retry (- remaining-attempts 1))))
                        (apply build args)))))))
+         (add-after 'build 'neutralise-store-references
+           (lambda _
+             ;; Mangle the store references to compilers & other build tools in
+             ;; about:buildconfig, reducing IceCat's closure by 1 GiB on x86-64.
+             (substitute*
+                 "dist/bin/chrome/toolkit/content/global/buildconfig.html"
+               (((format #f "(~a/)([0-9a-z]{32})" (%store-directory)) _ store hash)
+                (string-append store (string-take hash 8)
+                               "<!-- Guix: not a runtime dependency -->"
+                               (string-drop hash 8))))
+             #t))
          (add-before 'configure 'install-desktop-entry
            (lambda* (#:key outputs #:allow-other-keys)
              ;; Install the '.desktop' file.
-- 
2.25.0

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

Information forwarded to guix-patches <at> gnu.org:
bug#39146; Package guix-patches. (Wed, 12 Feb 2020 20:10:02 GMT) Full text and rfc822 format available.

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

From: Kyle Meyer <kyle <at> kyleam.com>
To: Jakub Kądziołka <kuba <at> kadziolka.net>,
 39146 <at> debbugs.gnu.org
Cc: Mark H Weaver <mhw <at> netris.org>, Marius Bakke <mbakke <at> fastmail.com>,
 Tobias Geerinckx-Rice <me <at> tobias.gr>,
 Danny Milosavljevic <dannym <at> scratchpost.org>
Subject: Re: [bug#39146] [PATCH v3] gnu: icecat: Remove about:buildconfig
 store references.
Date: Wed, 12 Feb 2020 20:08:54 +0000
Jakub Kądziołka <kuba <at> kadziolka.net> writes:

> BTW, do you happen to know a good way to send a patch as a reply? I
> ended up using `neomutt -H' and then specifying all the CC's manually...

One option is to reply to the message as you normally would and then
insert the patch under scissors.  Here's an example using your patch.
I've kept the "From:" line, but that's not necessary if the sender of
the email matches the patch author.

On the other end, that can be applied with `git am --scissors'.

-- >8 --
From: =?UTF-8?q?Jakub=20K=C4=85dzio=C5=82ka?= <kuba <at> kadziolka.net>
Subject: [PATCH v3] gnu: icecat: Remove about:buildconfig store references.

* gnu/packages/gnuzilla.scm (icecat)[arguments]:
  New ‘neutralise-store-references’ phase.

Co-authored-by: Tobias Geerinckx-Rice <me <at> tobias.gr>
---
 gnu/packages/gnuzilla.scm | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm
index 863edb3b4e..7d5020f7c2 100644
--- a/gnu/packages/gnuzilla.scm
+++ b/gnu/packages/gnuzilla.scm
@@ -7,10 +7,11 @@
 ;;; Copyright © 2016 Alex Griffin <a <at> ajgrf.com>
 ;;; Copyright © 2017 Clément Lassieur <clement <at> lassieur.org>
 ;;; Copyright © 2017 ng0 <ng0 <at> n0.is>
-;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me <at> tobias.gr>
+;;; Copyright © 2017, 2018, 2020 Tobias Geerinckx-Rice <me <at> tobias.gr>
 ;;; Copyright © 2018 Ricardo Wurmus <rekado <at> elephly.net>
 ;;; Copyright © 2019 Ivan Petkov <ivanppetkov <at> gmail.com>
 ;;; Copyright © 2020 Oleg Pykhalov <go.wigust <at> gmail.com>
+;;; Copyright © 2020 Jakub Kądziołka <kuba <at> kadziolka.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1067,6 +1068,17 @@ (define-public icecat
                                 (force-output)
                                 (retry (- remaining-attempts 1))))
                        (apply build args)))))))
+         (add-after 'build 'neutralise-store-references
+           (lambda _
+             ;; Mangle the store references to compilers & other build tools in
+             ;; about:buildconfig, reducing IceCat's closure by 1 GiB on x86-64.
+             (substitute*
+                 "dist/bin/chrome/toolkit/content/global/buildconfig.html"
+               (((format #f "(~a/)([0-9a-z]{32})" (%store-directory)) _ store hash)
+                (string-append store (string-take hash 8)
+                               "<!-- Guix: not a runtime dependency -->"
+                               (string-drop hash 8))))
+             #t))
          (add-before 'configure 'install-desktop-entry
            (lambda* (#:key outputs #:allow-other-keys)
              ;; Install the '.desktop' file.
-- 
2.25.0




Information forwarded to guix-patches <at> gnu.org:
bug#39146; Package guix-patches. (Thu, 13 Feb 2020 22:03:02 GMT) Full text and rfc822 format available.

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

From: Jakub Kądziołka <kuba <at> kadziolka.net>
To: 39146 <at> debbugs.gnu.org
Cc: Mark H Weaver <mhw <at> netris.org>, Marius Bakke <mbakke <at> fastmail.com>,
 Tobias Geerinckx-Rice <me <at> tobias.gr>,
 Danny Milosavljevic <dannym <at> scratchpost.org>
Subject: [PATCH v4] gnu: icecat: Remove about:buildconfig store references.
Date: Thu, 13 Feb 2020 23:03:07 +0100
* gnu/packages/gnuzilla.scm (icecat)[arguments]:
  New ‘neutralise-store-references’ phase.

Co-authored-by: Tobias Geerinckx-Rice <me <at> tobias.gr>
---
Changes from the previous version:
- use regexp-quote around %store-directory, since today's IRC discussion
  has made me aware that this exists as a built-in
- reflow some lines

 gnu/packages/gnuzilla.scm | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm
index ae0c58eedb..fe6664e909 100644
--- a/gnu/packages/gnuzilla.scm
+++ b/gnu/packages/gnuzilla.scm
@@ -7,10 +7,11 @@
 ;;; Copyright © 2016 Alex Griffin <a <at> ajgrf.com>
 ;;; Copyright © 2017 Clément Lassieur <clement <at> lassieur.org>
 ;;; Copyright © 2017 ng0 <ng0 <at> n0.is>
-;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me <at> tobias.gr>
+;;; Copyright © 2017, 2018, 2020 Tobias Geerinckx-Rice <me <at> tobias.gr>
 ;;; Copyright © 2018 Ricardo Wurmus <rekado <at> elephly.net>
 ;;; Copyright © 2019 Ivan Petkov <ivanppetkov <at> gmail.com>
 ;;; Copyright © 2020 Oleg Pykhalov <go.wigust <at> gmail.com>
+;;; Copyright © 2020 Jakub Kądziołka <kuba <at> kadziolka.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -882,6 +883,7 @@ from forcing GEXP-PROMISE."
 
        #:modules ((ice-9 ftw)
                   (ice-9 rdelim)
+                  (ice-9 regex)
                   (ice-9 match)
                   (srfi srfi-34)
                   (srfi srfi-35)
@@ -1067,6 +1069,20 @@ from forcing GEXP-PROMISE."
                                 (force-output)
                                 (retry (- remaining-attempts 1))))
                        (apply build args)))))))
+         (add-after 'build 'neutralise-store-references
+           (lambda _
+             ;; Mangle the store references to compilers & other build tools in
+             ;; about:buildconfig, reducing IceCat's closure by 1 GiB on x86-64.
+             (substitute*
+                 "dist/bin/chrome/toolkit/content/global/buildconfig.html"
+               (((format #f "(~a/)([0-9a-df-np-sv-z]{32})"
+                         (regexp-quote (%store-directory)))
+                 _ store hash)
+                (string-append store
+                               (string-take hash 8)
+                               "<!-- Guix: not a runtime dependency -->"
+                               (string-drop hash 8))))
+             #t))
          (add-before 'configure 'install-desktop-entry
            (lambda* (#:key outputs #:allow-other-keys)
              ;; Install the '.desktop' file.
-- 
2.25.0





Reply sent to Jakub Kądziołka <kuba <at> kadziolka.net>:
You have taken responsibility. (Wed, 26 Feb 2020 21:34:02 GMT) Full text and rfc822 format available.

Notification sent to Jakub Kądziołka <kuba <at> kadziolka.net>:
bug acknowledged by developer. (Wed, 26 Feb 2020 21:34:02 GMT) Full text and rfc822 format available.

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

From: Jakub Kądziołka <kuba <at> kadziolka.net>
To: 39146-done <at> debbugs.gnu.org
Subject: Done: gnu: icecat: Remove about:buildconfig store references.
Date: Wed, 26 Feb 2020 22:33:43 +0100
[Message part 1 (text/plain, inline)]
Pushed as 37db2370db884ceac3bc97123aaaed84377398eb, closing.

Regards,
Jakub Kądziołka
[signature.asc (application/pgp-signature, inline)]

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

This bug report was last modified 4 years and 278 days ago.

Previous Next


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