commit:     06656b920e04707e65588e0c445ce5ca6bad11a9
Author:     Zurab Kvachadze <zurabid2016 <AT> gmail <DOT> com>
AuthorDate: Mon Jan 26 15:06:55 2026 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Feb 13 00:25:08 2026 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=06656b92

www-nginx/njs: Patch auto/cc to use 'command -v' instead of 'which'

'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: https://github.com/nginx/njs/pull/1016
Closes: https://bugs.gentoo.org/969288
Signed-off-by: Zurab Kvachadze <zurabid2016 <AT> gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/45526
Closes: https://github.com/gentoo/gentoo/pull/45526
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/njs-0.9.4-use-command-v-not-which.patch  | 38 ++++++++++++++++++++++
 www-nginx/njs/njs-0.9.4.ebuild                     |  5 +--
 2 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/www-nginx/njs/files/njs-0.9.4-use-command-v-not-which.patch 
b/www-nginx/njs/files/njs-0.9.4-use-command-v-not-which.patch
new file mode 100644
index 000000000000..b2a66c92ac94
--- /dev/null
+++ b/www-nginx/njs/files/njs-0.9.4-use-command-v-not-which.patch
@@ -0,0 +1,38 @@
+From ef0e9271bbddf27abc520baf8ab9ecef6aa8813b Mon Sep 17 00:00:00 2001
+From: Zurab Kvachadze <[email protected]>
+Date: Mon, 26 Jan 2026 15:54:51 +0100
+Subject: [PATCH] auto/cc: Use portable/POSIX 'command -v' instead of 'which'
+
+Submitted upstream at https://github.com/nginx/njs/pull/1016.
+
+'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 <[email protected]>
+---
+ auto/cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/auto/cc b/auto/cc
+index 8a615ec4..5b21e17e 100644
+--- a/auto/cc
++++ b/auto/cc
+@@ -13,7 +13,7 @@ END
+ # Allow error exit status.
+ set +e
+ 
+-if [ -z "$(which $CC)" ]; then
++if ! command -v "${CC}" >/dev/null; then
+     echo
+     echo $0: error: $CC not found.
+     echo
+-- 
+2.52.0
+

diff --git a/www-nginx/njs/njs-0.9.4.ebuild b/www-nginx/njs/njs-0.9.4.ebuild
index f040241a7b2d..1c6e6d36d89f 100644
--- a/www-nginx/njs/njs-0.9.4.ebuild
+++ b/www-nginx/njs/njs-0.9.4.ebuild
@@ -36,10 +36,11 @@ DEPEND="${RDEPEND}"
 BDEPEND="virtual/pkgconfig"
 
 PATCHES=(
-       # Note: drop on the next upgrade, has been merged upstream as PR 989.
+       # Note: drop on the next upgrade: the patches have been merged upstream 
as
+       # PR 989, 993 and 1016 respectively.
        "${FILESDIR}/${PN}-0.9.4-support-quickjs-ng.patch"
-
        "${FILESDIR}/${PN}-0.9.4-do-not-add-opt-debug-cflags.patch"
+       "${FILESDIR}/${PN}-0.9.4-use-command-v-not-which.patch"
 )
 
 src_configure() {

Reply via email to