unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#37732: mps-youtube propagates util-linux
@ 2019-10-13 11:40 Diego Nicola Barbato
  2019-10-13 14:26 ` Marius Bakke
  0 siblings, 1 reply; 6+ messages in thread
From: Diego Nicola Barbato @ 2019-10-13 11:40 UTC (permalink / raw)
  To: 37732

Hi Guix,

An unfortunate chain of propagated-inputs causes 'util-linux' (mount,
umount, etc.) to be installed alongside 'mps-youtube': 'mps-youtube'
propagates 'python-pygobject', which propagates 'glib', which propagates
'util-linux'.  It seems to have been introduced with commit 6c237a2,
when 'util-linux' was moved to the propagated-inputs of 'glib'.

This is a problem on foreign distributions, where the stowaway 'mount'
and 'umount' commands installed by Guix shadow the setuid ones provided
by the distro.

I am currently on commit ecf3a3a (post core-updates merge).

Regards,

Diego

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

* bug#37732: mps-youtube propagates util-linux
  2019-10-13 11:40 bug#37732: mps-youtube propagates util-linux Diego Nicola Barbato
@ 2019-10-13 14:26 ` Marius Bakke
  2019-10-15 14:29   ` Diego Nicola Barbato
  2019-11-01 14:41   ` Ludovic Courtès
  0 siblings, 2 replies; 6+ messages in thread
From: Marius Bakke @ 2019-10-13 14:26 UTC (permalink / raw)
  To: Diego Nicola Barbato, 37732


[-- Attachment #1.1: Type: text/plain, Size: 814 bytes --]

Hello Diego,

Thanks for the report!

Diego Nicola Barbato <dnbarbato@posteo.de> writes:

> Hi Guix,
>
> An unfortunate chain of propagated-inputs causes 'util-linux' (mount,
> umount, etc.) to be installed alongside 'mps-youtube': 'mps-youtube'
> propagates 'python-pygobject', which propagates 'glib', which propagates
> 'util-linux'.  It seems to have been introduced with commit 6c237a2,
> when 'util-linux' was moved to the propagated-inputs of 'glib'.
>
> This is a problem on foreign distributions, where the stowaway 'mount'
> and 'umount' commands installed by Guix shadow the setuid ones provided
> by the distro.

I have attached a WIP patch that fixes this "long term", by moving the
util-linux libraries to a separate output.  It rebuilds 7753 packages
and is intended for the 'core-updates' branch.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-gnu-util-linux-Move-libraries-to-separate-output.patch --]
[-- Type: text/x-patch, Size: 6769 bytes --]

From b9cbe08694ddd8248ac32ce60d5fc40d5c619a54 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Sun, 13 Oct 2019 16:07:44 +0200
Subject: [PATCH] gnu: util-linux: Move libraries to separate output.

Fixes <https://bugs.gnu.org/37732>.
Reported by Diego Nicola Barbato <dnbarbato@posteo.de>.

* gnu/packages/linux.scm (util-linux)[outputs]: Add "dev".
[arguments]: Update #:configure-flags accordingly.  Add phase
"adjust-bindirs", and rename "move-static-libraries" to "move-libraries",
while adding a substitution for the .pc files.
* gnu/packages/fontutils.scm (fontconfig)[propagated-inputs]: Use the "dev"
output of UTIL-LINUX.
* gnu/packages/glib.scm (glib)[propagated-inputs]: Likewise.
---
 gnu/packages/fontutils.scm |  2 +-
 gnu/packages/glib.scm      |  2 +-
 gnu/packages/linux.scm     | 39 ++++++++++++++++++++++++++++++++------
 3 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/fontutils.scm b/gnu/packages/fontutils.scm
