diff mbox series

[bug#39146,v2] gnu: icecat: Remove compiler paths from about:buildconfig

Message ID 20200121173711.5gegrl233dtjneni@zdrowyportier.kadziolka.net
State Accepted
Headers show
Series [bug#39146,v2] gnu: icecat: Remove compiler paths from about:buildconfig | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job

Commit Message

Maja Kądziołka Jan. 21, 2020, 5:37 p.m. UTC
* gnu/packages/gnuzilla.scm
  (icecat)[arguments](dont-store-compiler-paths): New phase.
---
 gnu/packages/gnuzilla.scm | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Danny Milosavljevic Jan. 21, 2020, 5:52 p.m. UTC | #1
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?
ashish.is--- via Guix-patches" via Jan. 21, 2020, 6:05 p.m. UTC | #2
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
Mark H Weaver Jan. 22, 2020, 9:23 p.m. UTC | #3
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
Maja Kądziołka Jan. 23, 2020, 8:37 a.m. UTC | #4
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
Mark H Weaver Jan. 24, 2020, 2:53 a.m. UTC | #5
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
Maja Kądziołka Feb. 10, 2020, 6:38 p.m. UTC | #6
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
Mark H Weaver Feb. 10, 2020, 8:24 p.m. UTC | #7
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
ashish.is--- via Guix-patches" via Feb. 10, 2020, 9:49 p.m. UTC | #8
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
diff mbox series

Patch

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