[klibc] [klibc:master] klcc: Remove the need for bash

klibc-bot for Olliver Schinagl oliver at schinagl.nl
Sat Jul 25 16:21:02 PDT 2020


Commit-ID:  23273aa05bdc564eb8ff0565d9df9c3edfffaee9
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=23273aa05bdc564eb8ff0565d9df9c3edfffaee9
Author:     Olliver Schinagl <oliver at schinagl.nl>
AuthorDate: Sat, 25 Jul 2020 10:59:01 +0200
Committer:  Ben Hutchings <ben at decadent.org.uk>
CommitDate: Sun, 26 Jul 2020 00:16:13 +0100

klcc: Remove the need for bash

Currently, in the entire klibc bash is only used to identify the path of
the perl binary. It is doing so using the bash built-in 'type' function,
which is POSIX compliant according to [0], but the option -c is not.

By using `command -v` instead, we achieve the same result, in a POSIX
compliant manor [1], potentially removing the unneeded bash dependency.

0 https://www.unix.com/man-page/posix/1p/type/
1 https://www.unix.com/man-page/posix/1p/command/

Signed-off-by: Olliver Schinagl <oliver at schinagl.nl>
Signed-off-by: Ben Hutchings <ben at decadent.org.uk>

---
 klcc/Kbuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/klcc/Kbuild b/klcc/Kbuild
index eae753ff..0e625802 100644
--- a/klcc/Kbuild
+++ b/klcc/Kbuild
@@ -35,7 +35,7 @@ targets := $(KLIBCCROSS)klcc
 quiet_cmd_klcc = GEN     $@
       cmd_klcc = $(PERL) $< $(srctree)/$(src)/klcc.in \
                             $(obj)/$(KLIBCCROSS)klibc.config \
-                            $(shell bash -c 'type -p $(PERL)') \
+                            $(shell command -v $(PERL)) \
 			      > $@ || ( rm -f $@ ; exit 1 ) && \
 			      chmod a+x $@
 $(obj)/$(KLIBCCROSS)klcc: $(src)/makeklcc.pl $(src)/klcc.in \


More information about the klibc mailing list