unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#39146] [PATCH] gnu: icecat: Remove compiler paths from about:buildconfig
@ 2020-01-15 22:21 Jakub Kądziołka
  2020-01-21 17:37 ` [bug#39146] [PATCH v2] " Jakub Kądziołka
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: Jakub Kądziołka @ 2020-01-15 22:21 UTC (permalink / raw)
  To: 39146

* 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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [bug#39146] [PATCH v2] gnu: icecat: Remove compiler paths from about:buildconfig
  2020-01-15 22:21 [bug#39146] [PATCH] gnu: icecat: Remove compiler paths from about:buildconfig Jakub Kądziołka
@ 2020-01-21 17:37 ` Jakub Kądziołka
  2020-01-21 17:52   ` Danny Milosavljevic
  2020-01-21 18:05   ` [bug#39146] [PATCH v2] gnu: icecat: Remove compiler paths from about:buildconfig Tobias Geerinckx-Rice via Guix-patches via
  2020-01-22  1:34 ` [bug#39146] [PATCH] gnu: icecat: Remove about:buildconfig store references Tobias Geerinckx-Rice via Guix-patches via
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 18+ messages in thread
From: Jakub Kądziołka @ 2020-01-21 17:37 UTC (permalink / raw)
  To: 39146

* 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@elephly.net>
 ;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com>
 ;;; Copyright © 2020 Oleg Pykhalov <go.wigust@gmail.com>
+;;; Copyright © 2020 Jakub Kądziołka <kuba@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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [bug#39146] [PATCH v2] gnu: icecat: Remove compiler paths from about:buildconfig
  2020-01-21 17:37 ` [bug#39146] [PATCH v2] " Jakub Kądziołka
@ 2020-01-21 17:52   ` Danny Milosavljevic
  2020-01-22 21:23     ` Mark H Weaver
  2020-01-21 18:05   ` [bug#39146] [PATCH v2] gnu: icecat: Remove compiler paths from about:buildconfig Tobias Geerinckx-Rice via Guix-patches via
  1 sibling, 1 reply; 18+ messages in thread
From: Danny Milosavljevic @ 2020-01-21 17:52 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: Jakub Kądziołka, Marius Bakke, 39146

[-- Attachment #1: Type: text/plain, Size: 153 bytes --]

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?

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#39146] [PATCH v2] gnu: icecat: Remove compiler paths from about:buildconfig
  2020-01-21 17:37 ` [bug#39146] [PATCH v2] " Jakub Kądziołka
  2020-01-21 17:52   ` Danny Milosavljevic
@ 2020-01-21 18:05   ` Tobias Geerinckx-Rice via Guix-patches via
  1 sibling, 0 replies; 18+ messages in thread
From: Tobias Geerinckx-Rice via Guix-patches via @ 2020-01-21 18:05 UTC (permalink / raw)
  To: 39146

[-- Attachment #1: Type: text/plain, Size: 825 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#39146] [PATCH] gnu: icecat: Remove about:buildconfig store references.
  2020-01-15 22:21 [bug#39146] [PATCH] gnu: icecat: Remove compiler paths from about:buildconfig Jakub Kądziołka
  2020-01-21 17:37 ` [bug#39146] [PATCH v2] " Jakub Kądziołka
@ 2020-01-22  1:34 ` Tobias Geerinckx-Rice via Guix-patches via
       [not found]   ` <20200122135107.73z6upacjwial3zq@zdrowyportier.kadziolka.net>
  2020-01-22 20:13 ` [bug#39146] [PATCH v2] " Tobias Geerinckx-Rice via Guix-patches via
  2020-02-26 21:33 ` bug#39146: Done: " Jakub Kądziołka
  3 siblings, 1 reply; 18+ messages in thread
From: Tobias Geerinckx-Rice via Guix-patches via @ 2020-01-22  1:34 UTC (permalink / raw)
  To: 39146; +Cc: Jakub Kądziołka

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

Reported-by: Jakub Kądziołka <kuba@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@elephly.net>
 ;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com>
 ;;; Copyright © 2020 Oleg Pykhalov <go.wigust@gmail.com>
+;;; Copyright © 2020 Jakub Kądziołka <kuba@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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [bug#39146] [PATCH] gnu: icecat: Remove about:buildconfig store references.
       [not found]     ` <87o8uvlgnn.fsf@nckx>
@ 2020-01-22 14:39       ` Jakub Kądziołka
  0 siblings, 0 replies; 18+ messages in thread
From: Jakub Kądziołka @ 2020-01-22 14:39 UTC (permalink / raw)
  To: Tobias Geerinckx-Rice, 39146

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
> 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#39146] [PATCH v2] gnu: icecat: Remove about:buildconfig store references.
  2020-01-15 22:21 [bug#39146] [PATCH] gnu: icecat: Remove compiler paths from about:buildconfig Jakub Kądziołka
  2020-01-21 17:37 ` [bug#39146] [PATCH v2] " Jakub Kądziołka
  2020-01-22  1:34 ` [bug#39146] [PATCH] gnu: icecat: Remove about:buildconfig store references Tobias Geerinckx-Rice via Guix-patches via
@ 2020-01-22 20:13 ` Tobias Geerinckx-Rice via Guix-patches via
  2020-01-22 20:28   ` Marius Bakke
  2020-01-22 20:50   ` Jakub Kądziołka
  2020-02-26 21:33 ` bug#39146: Done: " Jakub Kądziołka
  3 siblings, 2 replies; 18+ messages in thread
From: Tobias Geerinckx-Rice via Guix-patches via @ 2020-01-22 20:13 UTC (permalink / raw)
  To: 39146; +Cc: Jakub Kądziołka

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

Reported-by: Jakub Kądziołka <kuba@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@ajgrf.com>
 ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
 ;;; Copyright © 2017 ng0 <ng0@n0.is>
-;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2017, 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com>
 ;;; Copyright © 2020 Oleg Pykhalov <go.wigust@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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [bug#39146] [PATCH v2] gnu: icecat: Remove about:buildconfig store references.
  2020-01-22 20:13 ` [bug#39146] [PATCH v2] " Tobias Geerinckx-Rice via Guix-patches via
@ 2020-01-22 20:28   ` Marius Bakke
  2020-01-22 20:50   ` Jakub Kądziołka
  1 sibling, 0 replies; 18+ messages in thread
From: Marius Bakke @ 2020-01-22 20:28 UTC (permalink / raw)
  To: Tobias Geerinckx-Rice, 39146; +Cc: Jakub Kądziołka

[-- Attachment #1: Type: text/plain, Size: 790 bytes --]

Tobias Geerinckx-Rice via Guix-patches via <guix-patches@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?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#39146] [PATCH v2] gnu: icecat: Remove about:buildconfig store references.
  2020-01-22 20:13 ` [bug#39146] [PATCH v2] " Tobias Geerinckx-Rice via Guix-patches via
  2020-01-22 20:28   ` Marius Bakke
@ 2020-01-22 20:50   ` Jakub Kądziołka
  1 sibling, 0 replies; 18+ messages in thread
From: Jakub Kądziołka @ 2020-01-22 20:50 UTC (permalink / raw)
  To: Tobias Geerinckx-Rice; +Cc: 39146

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#39146] [PATCH v2] gnu: icecat: Remove compiler paths from about:buildconfig
  2020-01-21 17:52   ` Danny Milosavljevic
@ 2020-01-22 21:23     ` Mark H Weaver
  2020-01-23  8:37       ` Jakub Kądziołka
  0 siblings, 1 reply; 18+ messages in thread
From: Mark H Weaver @ 2020-01-22 21:23 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: Jakub Kądziołka, Marius Bakke, 39146

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#39146] [PATCH v2] gnu: icecat: Remove compiler paths from about:buildconfig
  2020-01-22 21:23     ` Mark H Weaver
@ 2020-01-23  8:37       ` Jakub Kądziołka
  2020-01-24  2:53         ` Mark H Weaver
  0 siblings, 1 reply; 18+ messages in thread
From: Jakub Kądziołka @ 2020-01-23  8:37 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: Danny Milosavljevic, Marius Bakke, 39146

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#39146] [PATCH v2] gnu: icecat: Remove compiler paths from about:buildconfig
  2020-01-23  8:37       ` Jakub Kądziołka
@ 2020-01-24  2:53         ` Mark H Weaver
  2020-02-10 18:38           ` Jakub Kądziołka
  0 siblings, 1 reply; 18+ messages in thread
From: Mark H Weaver @ 2020-01-24  2:53 UTC (permalink / raw)
  To: Jakub Kądziołka
  Cc: Danny Milosavljevic, Marius Bakke, Tobias Geerinckx-Rice, 39146

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#39146] [PATCH v2] gnu: icecat: Remove compiler paths from about:buildconfig
  2020-01-24  2:53         ` Mark H Weaver
@ 2020-02-10 18:38           ` Jakub Kądziołka
  2020-02-10 20:24             ` Mark H Weaver
  2020-02-10 21:49             ` Tobias Geerinckx-Rice via Guix-patches via
  0 siblings, 2 replies; 18+ messages in thread
From: Jakub Kądziołka @ 2020-02-10 18:38 UTC (permalink / raw)
  To: Mark H Weaver
  Cc: Danny Milosavljevic, Marius Bakke, Tobias Geerinckx-Rice, 39146

[-- Attachment #1: Type: text/plain, Size: 1071 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#39146] [PATCH v2] gnu: icecat: Remove compiler paths from about:buildconfig
  2020-02-10 18:38           ` Jakub Kądziołka
@ 2020-02-10 20:24             ` Mark H Weaver
  2020-02-10 21:49             ` Tobias Geerinckx-Rice via Guix-patches via
  1 sibling, 0 replies; 18+ messages in thread
From: Mark H Weaver @ 2020-02-10 20:24 UTC (permalink / raw)
  To: Jakub Kądziołka
  Cc: Danny Milosavljevic, Marius Bakke, Tobias Geerinckx-Rice, 39146

Hi Jakub,

Jakub Kądziołka <kuba@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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#39146] [PATCH v2] gnu: icecat: Remove compiler paths from about:buildconfig
  2020-02-10 18:38           ` Jakub Kądziołka
  2020-02-10 20:24             ` Mark H Weaver
@ 2020-02-10 21:49             ` Tobias Geerinckx-Rice via Guix-patches via
  2020-02-12 19:45               ` [bug#39146] [PATCH v3] gnu: icecat: Remove about:buildconfig store references Jakub Kądziołka
  1 sibling, 1 reply; 18+ messages in thread
From: Tobias Geerinckx-Rice via Guix-patches via @ 2020-02-10 21:49 UTC (permalink / raw)
  To: Jakub Kądziołka
  Cc: Mark H Weaver, Marius Bakke, 39146, Danny Milosavljevic

Jakub, all,

On Mon, Feb 10, 2020 at 7:38 PM, Jakub =?UTF-8?b?S8SFZHppb8WCa2E=?= 
<kuba@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




^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#39146] [PATCH v3] gnu: icecat: Remove about:buildconfig store references.
  2020-02-10 21:49             ` Tobias Geerinckx-Rice via Guix-patches via
@ 2020-02-12 19:45               ` Jakub Kądziołka
  2020-02-13 22:03                 ` [bug#39146] [PATCH v4] " Jakub Kądziołka
  0 siblings, 1 reply; 18+ messages in thread
From: Jakub Kądziołka @ 2020-02-12 19:45 UTC (permalink / raw)
  To: 39146
  Cc: Mark H Weaver, Marius Bakke, Tobias Geerinckx-Rice,
	Danny Milosavljevic

[-- Attachment #1: Type: text/plain, Size: 3037 bytes --]

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

Co-authored-by: Tobias Geerinckx-Rice <me@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@ajgrf.com>
 ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
 ;;; Copyright © 2017 ng0 <ng0@n0.is>
-;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2017, 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com>
 ;;; Copyright © 2020 Oleg Pykhalov <go.wigust@gmail.com>
+;;; Copyright © 2020 Jakub Kądziołka <kuba@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


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [bug#39146] [PATCH v4] gnu: icecat: Remove about:buildconfig store references.
  2020-02-12 19:45               ` [bug#39146] [PATCH v3] gnu: icecat: Remove about:buildconfig store references Jakub Kądziołka
@ 2020-02-13 22:03                 ` Jakub Kądziołka
  0 siblings, 0 replies; 18+ messages in thread
From: Jakub Kądziołka @ 2020-02-13 22:03 UTC (permalink / raw)
  To: 39146
  Cc: Mark H Weaver, Marius Bakke, Tobias Geerinckx-Rice,
	Danny Milosavljevic

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

Co-authored-by: Tobias Geerinckx-Rice <me@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@ajgrf.com>
 ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
 ;;; Copyright © 2017 ng0 <ng0@n0.is>
-;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2017, 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com>
 ;;; Copyright © 2020 Oleg Pykhalov <go.wigust@gmail.com>
+;;; Copyright © 2020 Jakub Kądziołka <kuba@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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* bug#39146: Done: gnu: icecat: Remove about:buildconfig store references.
  2020-01-15 22:21 [bug#39146] [PATCH] gnu: icecat: Remove compiler paths from about:buildconfig Jakub Kądziołka
                   ` (2 preceding siblings ...)
  2020-01-22 20:13 ` [bug#39146] [PATCH v2] " Tobias Geerinckx-Rice via Guix-patches via
@ 2020-02-26 21:33 ` Jakub Kądziołka
  3 siblings, 0 replies; 18+ messages in thread
From: Jakub Kądziołka @ 2020-02-26 21:33 UTC (permalink / raw)
  To: 39146-done

[-- Attachment #1: Type: text/plain, Size: 93 bytes --]

Pushed as 37db2370db884ceac3bc97123aaaed84377398eb, closing.

Regards,
Jakub Kądziołka

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2020-02-26 21:34 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-15 22:21 [bug#39146] [PATCH] gnu: icecat: Remove compiler paths from about:buildconfig Jakub Kądziołka
2020-01-21 17:37 ` [bug#39146] [PATCH v2] " Jakub Kądziołka
2020-01-21 17:52   ` Danny Milosavljevic
2020-01-22 21:23     ` Mark H Weaver
2020-01-23  8:37       ` Jakub Kądziołka
2020-01-24  2:53         ` Mark H Weaver
2020-02-10 18:38           ` Jakub Kądziołka
2020-02-10 20:24             ` Mark H Weaver
2020-02-10 21:49             ` Tobias Geerinckx-Rice via Guix-patches via
2020-02-12 19:45               ` [bug#39146] [PATCH v3] gnu: icecat: Remove about:buildconfig store references Jakub Kądziołka
2020-02-13 22:03                 ` [bug#39146] [PATCH v4] " Jakub Kądziołka
2020-01-21 18:05   ` [bug#39146] [PATCH v2] gnu: icecat: Remove compiler paths from about:buildconfig Tobias Geerinckx-Rice via Guix-patches via
2020-01-22  1:34 ` [bug#39146] [PATCH] gnu: icecat: Remove about:buildconfig store references Tobias Geerinckx-Rice via Guix-patches via
     [not found]   ` <20200122135107.73z6upacjwial3zq@zdrowyportier.kadziolka.net>
     [not found]     ` <87o8uvlgnn.fsf@nckx>
2020-01-22 14:39       ` Jakub Kądziołka
2020-01-22 20:13 ` [bug#39146] [PATCH v2] " Tobias Geerinckx-Rice via Guix-patches via
2020-01-22 20:28   ` Marius Bakke
2020-01-22 20:50   ` Jakub Kądziołka
2020-02-26 21:33 ` bug#39146: Done: " Jakub Kądziołka

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).