For things like this to be useful: hephaestus $ cat /etc/env.d/00local PATH="/usr/lib/ccache/bin:/usr/lib/distcc/bin" ROOTPATH="/usr/lib/ccache/bin:/usr/lib/distcc/bin" we need /etc/profile to prepend items to the path instead of appending them to the end of it. Could this be changed?
that would break gcc-config handling with multilib. better to add a new PRE_PATH and PRE_ROOTPATH variable i think.
The PATH setup inside portage's ebuild.sh already has support for a PREROOTPATH variable (without underscore). For /etc/profile, naming the variable slightly differenty is good, since otherwise we could get some interference. For example, it the user puts /usr/lib/ccache/bin in PREROOTPATH then it's going to trigger sandbox violations in CCACHE_DIR if the user hasn't enabled FEATURES=ccache.
If gcc-config is the only thing that breaks, I kinda wonder if everything else should prepend (i.e. PATH/ROOTPATH are prepend by default), and just gcc-config should append. I'd expect that in most cases we'd want things in special paths to be preferred over the default path.
gcc-config being the only known thing so far doesnt make it the only thing ... also, gcc-config itself adds no path. i'm talking about all the paths in $PATH showing up before /usr/bin which /etc/profile adds.
You clearly understand gcc-config better than I do, so go ahead and fix this in whatever way makes the most sense to you.
*** Bug 484268 has been marked as a duplicate of this bug. ***
(In reply to SpanKY from comment #4) > gcc-config being the only known thing so far doesnt make it the only thing > ... > > also, gcc-config itself adds no path. i'm talking about all the paths in > $PATH showing up before /usr/bin which /etc/profile adds. Can you elaborate on this a bit more? It's not clear to me how having /usr/bin at the tail end of PATH would break "gcc-config handling with multilib". Also, maybe instead of hard-coding the position of PATH in /etc/profile, we could move "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" into a new file called /etc/env.d/50default and make it follow the same logic as every other PATH setting.
Actually I like floppym's idea.
Created attachment 475562 [details, diff] 0001-Move-default-path-to-env.d.patch This is a proposed patch to move the default path setting to a file in /etc/env.d. I called the file 50defaultpath. Take a look and let me know what you think. I do suspect that this will break other packages. William
Created attachment 475570 [details, diff] 0001-etc-env.d-move-default-settings-to-50bbaselayout-ins.patch This is a better patch, but definitely could cause more breakages. How should we handle this type of breakage? William
This is in the tree and will be in baselayout-2.4. https://gitweb.gentoo.org/proj/baselayout.git/commit/?id=ef383418
You forgot to apply the patch to update /etc/profile.
https://gitweb.gentoo.org/proj/baselayout.git/commit/?id=ec3d9fb5
(In reply to Mike Gilbert from comment #7) > (In reply to SpanKY from comment #4) > > gcc-config being the only known thing so far doesnt make it the only thing > > ... > > > > also, gcc-config itself adds no path. i'm talking about all the paths in > > $PATH showing up before /usr/bin which /etc/profile adds. > > Can you elaborate on this a bit more? It's not clear to me how having > /usr/bin at the tail end of PATH would break "gcc-config handling with > multilib". > > Also, maybe instead of hard-coding the position of PATH in /etc/profile, we > could move "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" > into a new file called /etc/env.d/50default and make it follow the same > logic as every other PATH setting. gcc-config wrapper (/usr/bin/gcc) used to append CFLAGS_<ABI> based in ABI variable. That means you really wanted '/usr/bin/gcc' as your first entry in PATH and not real gcc binary. Addition of CFLAGS_<ABI> was removed since in 2011: https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=7ac40f3eb8434961f70485247d883f5b3009dcf2
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=9b907ef80bc421df23515afc4c306e4d96c67649 commit 9b907ef80bc421df23515afc4c306e4d96c67649 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2018-08-24 17:36:57 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2018-08-24 18:09:17 +0000 Convert binary wrapper to a symlink wrapper. Before the change: /usr/bin/gcc and friends were a copy of /usr/$(libexecdir)/misc/gcc-config After the change: /usr/bin/gcc is a symlink to a real compiler binary. Examples: /usr/${CTARGET}/gcc-bin/${GCC_VER}/gcc (native) /usr/${CHOST}/${CTARGET}/gcc-bin/${GCC_VER}/gcc (cross) gcc-config is a binary wrapper that does (or did) a few things: - [removed in 2011] injects additional CFLAGS_${ABI} Removed in commit 7ac40f3eb8434961f70485247d883f5b3009dcf2 "Stop auto appending CFLAGS_<abi> from the env." - traverses PATH for real compiler binary and reexecutes it. - reads /etc/env.d/05gcc-${CTARGET} as a fallback if PATH is empty. Today binary wrapper does only PATH resolution and re-execution. This change has a few minor benefits: - PATH will not contain explicit /usr/${CHOST}/${CTARGET}/gcc-bin/${GCC_VER} entry. This will make PATH shorter for those who have mavy cross-compilers installed. - compiler switch will not require sourcing '. /etc/profile' as changes are applied as soon an symlink is switched. - ccache will see gcc binary changes directly and react accordingly. Previously in default configuration ccache cache depended on state of /usr/$(libexecdir)/misc/gcc-config See bug #640958 where ccache did not notice USE=-pie -> USE=pie switch. - Reasoning about PATH ordering is straightforward: all available binaries (as symlinks) are in /usr/bin. See bug #255695 where PATH ordering changed and bug #626606 where people get confused on what is in /usr/bin/gcc binary. Bug: https://bugs.gentoo.org/626606 Bug: https://bugs.gentoo.org/255695 Bug: https://bugs.gentoo.org/640958 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> .gitignore | 3 - Makefile | 8 +- README | 69 +---- gcc-config | 33 +-- tests/rw-multi-native-configs/test.select | 4 +- .../usr/lib/gcc-config/wrapper | 0 tests/source/test.whitespace | 2 +- wrapper.c | 323 --------------------- 8 files changed, 28 insertions(+), 414 deletions(-)