[net.unix] Failure to execute 'csh'-commands from 'make'

pve@oce-rd1.UUCP (Paul Verhelst) (07/31/85)

[]

We are running 4.1BSD and find that 'make' fails to execute commands
implemented as 'csh' command files; all command text files are passed
to 'sh' instead.
Command lines containing shell meta-characters are processed correctly,
however; they are passed to 'sh' as a whole, so that 'sh' will invoke
the correct command interpreter (based on the #-comment on the first line).

My own solution to this problem is to put a semicolon after each command;
this counts as a meta-character, so 'sh' will always get to parse the
whole command line.

Is this a bug or a feature (i.e. is it documented somewhere :-)?

				Paul Verhelst (...!mcvax!oce-rd1!pve)

olson@fortune.UUCP (Dave Olson) (08/04/85)

If you have one of the 'augmented' versions of make, S3, S5, (not sure
how many others...) try setting 'SHELL=/bin/csh'.  make will then run
csh instead of sh (of course, this will slow things down quite a bit
if you have a large .cshrc file not bracketed by if($?prompt), and
you have very many shell commands in your makefile).

make will also recognize 'PATH=...' as a special variable.  Both
SHELL= and PATH= are exported into the environment for all programs
that make starts.

	Dave Olson, Fortune Systems

hokey@plus5.UUCP (Hokey) (08/06/85)

In article <5433@fortune.UUCP> olson@fortune.UUCP (Dave olson) writes:
>If you have one of the 'augmented' versions of make, S3, S5, (not sure
>how many others...) try setting 'SHELL=/bin/csh'.

This will, of course, render any bourne shell scripts inoperable, as *all*
shell scripts will be executed by csh.

Lint, for example (on SysV).
-- 
Hokey           ..ihnp4!plus5!hokey
		  314-725-9492

brown@nicmad.UUCP (08/06/85)

In article <5433@fortune.UUCP> olson@fortune.UUCP (Dave olson) writes:
>If you have one of the 'augmented' versions of make, S3, S5, (not sure
>how many others...) try setting 'SHELL=/bin/csh'.  make will then run
>csh instead of sh (of course, this will slow things down quite a bit
>if you have a large .cshrc file not bracketed by if($?prompt), and
>you have very many shell commands in your makefile).
>
>make will also recognize 'PATH=...' as a special variable.  Both
>SHELL= and PATH= are exported into the environment for all programs
>that make starts.

Ok, my Makefile has SHELL=/bin/sh, but it still won't run the simple
shell command    if test .....

Any ideas on why not or how to make it so that it can?
-- 
              |------------|
              | |-------| o|   HRD725U & PV9600
Mr. Video     | |AV-2010| o|   |--------------|
              | |       |  |   | |----| o o o |
              | |-------| O|   |--------------|
              |------------| VHS Hi-Fi (the only way to go)
   {seismo!uwvax!|!decvax|!ihnp4}!nicmad!brown

peter@kitty.UUCP (Peter DaSilva) (08/08/85)

> [ihnp4!plus5!hokey]
> In article <5433@fortune.UUCP> olson@fortune.UUCP (Dave olson) writes:
> >If you have one of the 'augmented' versions of make, S3, S5, (not sure
> >how many others...) try setting 'SHELL=/bin/csh'.
> 
> This will, of course, render any bourne shell scripts inoperable, as *all*
> shell scripts will be executed by csh.

This is pure bs. If your login shell is csh, SHELL=/bin/csh. Csh knows about
bourne shell scripts (that begin with anything but a #, or with #!/bin/sh),
and calls the bourne shell to execute them. Legend has it that a certain
individual who is on the net (and will thus remain nameless) once put a # in
front of all the bourne shell scripts on UCBCORY, back when it was "y:". This
DID have the effect you suggest.

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (08/09/85)

> In article <5433@fortune.UUCP> olson@fortune.UUCP (Dave olson) writes:
> >If you have one of the 'augmented' versions of make, S3, S5, (not sure
> >how many others...) try setting 'SHELL=/bin/csh'.
> 
> This will, of course, render any bourne shell scripts inoperable, as *all*
> shell scripts will be executed by csh.

A much better solution seems to be to use the real shell by default
and to have all Cshell scripts start off #!/bin/csh.

hokey@plus5.UUCP (Hokey) (08/11/85)

In article <275@kitty.UUCP> peter@kitty.UUCP (Peter DaSilva) writes:
>> [ihnp4!plus5!hokey]
>> In article <5433@fortune.UUCP> olson@fortune.UUCP (Dave olson) writes:
>> >If you have one of the 'augmented' versions of make, S3, S5, (not sure
>> >how many others...) try setting 'SHELL=/bin/csh'.
>> 
>> This will, of course, render any bourne shell scripts inoperable, as *all*
>> shell scripts will be executed by csh.
>
>This is pure bs. If your login shell is csh, SHELL=/bin/csh. Csh knows about
>bourne shell scripts (that begin with anything but a #, or with #!/bin/sh),
>and calls the bourne shell to execute them.

Peter DaSilva, it has been a very long week.  

The only reason I am not calling you a Liar is because I do not know about S3.

Sounds to me like you are talking about a 4BSD system.  I based my statements
on S5.

I hereby apologize for this outburst.
-- 
Hokey           ..ihnp4!plus5!hokey
		  314-725-9492

olson@fortune.UUCP (Dave Olson) (08/13/85)

1) Setting SHELL=/bin/csh in the makefile (for 'augmented make') will
NOT cause all shell scripts to be run by the csh.  It WILL cause
extra overhead for sh scripts, as csh will look at the file, determine
it doesn't start with a '#', and exec /bin/sh to run it.  For Bourne
shell scripts that start with a '#', there are problems (which have
been hashed out here many times ...)

2) Not all systems yet support the #! syntax, not even all those that
have csh!

3) Someone asked how to force make to run the shell for command lines
like 'if test ...'.  Remember that make parses the command lines to
determine if they have shell meta-characters, and tries to exec the
command directly if none are found.  To force make to exec the shell,
add a ';' somewhere in the command line (or some other shell
meta-character).  [The actual meta-characters make checks for probably
vary from site to site, and version to version.]

	Dave Olson, Fortune Systems

