rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* Why can't I exec an sh shell script?
@ 1991-08-26  2:51 Mark-Jason Dominus
  1991-08-26  2:59 ` Chris Siebenmann
  1991-08-26 10:14 ` Boyd Roberts
  0 siblings, 2 replies; 5+ messages in thread
From: Mark-Jason Dominus @ 1991-08-26  2:51 UTC (permalink / raw)
  To: rc; +Cc: mjd


    It seems that if `foo' is a Bourne shell script that does NOT begin
with 
	#!/bin/sh 

, you can run it anyway from either csh or sh just by typing its name.
These shells try to exec the script; when the exec fails with ENOEXEC,
they fork a copy of /bin/sh instead and feed the script into it.  rc
does not support this bit of brain damage.  (Hooray for our side.) If
you try to run a shell script with `rc', you get an error--`Not found'
or `Exec format error', depending.

Is this `exec a shell and try again' nonsense a feature rc needs to
have?  I hope not, but perhaps someone can make a compatibility argument
about why it has to be put in.

   Nihil tam absurde dici potest, quod non dicatur ab aliquo philosophorum.
Mark-Jason Dominus 	  			    mjd@central.cis.upenn.edu 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Why can't I exec an sh shell script?
  1991-08-26  2:51 Why can't I exec an sh shell script? Mark-Jason Dominus
@ 1991-08-26  2:59 ` Chris Siebenmann
  1991-08-26 10:19   ` Boyd Roberts
  1991-08-26 10:14 ` Boyd Roberts
  1 sibling, 1 reply; 5+ messages in thread
From: Chris Siebenmann @ 1991-08-26  2:59 UTC (permalink / raw)
  To: rc

 In 1.1 gamma, turning on DEFAULTTOSH lets rc run such scripts 'properly'
(ie, they work). Whether or not this is a good thing is debatable; has
anyone gone through a current set of vendor-shipped systems to see
how often this feature is used? Offhand, I can only think of /bin/true.

	- cks


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Why can't I exec an sh shell script?
  1991-08-26  2:51 Why can't I exec an sh shell script? Mark-Jason Dominus
  1991-08-26  2:59 ` Chris Siebenmann
@ 1991-08-26 10:14 ` Boyd Roberts
  1 sibling, 0 replies; 5+ messages in thread
From: Boyd Roberts @ 1991-08-26 10:14 UTC (permalink / raw)
  To: rc

there's no point to get rc to source a ENOEXEC script, because it's _bound_
not to be an rc script, so it's going to bomb.  fortunately my kernel (ultrix)
groks, #!.  i could defend (pragmatically) a reason for rc dealing with #!,
but on principle it shouldn't really.

the #! code is not that big and is damn useful if you have a non #! kernel.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Why can't I exec an sh shell script?
  1991-08-26  2:59 ` Chris Siebenmann
@ 1991-08-26 10:19   ` Boyd Roberts
  0 siblings, 0 replies; 5+ messages in thread
From: Boyd Roberts @ 1991-08-26 10:19 UTC (permalink / raw)
  To: rc

i think the DEFAULTTOSH code is badly broken.  it should do what the kernel
exec does.  ie. read the a.aout header (in rc's case some small integer
number of bytes, say 32 or 64) and checks the first two bytes.  if they're
# and ! then it snarfs the program name and the first arg, rebuilds the
arglist (inserting the name of the script after the first arg from
the script, but before the existing arglist), exec's the new path with
the new arg list.  end of story.  trivial.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Why can't I exec an sh shell script?
       [not found] <9108262301.837.rc.bagav@syd.dit.csiro.au>
@ 1991-08-26 13:14 ` Boyd Roberts
  0 siblings, 0 replies; 5+ messages in thread
From: Boyd Roberts @ 1991-08-26 13:14 UTC (permalink / raw)
  To: John Mackin; +Cc: rc

    Boyd man!

    I am at home -- had a tough w/e.  I can't quite follow this message:
    can you confirm that you meant NOEXECVE, not DEFAULTTOSH?  And if so,
    isn't this what NOEXECVE already does, i.e. what's wrong with it?

Oh dear, more egg on face.  I think I meant to say that DEFAULTTOSH is
an abomination and should be removed, but was confused by NOEXECVE.
`What?  No execve?' I thought, `this can't be right'.

It should be called NOHASHBANG and work as coded.

On another issue, re: rcmain;

-p is hard because parseing whatis's output is damn near impossible when
you want to delete functions.  in Plan 9 there are no exported functions
and the environment exists in files on /env.

when i get a spare moment (some chance) i'll hack up rcmain (for my own
idle curiosity) and see how it feels.  my report will follow.  i can see
it'd be no end of use here, but that doesn't justify blanket modification.

i think i already know byron's response here :-)

my local hacks, if any, will be my problem and will stay _local_.
i can get away with a lot here because, i'm the only user of rc
and the heathen here just luuurve `tcsh'.  i can't see them converting
and frankly i don't want to try to.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1991-08-26 13:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1991-08-26  2:51 Why can't I exec an sh shell script? Mark-Jason Dominus
1991-08-26  2:59 ` Chris Siebenmann
1991-08-26 10:19   ` Boyd Roberts
1991-08-26 10:14 ` Boyd Roberts
     [not found] <9108262301.837.rc.bagav@syd.dit.csiro.au>
1991-08-26 13:14 ` Boyd Roberts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).