index e355f7bb89..e01ea615be 100644
--- a/gnu/packages/fontutils.scm
+++ b/gnu/packages/fontutils.scm
@@ -304,7 +304,7 @@ fonts to/from the WOFF2 format.")
    ;; In Requires or Requires.private of fontconfig.pc.
    (propagated-inputs `(("expat" ,expat)
                         ("freetype" ,freetype)
-                        ("libuuid" ,util-linux)))
+                        ("libuuid" ,util-linux "dev")))
    (inputs `(("gs-fonts" ,gs-fonts)))
    (native-inputs
     `(("gperf" ,gperf)
diff --git a/gnu/packages/glib.scm b/gnu/packages/glib.scm
index c558d9fcb6..ce695843ef 100644
--- a/gnu/packages/glib.scm
+++ b/gnu/packages/glib.scm
@@ -185,7 +185,7 @@ shared NFS home directories.")
     `(("pcre" ,pcre)  ; in the Requires.private field of glib-2.0.pc
       ("libffi" ,libffi) ; in the Requires.private field of gobject-2.0.pc
       ;; These are in the Requires.private field of gio-2.0.pc
-      ("util-linux" ,util-linux)  ; for libmount
+      ("util-linux" ,util-linux "dev")  ;for libmount
       ("libselinux" ,libselinux)
       ("zlib" ,zlib)))
    (inputs
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index bc39757da2..5a7351eaee 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -1089,19 +1089,40 @@ providing the system administrator with some help in common tasks.")
                     (("build_kill=yes") "build_kill=no"))
                   #t))))
     (build-system gnu-build-system)
