Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 756238 - Improper quoting of pkg-config output in ebuilds maintained by gnome project
Summary: Improper quoting of pkg-config output in ebuilds maintained by gnome project
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Linux Gnome Desktop Team
URL: https://bugs.gentoo.org/756196
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2020-11-23 14:47 UTC by flippynelle
Modified: 2020-12-14 16:47 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch for multilib.eclass (multilib.eclass.patch,1.28 KB, patch)
2020-11-23 23:35 UTC, Arfrever Frehtes Taifersar Arahesis
Details | Diff
Patch for dev-util/pkgconf (pkgconf.patch,1.85 KB, patch)
2020-11-24 00:02 UTC, Arfrever Frehtes Taifersar Arahesis
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description flippynelle 2020-11-23 14:47:08 UTC
A quick look finds other packages that seem to be in need of the same fix that bug 756196 got:

gnome-base/gnome-panel/gnome-panel-3.36.2.ebuild
gnome-base/gnome-flashback/gnome-flashback-3.36.4.ebuild
gnome-base/gdm/gdm-3.36.4.ebuild
gnome-base/gdm/gdm-3.36.3.ebuild
mate-extra/mate-system-monitor/mate-system-monitor-1.24.1.ebuild
mate-extra/mate-system-monitor/mate-system-monitor-1.24.0.ebuild
net-misc/modemmanager/modemmanager-1.10.0.ebuild
net-misc/modemmanager/modemmanager-1.8.2-r1.ebuild



Reproducible: Didn't try




the fix can be seen in:
https://github.com/gentoo/gentoo/pull/18375/commits/a86e78dd0b3fb682bd991193fb06561d2d33f738

Thanks!
Comment 1 Mart Raudsepp gentoo-dev 2020-11-23 22:05:47 UTC
I see pkg-config --libs has started reporting a
-L/lib64
in front as well, hence breaking it from the no quoting
Comment 2 Arfrever Frehtes Taifersar Arahesis 2020-11-23 23:29:41 UTC
Quoting is good, but real problem is in incomplete settings in multilib.eclass.

Example:

$ cat /usr/lib64/pkgconfig/aaaaaa.pc
Name: aaaaaa
Description:
Version: 0
Cflags: -I/usr/include
Libs: -L/lib64 -L/usr/lib64 -laaaaaa
$ pkg-config --cflags aaaaaa

$ pkg-config --libs aaaaaa
-L/lib64 -laaaaaa
$ PKG_CONFIG_SYSTEM_INCLUDE_PATH="" pkg-config --cflags aaaaaa
-I/usr/include
$ PKG_CONFIG_SYSTEM_LIBRARY_PATH="" pkg-config --libs aaaaaa
-L/lib64 -L/usr/lib64 -laaaaaa
$ PKG_CONFIG_SYSTEM_INCLUDE_PATH="/usr/include" pkg-config --cflags aaaaaa

$ PKG_CONFIG_SYSTEM_LIBRARY_PATH="/lib64" pkg-config --libs aaaaaa
-L/usr/lib64 -laaaaaa 
$ PKG_CONFIG_SYSTEM_LIBRARY_PATH="/usr/lib64" pkg-config --libs aaaaaa
-L/lib64 -laaaaaa 
$ PKG_CONFIG_SYSTEM_LIBRARY_PATH="/lib64:/usr/lib64" pkg-config --libs aaaaaa
-laaaaaa


multilib.eclass currently contains:

export PKG_CONFIG_SYSTEM_LIBRARY_PATH=${EPREFIX}/usr/$(get_libdir)

This setting should be extended to also include ${EPREFIX}/$(get_libdir).
For consistency, PKG_CONFIG_SYSTEM_INCLUDE_PATH="${EPREFIX}/usr/include" can be also set.
Comment 3 Arfrever Frehtes Taifersar Arahesis 2020-11-23 23:35:58 UTC
Created attachment 674590 [details, diff]
Patch for multilib.eclass
Comment 4 Arfrever Frehtes Taifersar Arahesis 2020-11-23 23:59:29 UTC
For ebuilds not using multilib.eclass, default value for dev-util/pkgconf can be set in --with-system-includedir and --with-system-libdir options passed to configure of dev-util/pkgconf:

