Let's work on removing sys-apps/which from the @system set. It is not listed as a required command by POSIX, and it is entirely superficial on any system with POSIX shell, with the shell providing a more reliable built-ins that don't reinvent the wheel. If any packages really rely on which, they should depend on it explicitly and preferably be fixed upstream to use shell builtin 'type -P' or likewise.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1769ce6cb3a9b6273033158574ed833b11eb7d0d commit 1769ce6cb3a9b6273033158574ed833b11eb7d0d Author: Sam James <sam@gentoo.org> AuthorDate: 2022-12-06 05:44:04 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2022-12-06 05:44:04 +0000 postgres.eclass: stop using which(1) It's non-portable and we're looking to remove it from @system. Bug: https://bugs.gentoo.org/646588 Signed-off-by: Sam James <sam@gentoo.org> eclass/postgres.eclass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=da744421aa59fbf4e05b92702dae88dcb7af33d4 commit da744421aa59fbf4e05b92702dae88dcb7af33d4 Author: Sam James <sam@gentoo.org> AuthorDate: 2022-12-06 05:44:03 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2022-12-06 05:44:03 +0000 postgres-multi.eclass: stop using which(1) It's non-portable and we're looking to remove it from @system. Bug: https://bugs.gentoo.org/646588 Signed-off-by: Sam James <sam@gentoo.org> eclass/postgres-multi.eclass | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=88389031f2b0377f449ed0c6cd65c85a989b8470 commit 88389031f2b0377f449ed0c6cd65c85a989b8470 Author: Sam James <sam@gentoo.org> AuthorDate: 2022-12-06 05:44:03 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2022-12-06 05:44:03 +0000 usr-ldscript.eclass: stop using which(1) It's non-portable and we're looking to remove it from @system. Bug: https://bugs.gentoo.org/646588 Signed-off-by: Sam James <sam@gentoo.org> eclass/usr-ldscript.eclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=88607de9c44a1b11017ecb7d2d5e8868c48b1695 commit 88607de9c44a1b11017ecb7d2d5e8868c48b1695 Author: Sam James <sam@gentoo.org> AuthorDate: 2022-12-06 05:44:03 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2022-12-06 05:44:03 +0000 toolchain-funcs.eclass: stop using which(1) It's non-portable and we're looking to remove it from @system. Bug: https://bugs.gentoo.org/487696 Bug: https://bugs.gentoo.org/646588 Signed-off-by: Sam James <sam@gentoo.org> eclass/toolchain-funcs.eclass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
It was brought to my attention in bug 940218 that it turns out the first comment has incorrect information that will not result in a valid fix. (In reply to Michał Górny from comment #0) > Let's work on removing sys-apps/which from the @system set. It is not listed > as a required command by POSIX, and it is entirely superficial on any system > with POSIX shell, with the shell providing a more reliable built-ins that > don't reinvent the wheel. > > If any packages really rely on which, they should depend on it explicitly > and preferably be fixed upstream to use shell builtin 'type -P' or likewise. "type -P" is not listed as a required command by POSIX and the shell does not provide such a built-in at all (unless you happen to use bash). For scripts that use #!/bin/bash in the shebang, it remains acceptable to use "type -P" For ./configure scripts, or any other scripts that use #!/bin/sh in the shebang, one *must* use "command -v" instead. It is weaker in the event that one looks for a command that the shell provides, e.g. "command -v true", as it will return the first available command, and not guarantee it is an executable file on disk, but it works in nearly all cases. If you use "type -P" for non-bash scripts then your package will instead have a new bug report opened against it blocking the bug 526268 tracker instead of this tracker.