-    (outputs '("out"
-               "static"))      ; >2 MiB of static .a libraries
+    (outputs '("out"                   ;6.4 MiB executables and documentation
+               "dev"                   ;8.8 MiB shared libraries, headers and locales
+               "static"))              ;2.9 MiB static .a libraries
     (arguments
      `(#:configure-flags (list "--disable-use-tty-group"
                                "--enable-fs-paths-default=/run/current-system/profile/sbin"
                                ;; Don't try to chown root:root mount and umount
                                "--disable-makeinstall-chown"
+                               "--localstatedir=/var"
+                               (string-append "--localedir="
+                                              (assoc-ref %outputs "dev")
+                                              "/share/locale")
+                               (string-append "--includedir="
+                                              (assoc-ref %outputs "dev") "/include")
+                               (string-append "--exec_prefix="
+                                              (assoc-ref %outputs "dev"))
+                               (string-append "--bindir="
+                                              (assoc-ref %outputs "out") "/bin")
+                               (string-append "--sbindir="
+                                              (assoc-ref %outputs "out") "/sbin")
                                ;; Install completions where our
                                ;; bash-completion package expects them.
                                (string-append "--with-bashcompletiondir="
                                               (assoc-ref %outputs "out")
                                               "/etc/bash_completion.d"))
        #:phases (modify-phases %standard-phases
+                  (add-before 'configure 'adjust-bindirs
+                    (lambda _
+                      ;; Some binaries are "hard coded" to use $exec_prefix/{,s}bin
+                      ;; instead of --bindir.  Adjust those to use $prefix instead.
+                      (substitute* "configure"
+                        (("\\$\\{exec_prefix\\}/(s?bin)" _ bin)
+                         (string-append "${prefix}/" bin)))
+                      #t))
                   (add-before
                    'build 'set-umount-file-name
                    (lambda* (#:key outputs #:allow-other-keys)
@@ -1122,12 +1143,13 @@ providing the system administrator with some help in common tasks.")
                           (string-append net "/etc/services")))
                        #t)))
                   (add-after
-                   'install 'move-static-libraries
+                   'install 'split-outputs
                    (lambda* (#:key outputs #:allow-other-keys)
-                     (let ((out    (assoc-ref outputs "out"))
+                     (let ((dev    (assoc-ref outputs "dev"))
                            (static (assoc-ref outputs "static")))
+
                        (mkdir-p (string-append static "/lib"))
-                       (with-directory-excursion out
+                       (with-directory-excursion dev
                          (for-each (lambda (file)
                                      (rename-file file
                                                   (string-append static "/"
@@ -1138,7 +1160,12 @@ providing the system administrator with some help in common tasks.")
                          ;; files so that Libtool does the right thing when both
                          ;; the shared and static library is available.
                          (substitute* (find-files "lib" "\\.la$")
-                           (("old_library=.*") "old_library=''\n")))
+                           (("old_library=.*") "old_library=''\n"))
+
+                         ;; Finally, drop the unused "prefix=" from the pkg-config
+                         ;; files to avoid a cyclic reference on "out".
+                         (substitute* (find-files "lib" "\\.pc$")
+                           (("^prefix=.*") "")))
 
                        #t))))))
     (inputs `(("zlib" ,zlib)
-- 
2.23.0


[-- Attachment #1.3: Type: text/plain, Size: 492 bytes --]


The size of 'fontconfig' (as reported by `guix size`) decreases from
103.6 MiB to 92.1 MiB with this patch.  \o/

Short term I'm not sure what to do.  Perhaps we can add a
"glib-sans-util-linux" variant that does not propagate util-linux?  Or a
variant that propagates a util-linux-sans-binaries?

Diego: one work-around you can try in the meantime is to create a
~/setuid-programs, add it first on PATH, and symlink the required
binaries in there.  Sorry for the inconvenience! 

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

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

* bug#37732: mps-youtube propagates util-linux
  2019-10-13 14:26 ` Marius Bakke
@ 2019-10-15 14:29   ` Diego Nicola Barbato
  2019-11-01 14:41   ` Ludovic Courtès
  1 sibling, 0 replies; 6+ messages in thread
From: Diego Nicola Barbato @ 2019-10-15 14:29 UTC (permalink / raw)
  To: Marius Bakke; +Cc: 37732

Hello Marius,

Marius Bakke <mbakke@fastmail.com> writes:


[...]


> Diego: one work-around you can try in the meantime is to create a
> ~/setuid-programs, add it first on PATH, and symlink the required
> binaries in there.  Sorry for the inconvenience! 

No worries.  I have simply removed 'mps-youtube' from my profile and use
it with 'guix environment --ad-hoc mps-youtube -- mpsyt' instead.  The
difficult part was finding out which package propagated 'util-linux'.  I
used 'emacs-guix' and lucky guesses to find it (fortunately the profile
only contained 12 packages).

Is there a more convenient way to recursively show all propagated-inputs
of a given package?  It would be interesting to check how prevalent this
propagation pollution is (another example that comes to mind is 'jami',
which installs 125 programs under bin/, of which only about half can be
attributed to 'util-linux').

Thanks,

Diego

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

* bug#37732: mps-youtube propagates util-linux
  2019-10-13 14:26 ` Marius Bakke
  2019-10-15 14:29   ` Diego Nicola Barbato
@ 2019-11-01 14:41   ` Ludovic Courtès
  2019-11-03 16:47     ` Marius Bakke
  1 sibling, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2019-11-01 14:41 UTC (permalink / raw)
  To: Marius Bakke; +Cc: 37732, Diego Nicola Barbato

Hi!

Marius Bakke <mbakke@fastmail.com> skribis:

> Diego Nicola Barbato <dnbarbato@posteo.de> writes:
>
>> Hi Guix,
>>
>> An unfortunate chain of propagated-inputs causes 'util-linux' (mount,
>> umount, etc.) to be installed alongside 'mps-youtube': 'mps-youtube'
>> propagates 'python-pygobject', which propagates 'glib', which propagates
>> 'util-linux'.  It seems to have been introduced with commit 6c237a2,
>> when 'util-linux' was moved to the propagated-inputs of 'glib'.

Do we know why this commit moved ‘util-linux’ to propagated-inputs?
Presumably because of this line in ‘gio-2.0.pc’, right?

  Requires.private: gmodule-no-export-2.0, zlib, mount >= 2.23, libselinux

If it’s “just” because of this, I’d say we don’t need to propagate
‘util-linux’: we only build shared libraries for GLib anyway, so none of
our packages actually use ‘Requires.private’.  If we were to add
packages requiring it, it’s fine to just add ‘mount’ as an explicit
inputs of these packages IMO.

We could follow the same reasoning for the other things that are
propagated due to their being listed in ‘Requires.private’.

Thoughts?

Moving ‘util-linux’ back to ‘inputs’ could perhaps be done on the next
‘staging’ or on ‘core-updates’.

> I have attached a WIP patch that fixes this "long term", by moving the
> util-linux libraries to a separate output.  It rebuilds 7753 packages
> and is intended for the 'core-updates' branch.
>
> From b9cbe08694ddd8248ac32ce60d5fc40d5c619a54 Mon Sep 17 00:00:00 2001
> From: Marius Bakke <mbakke@fastmail.com>
> Date: Sun, 13 Oct 2019 16:07:44 +0200
> Subject: [PATCH] gnu: util-linux: Move libraries to separate output.
>
> Fixes <https://bugs.gnu.org/37732>.
> Reported by Diego Nicola Barbato <dnbarbato@posteo.de>.
>
> * gnu/packages/linux.scm (util-linux)[outputs]: Add "dev".
> [arguments]: Update #:configure-flags accordingly.  Add phase
> "adjust-bindirs", and rename "move-static-libraries" to "move-libraries",
> while adding a substitution for the .pc files.
> * gnu/packages/fontutils.scm (fontconfig)[propagated-inputs]: Use the "dev"
> output of UTIL-LINUX.
> * gnu/packages/glib.scm (glib)[propagated-inputs]: Likewise.

[...]

> --- a/gnu/packages/linux.scm
> +++ b/gnu/packages/linux.scm
> @@ -1089,19 +1089,40 @@ providing the system administrator with some help in common tasks.")
>                      (("build_kill=yes") "build_kill=no"))
>                    #t))))
>      (build-system gnu-build-system)
> -    (outputs '("out"
> -               "static"))      ; >2 MiB of static .a libraries
> +    (outputs '("out"                   ;6.4 MiB executables and documentation
> +               "dev"                   ;8.8 MiB shared libraries, headers and locales
> +               "static"))              ;2.9 MiB static .a libraries

Shared libraries are not just for development, so I’d say it should be
“lib” instead, no?

Thanks,
Ludo’.

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

* bug#37732: mps-youtube propagates util-linux
  2019-11-01 14:41   ` Ludovic Courtès
@ 2019-11-03 16:47     ` Marius Bakke
  2020-01-14 23:39       ` Marius Bakke
  0 siblings, 1 reply; 6+ messages in thread
From: Marius Bakke @ 2019-11-03 16:47 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 37732, Diego Nicola Barbato

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

Ludovic Courtès <ludo@gnu.org> writes:

> Hi!
>
> Marius Bakke <mbakke@fastmail.com> skribis:
>
>> Diego Nicola Barbato <dnbarbato@posteo.de> writes:
>>
>>> Hi Guix,
>>>
>>> An unfortunate chain of propagated-inputs causes 'util-linux' (mount,
>>> umount, etc.) to be installed alongside 'mps-youtube': 'mps-youtube'
>>> propagates 'python-pygobject', which propagates 'glib', which propagates
>>> 'util-linux'.  It seems to have been introduced with commit 6c237a2,
>>> when 'util-linux' was moved to the propagated-inputs of 'glib'.
>
> Do we know why this commit moved ‘util-linux’ to propagated-inputs?
> Presumably because of this line in ‘gio-2.0.pc’, right?
>
>   Requires.private: gmodule-no-export-2.0, zlib, mount >= 2.23, libselinux

I assume so.

> If it’s “just” because of this, I’d say we don’t need to propagate
> ‘util-linux’: we only build shared libraries for GLib anyway, so none of
> our packages actually use ‘Requires.private’.  If we were to add
> packages requiring it, it’s fine to just add ‘mount’ as an explicit
> inputs of these packages IMO.
>
> We could follow the same reasoning for the other things that are
> propagated due to their being listed in ‘Requires.private’.
>
> Thoughts?

Right.  You know, I had forgotten that Requires.private were for static
libraries.  Thanks for pointing that out.  I think quite a few packages
propagate Requires.private dependencies without using static libraries.

Something to watch out for in the ongoing quest to purge static
libraries from Guix.

> Moving ‘util-linux’ back to ‘inputs’ could perhaps be done on the next
> ‘staging’ or on ‘core-updates’.

util-linux now has 7880 dependent packages, as 'fontconfig' recently
started depending on it.  So it must go through 'core-updates'.  Luckily
that branch is slated to start by the end of this month, so the waiting
time should not be too long.

>> I have attached a WIP patch that fixes this "long term", by moving the
>> util-linux libraries to a separate output.  It rebuilds 7753 packages
>> and is intended for the 'core-updates' branch.
>>
>> From b9cbe08694ddd8248ac32ce60d5fc40d5c619a54 Mon Sep 17 00:00:00 2001
>> From: Marius Bakke <mbakke@fastmail.com>
>> Date: Sun, 13 Oct 2019 16:07:44 +0200
>> Subject: [PATCH] gnu: util-linux: Move libraries to separate output.
>>
>> Fixes <https://bugs.gnu.org/37732>.
>> Reported by Diego Nicola Barbato <dnbarbato@posteo.de>.
>>
>> * gnu/packages/linux.scm (util-linux)[outputs]: Add "dev".
>> [arguments]: Update #:configure-flags accordingly.  Add phase
>> "adjust-bindirs", and rename "move-static-libraries" to "move-libraries",
>> while adding a substitution for the .pc files.
>> * gnu/packages/fontutils.scm (fontconfig)[propagated-inputs]: Use the "dev"
>> output of UTIL-LINUX.
>> * gnu/packages/glib.scm (glib)[propagated-inputs]: Likewise.
>
> [...]
>
>> --- a/gnu/packages/linux.scm
>> +++ b/gnu/packages/linux.scm
>> @@ -1089,19 +1089,40 @@ providing the system administrator with some help in common tasks.")
>>                      (("build_kill=yes") "build_kill=no"))
>>                    #t))))
>>      (build-system gnu-build-system)
>> -    (outputs '("out"
>> -               "static"))      ; >2 MiB of static .a libraries
>> +    (outputs '("out"                   ;6.4 MiB executables and documentation
>> +               "dev"                   ;8.8 MiB shared libraries, headers and locales
>> +               "static"))              ;2.9 MiB static .a libraries
>
> Shared libraries are not just for development, so I’d say it should be
> “lib” instead, no?

