Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 554334 - sys-devel/gcc-config pkg-postinst rm -f /usr/sbin/gcc-config breaks when using /usr/sbin->bin symlinks
Summary: sys-devel/gcc-config pkg-postinst rm -f /usr/sbin/gcc-config breaks when usin...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-09 14:49 UTC by Duncan
Modified: 2017-10-04 05:11 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Duncan 2015-07-09 14:49:29 UTC
+++ This bug was initially created as a clone of Bug #79062 +++

This affects all currently in-tree versions.

The fix for the above bug is that gcc-config pkg_postinst does an unconditional

rm -f "${ROOT}"/usr/sbin/gcc-config


Ironically (the above bug was mine, a decade ago), that's now come back to bite me. =:^(

The problem is that I now have unified bin/sbin and usr/root, with these symlinks:

/usr -> .
/sbin -> bin

So /bin is ultimately where everything ends up.

But in the gcc-config ebuilds, after the qmerge merges /usr/bin/gcc-config, which ends up as /bin/gcc-config due to the symlinks, the postinst unconditionally deletes /usr/sbin/gcc-config, which again due to the symlinks is the same file!

I was oblivious until I tried doing the gcc-4.9.3 update this morning, and I suddenly lost both gcc and libstdc++ because gcc-config wasn't there to update from the gcc-4.9.2 paths!

Luckily I had a gcc-binpkg to copy the binary from, as gcc-config of course wouldn't build without a working gcc, either.  I put the ebuild in my overlay, commented out the rm, and tried to build, but it errored out because it couldn't find gcc.  And of course installing the existing binpkg normally wouldn't work, as it simply rmed the binary after merging it again.  So I had to dig the binary out of the binpkg and copy it into place manually.  Then I could run gcc-config, get a working gcc again, remerge gcc-config from the overlay, and could /then/ file this bug (firefox of course wouldn't start without libstdc++ so I couldn't file the bug until I got a working libstdc++ again).

Suggested fix, test if /usr/bin/gcc-config and /usr/sbin/gcc-config are the same file and only remove it if not.

Or... based on the above bug, gcc-config has been in /usr/bin for over a decade now, so that rm and associated comment could probably simply be removed.

Thanks! =:^)
Duncan
Comment 1 Duncan 2016-03-21 13:27:32 UTC
Bump.

8 months later and I remerged gcc-5.3.0-r1 and noticed that it couldn't find gcc-config.  Obviously I have reinstalled or updated gcc-config since then and it deleted its own executable again. =:^(

But I had forgotten this bug, and only found it on doing a pre-bug-filing bug search on ALL sys-devel/gcc-config.

8 months is a long time to wait on a simple fix such as this for such a critical package and bug.
Comment 2 Duncan 2016-03-22 07:56:34 UTC
Today at work I remembered the automated post-sync ebuild-patching infrastructure I setup back when gentoo/kde was trying to force semantic-desktop down the gentoo/kde user's throats despite upstream making it optional.  Gentoo/kde eventually reversed course[1], but meanwhile, I set things up so the no-semantic patches would be applied to the ebuilds automatically.

So when I got home I created a patch for /etc/portage/patches.ebuild/sys-devel/gcc-config/ that deleted the offending line from the ebuild.  Long story short, 8 more months or 8 more years until my "gentoo upstream" fixes it, it's fixed here via automated ebuild patching, and I won't have to worry about it until my patch quits applying.

---
[1] Reversed course: At least for kde4.  Seems they're trying it again for kde/plasma5, but that's far more modular and the damage much more limited there, so it has been easy to patch out via conventional sources patches and I'd not needed ebuild patches in quite some time... until now, for gcc-config, not various kde packages.
Comment 3 Larry the Git Cow gentoo-dev 2017-10-02 20:40:46 UTC
The bug has been closed via the following commit(s):

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

commit 26acb19b0b76c6adde2622da07dcfec25bdc102c
Author:     Andreas K. Hüttel <dilfridge@gentoo.org>
AuthorDate: 2017-10-02 20:39:43 +0000
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: 2017-10-02 20:40:29 +0000

    sys-devel/gcc-config: Remove ugly workaround for 12 years gone bug, bug 554334
    
    Closes: https://bugs.gentoo.org/554334
    Package-Manager: Portage-2.3.10, Repoman-2.3.3

 sys-devel/gcc-config/gcc-config-1.7.3.ebuild  | 5 +----
 sys-devel/gcc-config/gcc-config-1.8-r1.ebuild | 5 +----
 sys-devel/gcc-config/gcc-config-1.8.ebuild    | 5 +----
 sys-devel/gcc-config/gcc-config-1.9.0.ebuild  | 3 ---
 4 files changed, 3 insertions(+), 15 deletions(-)
Comment 4 Duncan 2017-10-04 05:11:05 UTC
Just confirming the fix.  Thanks. =:^)