zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: "Owen M. Astley" <oma1000@cam.ac.uk>
Cc: zsh-workers@sunsite.auc.dk
Subject: Re: #!/path/to/arch-indep/zsh -f
Date: Wed, 22 Sep 1999 16:28:27 +0000	[thread overview]
Message-ID: <990922162827.ZM17525@candle.brasslantern.com> (raw)
In-Reply-To: <Pine.OSF.3.96.990922122005.5737A-100000@pol1.phy.cam.ac.uk>

On Sep 22, 12:24pm, Owen M. Astley wrote:
} Subject: Re: #!/path/to/arch-indep/zsh -f
}
} > Most (I don't know if I can say "all") operating systems won't do two
} > levels of indirection via #! lines.  That is, if the thing on the #!
} > line is not itself a binary in executable format, the OS will not
} > recognize yet another #! line and launch still another interpreter.
} 
} $ <test.sh
} #!/u/pol1b/oma1000/bin/zsh
} 
} echo f
} $ head -n 1 /u/pol1b/oma1000/bin/zsh
} #!/bin/sh -
} $ ./test.sh
} f
} $ reportzsh 
} zsh-3.0.6 dec-alpha-osf4.0
} 
} So not on this system.  

I can't decide if you're agreeing with me or giving a counterexample.

} I thought that most (all) modern operating systems recognise #!
} as a magic number in exec()?

They do, but not necessarily recursively.  Remember that the semantics
of the #! line are to take the name of the interpreter from the line
and run it with the name of the file as its first argument.  If the
interpreter is itself a script with a #!, that would add yet another
first argument, and so on.  The original script file might never have
its contents evaluated at all -- which could be interpreted (sorry) as
a security problem.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


      reply	other threads:[~1999-09-22 16:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-09-22  1:23 Clint Olsen
1999-09-22  7:59 ` Peter Stephenson
1999-09-22  8:58   ` Clint Olsen
1999-09-22  8:33     ` Peter Stephenson
1999-09-22 16:39       ` Clint Olsen
1999-09-23 16:42         ` Bart Schaefer
1999-09-22  9:13 ` Bart Schaefer
1999-09-22 11:24   ` Owen M. Astley
1999-09-22 16:28     ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=990922162827.ZM17525@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=oma1000@cam.ac.uk \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).