Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 880977 - sys-devel/gcc-config: Creates broken symlinks to lto plugin and cc for ROOT != /
Summary: sys-devel/gcc-config: Creates broken symlinks to lto plugin and cc for ROOT != /
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2022-11-11 12:43 UTC by Krzesimir Nowak
Modified: 2023-01-05 00:19 UTC (History)
2 users (show)

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


Attachments
Patch implementing the relative variant. (0001-gcc-config-Use-relative-paths-for-liblto-and-cc-syml.patch,1.67 KB, patch)
2022-11-11 12:43 UTC, Krzesimir Nowak
Details | Diff
Patch implementing no EROOT variant (0001-gcc-config-Do-not-use-EROOT-for-symlink-targets.patch,1.35 KB, patch)
2022-11-11 12:46 UTC, Krzesimir Nowak
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Krzesimir Nowak 2022-11-11 12:43:43 UTC
Created attachment 831367 [details, diff]
Patch implementing the relative variant.

In Flatcar we are building packages inside `/build/amd64-usr` ROOT, and gcc-config  creates symlinks that contain ROOT in their target. Which means that once chrooted into ROOT, those symlinks become dangling:

/build/amd64-usr/usr/x86_64-cros-linux-gnu/binutils-bin/lib/bfd-plugins/liblto_plugin.so -> /build/amd64-usr/usr/libexec/gcc/x86_64-cros-linux-gnu/11.3.0/liblto_plugin.so

/build/amd64-usr/usr/bin/x86_64-cros-linux-gnu-cc -> /build/amd64-usr/usr/bin/x86_64-cros-linux-gnu-gcc

Currently we have a hack to fix up those symlinks (https://github.com/flatcar/scripts/blob/7a7cabf2d933580dfd58cf392970ccf9e485d050/common.sh#L979-L1012).

I suppose we wouldn't need this hack if the symlink targets were relative, or didn't use EROOT at all. Please see the attached patches that implement both alternatives.

Other possibility could be to remove SYSROOT prefix from the target, but not sure if it's a valid solution.

If you prefer me to create a PR on github or need some other information, please let me know. Thanks.
Comment 1 Krzesimir Nowak 2022-11-11 12:46:05 UTC
Created attachment 831369 [details, diff]
Patch implementing no EROOT variant
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-12-28 15:26:00 UTC
Thanks. Would you mind making a PR at https://github.com/gentoo/gcc-config/pulls? It's not required though.

I think I prefer the relative option (thanks for providing both).
Comment 3 Krzesimir Nowak 2023-01-03 09:28:57 UTC
Filed a PR: https://github.com/gentoo/gcc-config/pull/2
Comment 4 Larry the Git Cow gentoo-dev 2023-01-05 00:16:38 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=d245197378818f66c978d4427b6d0d81fbfaefc6

commit d245197378818f66c978d4427b6d0d81fbfaefc6
Author:     Krzesimir Nowak <knowak@microsoft.com>
AuthorDate: 2022-11-10 15:45:48 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-01-05 00:16:31 +0000

    gcc-config: Use relative paths for liblto and cc symlink targets
    
    That way, for ROOT different than / (like /build/amd64-usr) these
    symlinks won't dangle after chrooting into ROOT.
    
    Bug: https://bugs.gentoo.org/880977
    Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
    Closes: https://github.com/gentoo/gcc-config/pull/2
    Signed-off-by: Sam James <sam@gentoo.org>

 gcc-config | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Comment 5 Larry the Git Cow gentoo-dev 2023-01-05 00:19:30 UTC
The bug has been closed via the following commit(s):

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

commit d37acf1855c6dccbab4b9791ae66395c91974f2a
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-01-05 00:18:47 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-01-05 00:18:47 +0000

    sys-devel/gcc-config: add 2.10
    
    Closes: https://bugs.gentoo.org/880977
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-devel/gcc-config/Manifest               |  1 +
 sys-devel/gcc-config/gcc-config-2.10.ebuild | 60 +++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+)