[Q] [master][openwrt-21.02] Check on 'which' in include/prereq-build.mk fails for Fedora 34 since recently, how to fix?

Bas Mevissen abuse at basmevissen.nl
Tue May 11 15:33:29 PDT 2021


tldr;  A recent upgrade of the which package on Fedora 34 broke the test 
in OpenWRT on 'which' being installed on the host. I would love to send 
a patch, but my question is how to fix this? Any ideas welcome!

Regards,

Bas.


I ran into the following:

$ ./scripst/feeds update -a
(...)
Checking 'rsync'... ok.
Checking 'which'... failed.
Checking 'ldconfig-stub'... ok.

Build dependency: Please install 'which'
(...)


$ rpm -qa which
which-2.21-26.fc34.x86_64

I noticed that file /etc/profile.d/which2.sh had changed recently. So I 
downloaded previous version of the package and extracted said file. 
Sourced the old file and ran update again:

$ . ~/Downloads/which2.sh
$ ./scripts/feeds update
(...)
Checking 'rsync'... ok.
Checking 'which'... ok.
Checking 'ldconfig-stub'... ok.
(...)


The relevant part in include/prereq-build.mk is:

$(eval $(call SetupHostCommand,which,Please install 'which', \
         which which | grep which))


The difference between the two versions of which2.sh is:

$ diff -u ~/Downloads/which2.sh /etc/profile.d/which2.sh
--- /home/bas/Downloads/which2.sh	2021-03-23 20:22:52.000000000 +0100
+++ /etc/profile.d/which2.sh	2021-05-04 11:52:55.000000000 +0200
@@ -1,18 +1,19 @@
  # shellcheck shell=sh
  # Initialization script for bash, sh, mksh and ksh

-_declare="declare -f"
-_opt="-f"
-_shell="$(basename $SHELL)"
+which_declare="declare -f"
+which_opt="-f"
+which_shell="$(cat /proc/$$/comm)"

-if [ "$_shell" = "ksh" ] || [ "$_shell" = "mksh" ] || [ "$_shell" = 
"zsh" ] ; then
-  _declare="typeset -f"
-  _opt=""
+if [ "$which_shell" = "ksh" ] || [ "$which_shell" = "mksh" ] || [ 
"$which_shell" = "zsh" ] ; then
+  which_declare="typeset -f"
+  which_opt=""
  fi

  which ()
  {
-(alias; eval ${_declare}) | /usr/bin/which --tty-only --read-alias 
--read-functions --show-tilde --show-dot "$@"
+(alias; eval ${which_declare}) | /usr/bin/which --tty-only --read-alias 
--read-functions --show-tilde --show-dot "$@"
  }

-export ${_opt} which
+export which_declare
+export ${which_opt} which

I don't see why this breaks the check. The difference is mainly in 
renaming the variables used.

As said, any hint welcome!

Regards,

Bas.




More information about the openwrt-devel mailing list