tests/runtestfedabipkgdiffpy3.sh.in: Don't use which to find python3

Message ID 20250516133018.379310-1-mark@klomp.org
State New
Headers
Series tests/runtestfedabipkgdiffpy3.sh.in: Don't use which to find python3 |

Commit Message

Mark Wielaard May 16, 2025, 1:30 p.m. UTC
  From: Mark Wielaard <mark@klomp.org>

which isn't really portable and some distros are removing it from
their base set of packages. https://lwn.net/Articles/874049/

command -v is POSIX and always available in a POSIX shell (like bash).

	* tests/runtestfedabipkgdiffpy3.sh.in: Replace which with
	command -v.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 tests/runtestfedabipkgdiffpy3.sh.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Dodji Seketeli May 19, 2025, 10:22 a.m. UTC | #1
Hello,

"Mark J. Wielaard" <mark@klomp.org> a écrit:

> From: Mark Wielaard <mark@klomp.org>
>
> which isn't really portable and some distros are removing it from
> their base set of packages. https://lwn.net/Articles/874049/

Whoah, thank you for the reference.  This is some interesting whichcraft
reading.

> command -v is POSIX and always available in a POSIX shell (like bash).

I didn't even know about 'command -v'.  Thanks for the pointer.

>
> 	* tests/runtestfedabipkgdiffpy3.sh.in: Replace which with
> 	command -v.
>
> Signed-off-by: Mark Wielaard <mark@klomp.org>

Applied to the mainline.

Many thanks.

[...]

Cheers,
  

Patch

diff --git a/tests/runtestfedabipkgdiffpy3.sh.in b/tests/runtestfedabipkgdiffpy3.sh.in
index 37f8b5ffba4f..48308da5b0cd 100644
--- a/tests/runtestfedabipkgdiffpy3.sh.in
+++ b/tests/runtestfedabipkgdiffpy3.sh.in
@@ -8,7 +8,7 @@ 
 
 PY3_TEMP=$(mktemp -d --tmpdir libabigail-py3-temp-XXXXXXXX)
 
-ln -s $(which @PYTHON3_INTERPRETER@) $PY3_TEMP/python
+ln -s $(command -v @PYTHON3_INTERPRETER@) $PY3_TEMP/python
 
 export PATH=$PY3_TEMP:$PATH