hokey@plus5.UUCP (Hokey) (08/15/85)

In article <5462@fortune.UUCP> olson@fortune.UUCP (Dave Olson) writes:
>1) Setting SHELL=/bin/csh in the makefile (for 'augmented make') will
>NOT cause all shell scripts to be run by the csh.  It WILL cause
>extra overhead for sh scripts, as csh will look at the file, determine
>it doesn't start with a '#', and exec /bin/sh to run it.  For Bourne
>shell scripts that start with a '#', there are problems (which have
>been hashed out here many times ...)

>Sigh<.  I am glad the csh supplied by Fortune does this.  The one we have
is not so nice.  If one carefully reads what I said in my earlier postings
on this issue, one will see that I qualify my statements based on *my
experience with available software*.

I *never* make sweeping generalizations.

(That was the exception which proves the rule !->)

Just to show y'all, here is a makefile:
> SHELL=/bin/csh
>
> lint:
>	lint align.c
and here are the first few lines of /usr/bin/lint:
> :
> #
> #	@(#)lint.sh	1.5
> #
> # New lint shell script.  Changed to make lint(1) act as much as is possible
> # like a different version of the cc(1) command.  This includes the notion of
> # a ``lint .o'' (.ln) and incremental linting.  Thu Jan 27 10:07:15 EST 1983
> #
> TOUT=/usr/tmp/tlint.$$		# combined input for second pass
and this is what happens when I "make lint":
> 	lint align.c
> TOUT=/usr/tmp/tlint.1946: Command not found.
> HOUT=/usr/tmp/hlint.1946: Command not found.
> LDIR=/usr/lib: Command not found.
> LLDIR=/usr/lib: Command not found.
> PATH=/bin:/usr/bin: Command not found.
> CCF=-E -C -Dlint: Command not found.
> LINTF=: Command not found.
> FILES=: Command not found.
> NDOTC=: Command not found.
> LLDIR: Undefined variable.
> *** Error code 1
> 
> Stop.

So There.
-- 
Hokey           ..ihnp4!plus5!hokey
		  314-725-9492