Skip to contentSkip to conversation

not everybody uses bash

PATCH Han Boetes 3 participants 6 messages Apr 8, 2005 – Apr 10, 2005 Kbuild

lore
Share & tools
lore

Han Boetes

author
#0 lore raw

Though most people do have which installed somewhere.

Makefile 2005-04-08 18:36:08.000297280 +0200 renamed from Makefile.orig 2005-04-08 18:34:56.827117248 +0200 +4 -4
@@ -18,12 +18,12 @@
        echo 'ARCH=$(ARCH)' >> $@
        echo 'CROSS=$(CROSS)' >> $@
        echo 'KCROSS=$(KCROSS)' >> $@
-       echo "CC=$(shell bash -c 'type -p $(CC)')" >> $@
-       echo "LD=$(shell bash -c 'type -p $(LD)')" >> $@
+       echo "CC=$(shell which gcc)" >> $@
+       echo "LD=$(shell which ld)" >> $@
        echo 'REQFLAGS=$(filter-out -I%,$(REQFLAGS))' >> $@
        echo 'OPTFLAGS=$(OPTFLAGS)' >> $@
        echo 'LDFLAGS=$(LDFLAGS)' >> $@
-       echo "STRIP=$(shell bash -c 'type -p $(STRIP)')" >> $@
+       echo "STRIP=$(shell which strip)" >> $@
        echo 'STRIPFLAGS=$(STRIPFLAGS)' >> $@
        echo 'EMAIN=$(EMAIN)' >> $@
        echo 'BITSIZE=$(BITSIZE)' >> $@
@@ -34,7 +34,7 @@
 
 $(CROSS)klcc: klcc.in $(CROSS)klibc.config makeklcc.pl
        $(PERL) makeklcc.pl klcc.in $(CROSS)klibc.config \
-               $(shell bash -c 'type -p $(PERL)') > $@ || ( rm -f $@ ; exit 1 )
+               $(shell which perl) > $@ || ( rm -f $@ ; exit 1 )
        chmod a+x $@
 
 

# Han

