git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [Patch] Using 'perl' in *.sh

From
JGJan-Benedict Glaw <jbglaw@lug-owl.de>
Date
Jul 9, 2006, 21:20 UTC
Message-ID
<20060709212051.GW22573@lug-owl.de>
In-Reply-To
<7v4pxqfri7.fsf@assigned-by-dhcp.cox.net>
On Sun, 2006-07-09 13:33:04 -0700, Junio C Hamano <junkio@cox.net> wrote:
Show 14 quoted lines
> Michal Rokos <michal.rokos@nextsoft.cz> writes:
> > On Sunday 09 July 2006 12:14, Junio C Hamano wrote:
> >> Michal, is there a reason you do not want to have the version of
> >> perl you teach git tools via #! lines with PERL_PATH on your $PATH?
> >
> > I have no problem with that. I can set $PATH.
> > But then I'd suggest to change magic #!
> > from #!/usr/bin/perl
> > to #!/usr/bin/env perl
> > for *.perl
> >
> > It that what you meant?
> 
> No, that is not what I meant.
Though I think you actually should :-)
Show 6 quoted lines
> Invocation of perl _in_ scripts can be controlled by user's
> PATH, but #! cannot be.  As Merlyn says 'env' is a nice hack,
> but we configure the scripts we install to have #!  pointing at
> the right interpreter as a more cleaner (than using 'env', that
> is) workaround anyway, so #! pointing at PERL_PATH and scripts
> relying on user's $PATH would be the right thing to do.

It's just a question of the target system, so: What is our target? If we target a fairly recent Unix box, we'd put whatever a user asked for into the shellbang, and hope that he properly sets $PATH.

If we try to aim at POSIX systems, then first of all, `env' isn't a hack. It's specified i the POSIX documents, even argument passing is given. (So if `#!/usr/bin/env perl -w' doesn't work on a HP-UX system, that's simply broken wrt. POSIX.)

At the maximum, we'd allow the user to supply the location of `env' if it's not /usr/bin/env, but I guess you'll find a hard time finding a system where there's no /usr/bin/env... The final killer would be to explicitely mention the interpreter and install all scripts a-x to force that :-)

MfG, JBG
-- 
Jan-Benedict Glaw       jbglaw@lug-owl.de    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 für einen Freien Staat voll Freier Bürger"  | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));
Previous: Junio C HamanoNext: Michal Rokos
Message 10 of 16 in “Using 'perl' in *.sh”
  1. Using 'perl' in *.shMichal Rokos, Jul 8, 2006
  2. Junio C HamanoJul 8, 2006
  3. Alex RiesenJul 9, 2006
  4. Jan-Benedict GlawJul 9, 2006
  5. Junio C HamanoJul 9, 2006
  6. Michal RokosJul 9, 2006
  7. Randal L. SchwartzJul 9, 2006
  8. Jan-Benedict GlawJul 9, 2006
  9. Junio C HamanoJul 9, 2006
  10. Jan-Benedict GlawJul 9, 2006
  11. Michal RokosJul 10, 2006
  12. Randal L. SchwartzJul 10, 2006
  13. Johannes SchindelinJul 10, 2006
  14. Randal L. SchwartzJul 10, 2006
  15. Yakov LernerJul 9, 2006
  16. Alex RiesenJul 9, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.