Skip to content

auto/cc: Use portable/POSIX 'command -v' instead of 'which'#1016

Merged
xeioex merged 1 commit into
nginx:masterfrom
BalkanMadman:use-command-v
Jan 26, 2026
Merged

auto/cc: Use portable/POSIX 'command -v' instead of 'which'#1016
xeioex merged 1 commit into
nginx:masterfrom
BalkanMadman:use-command-v

Conversation

@BalkanMadman
Copy link
Copy Markdown
Contributor

'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:

  • I have read the CONTRIBUTING document
  • If applicable, I have added tests that prove my fix is effective or that my feature works
  • If applicable, I have checked that any relevant tests pass after adding my changes

'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>
Copy link
Copy Markdown
Contributor

@xeioex xeioex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@xeioex xeioex merged commit d046058 into nginx:master Jan 26, 2026
2 checks passed
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants