bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Explicit interpreter paths considered harmful


From: Ludovic Courtès
Subject: Re: Explicit interpreter paths considered harmful
Date: Thu, 29 Oct 2009 22:46:15 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Paolo Bonzini <address@hidden> writes:

> Yeah.  But why not the standard
>
> #! /bin/sh
> eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
>     if 0;
>
> suggested in perlrun(1)?

Actually that doesn’t work:

--8<---------------cut here---------------start------------->8---
$ ./build-aux/gitlog-to-changelog  
/bin/sh: -S: invalid option
--8<---------------cut here---------------end--------------->8---

because perl eventually execs /bin/sh:

--8<---------------cut here---------------start------------->8---
4473  execve("./build-aux/gitlog-to-changelog", 
["./build-aux/gitlog-to-changelog"], [/* 60 vars */]) = 0
4473  execve("/var/run/current-system/sw/bin/perl", ["perl", "-S", 
"./build-aux/gitlog-to-changelog"], [/* 59 vars */]) = 0
4473  execve("/bin/sh", ["/bin/sh", "-S", "./build-aux/gitlog-to-changelog"], 
[/* 59 vars */]) = 0
--8<---------------cut here---------------end--------------->8---

Actually perlrun(1) reads this:

--8<---------------cut here---------------start------------->8---
           #!/bin/sh -- # -*- perl -*- -p
           eval 'exec perl -wS $0 ${1+"$@"}'
               if $running_under_some_shell;
--8<---------------cut here---------------end--------------->8---

... which can’t possibly work.

So I guess I’ll stick to what I suggested.

Thanks,
Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]