Agreed.  Will adjust this patch accordingly once I get around to start
working on 'core-updates'.  :-)

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

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

* bug#37732: mps-youtube propagates util-linux
  2019-11-03 16:47     ` Marius Bakke
@ 2020-01-14 23:39       ` Marius Bakke
  0 siblings, 0 replies; 6+ messages in thread
From: Marius Bakke @ 2020-01-14 23:39 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 37732-done, Diego Nicola Barbato

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

Marius Bakke <mbakke@fastmail.com> writes:

>>> --- a/gnu/packages/linux.scm
>>> +++ b/gnu/packages/linux.scm
>>> @@ -1089,19 +1089,40 @@ providing the system administrator with some help in common tasks.")
>>>                      (("build_kill=yes") "build_kill=no"))
>>>                    #t))))
>>>      (build-system gnu-build-system)
>>> -    (outputs '("out"
>>> -               "static"))      ; >2 MiB of static .a libraries
>>> +    (outputs '("out"                   ;6.4 MiB executables and documentation
>>> +               "dev"                   ;8.8 MiB shared libraries, headers and locales
>>> +               "static"))              ;2.9 MiB static .a libraries
>>
>> Shared libraries are not just for development, so I’d say it should be
>> “lib” instead, no?
>
> Agreed.  Will adjust this patch accordingly once I get around to start
> working on 'core-updates'.  :-)

I opted for a more conventional "lib" output and pushed the patch to the
'core-updates' branch in bb93042c8beb881ab907fa802eefb3c4091039a2.

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

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

end of thread, other threads:[~2020-01-14 23:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-13 11:40 bug#37732: mps-youtube propagates util-linux Diego Nicola Barbato
2019-10-13 14:26 ` Marius Bakke
2019-10-15 14:29   ` Diego Nicola Barbato
2019-11-01 14:41   ` Ludovic Courtès
2019-11-03 16:47     ` Marius Bakke
2020-01-14 23:39       ` Marius Bakke

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).