auto/cc: Use portable/POSIX 'command -v' instead of 'which'#1016
Merged
Conversation
'which' is not a portable utility as it is not specified by POSIX. Since auto/cc is already a shell script, use the more direct and portable 'command' builtin to detect $CC. There are two bugs linked here. The first one is a downstream report of this issue. The second one is more general information on why 'which' usage is an issue and should be avoided. Bug: https://bugs.gentoo.org/969288 Bug: https://bugs.gentoo.org/646588 Signed-off-by: Zurab Kvachadze <zurabid2016@gmail.com>
BalkanMadman
added a commit
to BalkanMadman/gentoo
that referenced
this pull request
Jan 26, 2026
'which' is not portable and is on the way to be removed (bug 646588). This commit fixes the auto/cc /bin/sh script to use the portable 'command -v' to detect whether CC is present and executable. Upstream: nginx/njs#1016 Bug: https://bugs.gentoo.org/646588 Closes: https://bugs.gentoo.org/969288 Signed-off-by: Zurab Kvachadze <zurabid2016@gmail.com>
4 tasks
BalkanMadman
added a commit
to BalkanMadman/gentoo
that referenced
this pull request
Feb 12, 2026
'which' is not portable and is on the way to be removed (bug 646588). This commit fixes the auto/cc /bin/sh script to use the portable 'command -v' to detect whether CC is present and executable. Upstream: nginx/njs#1016 Closes: https://bugs.gentoo.org/969288 Signed-off-by: Zurab Kvachadze <zurabid2016@gmail.com>
BalkanMadman
added a commit
to BalkanMadman/gentoo
that referenced
this pull request
Feb 12, 2026
'which' is not portable and is on the way to be removed (bug 646588). This commit fixes the auto/cc /bin/sh script to use the portable 'command -v' to detect whether CC is present and executable. Upstream: nginx/njs#1016 Closes: https://bugs.gentoo.org/969288 Signed-off-by: Zurab Kvachadze <zurabid2016@gmail.com>
gentoo-bot
pushed a commit
to gentoo/gentoo
that referenced
this pull request
Feb 13, 2026
'which' is not portable and is on the way to be removed (bug 646588). This commit fixes the auto/cc /bin/sh script to use the portable 'command -v' to detect whether CC is present and executable. Upstream: nginx/njs#1016 Closes: https://bugs.gentoo.org/969288 Signed-off-by: Zurab Kvachadze <zurabid2016@gmail.com> Part-of: #45526 Closes: #45526 Signed-off-by: Sam James <sam@gentoo.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
'which' is not a portable utility as it is not specified by POSIX. Since auto/cc is already a shell script, use the more direct and portable 'command' builtin to detect $CC.
There are two bugs linked here. The first one is a downstream report of this issue. The second one is more general information on why 'which' usage is an issue and should be avoided.
Bug: https://bugs.gentoo.org/969288
Bug: https://bugs.gentoo.org/646588
Checklist
Before creating a PR, run through this checklist and mark each as complete:
CONTRIBUTINGdocument