AC_ARG_WITH([system-libdir],[AC_HELP_STRING([--with-system-libdir],[specify the
             system library directory (default LIBDIR)])],
             SYSTEM_LIBDIR="$withval", SYSTEM_LIBDIR="${libdir}")

AC_SUBST([SYSTEM_LIBDIR])

AC_ARG_WITH([system-includedir],[AC_HELP_STRING([--with-system-includedir],[specify the
             system include directory (default INCLUDEDIR)])],
             SYSTEM_INCLUDEDIR="$withval", SYSTEM_INCLUDEDIR="${includedir}")

AC_SUBST([SYSTEM_INCLUDEDIR])
Comment 5 Arfrever Frehtes Taifersar Arahesis 2020-11-24 00:02:06 UTC
Created attachment 674593 [details, diff]
Patch for dev-util/pkgconf
Comment 6 Mike Gilbert gentoo-dev 2020-11-24 02:32:51 UTC
(In reply to flippynelle from comment #0)

Yuck, who uses backticks in ebuilds? $() is superior in every way.
Comment 7 Mike Gilbert gentoo-dev 2020-11-24 02:33:48 UTC
(In reply to Arfrever Frehtes Taifersar Arahesis from comment #3)
> Created attachment 674590 [details, diff] [details, diff]
> Patch for multilib.eclass

This patch looks reasonable to me.
Comment 8 Mike Gilbert gentoo-dev 2020-11-24 02:38:25 UTC
Actually, it seems strange that packages would install .pc files with Libs: -L/lib or Libs: -L/lib64 in them. That would imply it also installs its .so files in /lib or /lib64, which should not happen very often.
Comment 9 Mike Gilbert gentoo-dev 2020-11-24 02:51:28 UTC
Looking at bug 756196, libelogind.so is being installed in /lib. This happens because the ebuild passes -Drootlibdir="${EPREFIX}/$(get_libdir)" to meson configure.

For comparison, on systemd systems, libsystemd.so is installed in /usr/lib because we pass -Drootlibdir="${EPREFIX}/usr/$(get_libdir)" to meson configure. We do this in case the user enables static-libs, so that libsystemd.a gets put under /usr/lib to comply with policy. The versioned shared library gets moved to /lib by gen_usr_ldscript.

I guess installing .so files in /lib is fine, and we should apply Arfrever's patches to allow that to work properly.
Comment 10 Mike Gilbert gentoo-dev 2020-11-24 03:04:28 UTC
eclass patch sent to gentoo-dev for review.

https://archives.gentoo.org/gentoo-dev/message/dbae8f1d19f2eaf0123ea25ec8626dfe

I'll push it in a couple days if there are no objections. I will also push the pkgconf patch at that time.
Comment 11 Larry the Git Cow gentoo-dev 2020-11-25 17:46:39 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f80c1bfe84e86a802ee892d9800225c978dca59d

commit f80c1bfe84e86a802ee892d9800225c978dca59d
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
AuthorDate: 2020-11-23 23:00:00 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2020-11-25 17:45:43 +0000

    dev-util/pkgconf: Include /$(get_libdir) in default system libdir.
    
    Bug: https://bugs.gentoo.org/756238
    Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 dev-util/pkgconf/{pkgconf-1.7.3.ebuild => pkgconf-1.7.3-r1.ebuild} | 7 ++++++-
 dev-util/pkgconf/pkgconf-9999.ebuild                               | 7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=db1630476083e7a09767e9bd96ecdb7ac3f7496c

commit db1630476083e7a09767e9bd96ecdb7ac3f7496c
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
AuthorDate: 2020-11-23 23:00:00 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2020-11-25 17:45:40 +0000

    multilib.eclass: Include /$(get_libdir) in PKG_CONFIG_SYSTEM_LIBRARY_PATH.
    
    Set also PKG_CONFIG_SYSTEM_INCLUDE_PATH for consistency.
    
    Bug: https://bugs.gentoo.org/756238
    Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 eclass/multilib.eclass | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Comment 12 Matt Turner gentoo-dev 2020-12-05 22:55:54 UTC
Joining the party late. Can someone summarize what's left to be done?
Comment 13 Mike Gilbert gentoo-dev 2020-12-06 06:13:48 UTC
(In reply to Matt Turner from comment #12)
> Joining the party late. Can someone summarize what's left to be done?

The packages mentioned in comment 0 still need to be fixed to properly quote the output of pkg-config.

In IRC, leio said a fix was "in progress", but it does not appear to have been pushed to Gentoo yet.
Comment 14 flippynelle 2020-12-14 00:43:27 UTC
As per the above-mentioned PR https://github.com/gentoo/gentoo/pull/18631 ("Also, stop redirecting error output to /dev/null; that hides useful information from the build log."), if it's not too much to ask, could someone also do the removal of "2>/dev/null" from pulseaudio package too? 
ie. https://github.com/Polynomial-C/gentoo/commit/f1e91c667fb2ae4694070397d47f78ed23144d82#diff-36f0fbaccf9dfb6bf2f67f8f238d73ef2be7925d2be51b7592d4c0704d3bc6b2R208
Comment 15 Mike Gilbert gentoo-dev 2020-12-14 01:35:05 UTC
(In reply to flippynelle from comment #14)

I added a commit to the pull request to stop redirecting error output in the pulseaudio ebuild.
Comment 16 Larry the Git Cow gentoo-dev 2020-12-14 16:47:03 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a7e8b798856ce4d5b295005637b00b4921bd732c

commit a7e8b798856ce4d5b295005637b00b4921bd732c
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2020-12-13 03:06:54 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2020-12-14 16:45:18 +0000

    net-misc/modemmanager: fix quoting for pkg-config
    
    Closes: https://bugs.gentoo.org/756238
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 net-misc/modemmanager/modemmanager-1.10.0.ebuild   | 7 ++++---
 net-misc/modemmanager/modemmanager-1.8.2-r1.ebuild | 7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)

Additionally, it has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=59f1666ed50efdc20fb89ed20f6b3bc12f592c76

commit 59f1666ed50efdc20fb89ed20f6b3bc12f592c76
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2020-12-13 03:04:35 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2020-12-14 16:45:18 +0000

    mate-extra/mate-system-monitor: fix quoting for pkg-config
    
    Bug: https://bugs.gentoo.org/756238
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 mate-extra/mate-system-monitor/mate-system-monitor-1.24.0.ebuild | 7 ++++---
 mate-extra/mate-system-monitor/mate-system-monitor-1.24.1.ebuild | 7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=46b2d4e7cd4e4859bb33eeb8863cd5b1e6a7ac4a

commit 46b2d4e7cd4e4859bb33eeb8863cd5b1e6a7ac4a
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2020-12-13 03:01:33 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2020-12-14 16:45:17 +0000

    gnome-base/gdm: fix quoting for pkg-config
    
    Bug: https://bugs.gentoo.org/756238
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 gnome-base/gdm/gdm-3.36.3.ebuild | 7 ++++---
 gnome-base/gdm/gdm-3.36.4.ebuild | 7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aa25bd36a7b854346d694de10e39b0905cdf1f2c

commit aa25bd36a7b854346d694de10e39b0905cdf1f2c
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2020-12-13 02:58:26 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2020-12-14 16:45:17 +0000

    gnome-base/gnome-flashback: fix quoting for pkg-config
    
    Bug: https://bugs.gentoo.org/756238
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 gnome-base/gnome-flashback/gnome-flashback-3.36.4.ebuild | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8de56a6ce69708d679352ca879c18fc5298095e5

commit 8de56a6ce69708d679352ca879c18fc5298095e5
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2020-12-13 02:54:31 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2020-12-14 16:45:15 +0000

    gnome-base/gnome-panel: fix quoting for pkg-config
    
    Bug: https://bugs.gentoo.org/756238
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 gnome-base/gnome-panel/gnome-panel-3.36.2.ebuild | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)