Signature · 17 lines
      _ (.".) _                 And if sometime, somewhere, someone
     '-'/. .\'-'             asketh thee, Who kilt thee?, tell them it
       /_   _\     _...._         'twas the Doones of Bagworthy!
      (` o o `)---`      '.
  jgs  /"---"`             \



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#1 lore raw
Quoted 1 line · Han Boetes

Though most people do have which installed somewhere.

Care to send these patches to the klibc mailing list? That way we don't get out of sync with the next update to klibc.

thanks,

greg k-h

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
In reply to Han Boetes
Quoted 1 line · Han Boetes

Though most people do have which installed somewhere.

Denied. which has really bad properties on a lot of shells, and unless you can trust "make" to invoke /usr/bin/which (or whatever it happens to be), then you're screwed.

The reason the script invokes bash explicitly is to deal with people who *aren't* using bash as a shell.

-hpa

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#3 lore raw
In reply to Han Boetes
Quoted 9 lines · H. Peter Anvin
Quoted 1 line · Han Boetes

Though most people do have which installed somewhere.

Denied. which has really bad properties on a lot of shells, and unless you can trust "make" to invoke /usr/bin/which (or whatever it happens to be), then you're screwed.

The reason the script invokes bash explicitly is to deal with people who *aren't* using bash as a shell.

If people don't _have_ bash as a shell it won't work at all.

Every shell I know has ``type foo'' and return something like ``foo is /usr/bin/foo''

Makefile renamed from Makefile.orig +4 -4
@@ -18,12 +18,12 @@
 	echo 'ARCH=$(ARCH)' >> $@
 	echo 'CROSS=$(CROSS)' >> $@
 	echo 'KCROSS=$(KCROSS)' >> $@
-	echo "CC=$(shell bash -c 'type -p $(CC)')" >> $@
-	echo "LD=$(shell bash -c 'type -p $(LD)')" >> $@
+	echo "CC=$(shell /bin/sh -c 'type $(CC)|sed "s,.* ,,"')" >> $@
+	echo "LD=$(shell /bin/sh -c 'type $(LD)|sed "s,.* ,,"')" >> $@
 	echo 'REQFLAGS=$(filter-out -I%,$(REQFLAGS))' >> $@
 	echo 'OPTFLAGS=$(OPTFLAGS)' >> $@
 	echo 'LDFLAGS=$(LDFLAGS)' >> $@
-	echo "STRIP=$(shell bash -c 'type -p $(STRIP)')" >> $@
+	echo "STRIP=$(shell /bin/sh -c 'type $(STRIP)|sed "s,.* ,,"')" >> $@
 	echo 'STRIPFLAGS=$(STRIPFLAGS)' >> $@
 	echo 'EMAIN=$(EMAIN)' >> $@
 	echo 'BITSIZE=$(BITSIZE)' >> $@
@@ -34,7 +34,7 @@
 
 $(CROSS)klcc: klcc.in $(CROSS)klibc.config makeklcc.pl
 	$(PERL) makeklcc.pl klcc.in $(CROSS)klibc.config \
-		$(shell bash -c 'type -p $(PERL)') > $@ || ( rm -f $@ ; exit 1 )
+		$(shell /bin/sh -c 'type $(PERL)|sed "s,.* ,,"') > $@ || ( rm -f $@ ; exit 1 )
 	chmod a+x $@
 
 %: local-%

# Han

Signature · 14 lines
 (_)    Consequences, Schmonsequences, as long as I'm rich. -- Looney
  "==' Tunes, Ali Baba Bunny (1957, Chuck Jones)
   " "


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#4 lore raw
In reply to Han Boetes
Quoted 10 lines · Han Boetes
Quoted 8 lines · H. Peter Anvin
Quoted 1 line · Han Boetes

Though most people do have which installed somewhere.

Denied. which has really bad properties on a lot of shells, and unless you can trust "make" to invoke /usr/bin/which (or whatever it happens to be), then you're screwed.

Quoted 9 lines
Quoted 2 lines

The reason the script invokes bash explicitly is to deal with people who *aren't* using bash as a shell.

If people don't _have_ bash as a shell it won't work at all.

Every shell I know has ``type foo'' and return something like ``foo is /usr/bin/foo''

"something like" isn't very good. Anyway, I already reimplemented the path search in Perl in 1.0.6, eliminating the need for the shell to do that job.

-hpa

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#5 lore raw
In reply to Han Boetes
Quoted 8 lines · H. Peter Anvin
Quoted 5 lines · Han Boetes

If people don't _have_ bash as a shell it won't work at all.

Every shell I know has ``type foo'' and return something like ``foo is /usr/bin/foo''

"something like" isn't very good.

Variations all resulted in the last argument being the full path to the executable. And I've seen variations, so something like is appropriate.

Quoted 2 lines

Anyway, I already reimplemented the path search in Perl in 1.0.6, eliminating the need for the shell to do that job.

``#!/usr/bin/env perl'' works in most cases.

For the gcc, ld and strip you can use CC ?= cc, etc. since in that case the path does resolve the binary name.

Indeed, that is also a solution.

Thanks for helping us poor non-bash users :-)

# Han

Signature · 15 lines
Lbh unir whfg ivbyngrq gur Qvtvgny Zvyyraavhz Pbclevtug Npg  ol  oernxvat  gur
cebgrpgvba bs pbclevtugrq zngrevny. Vs lbh ner abg n pvgvmra  be  erfvqrag  bs
gur HFN, lbh evfx orvat vzcevfbarq naq uryq jvgubhg onvy sbe hc gb  gjb  jrrxf
hcba ragel gb gur HFN (c) Copyright 2001 by Hartmann Schaffer (signature only)


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel