Re: Bug in #! processing

From: Sławek Żak <zaks_at_prioris.mini.pw.edu.pl>
Date: Thu, 30 Sep 2004 14:05:18 +0200
Ryan Sommers <ryans_at_gamersimpact.com> writes:

> Ceri Davies wrote:
>
>> That seems wrong too. #! shouldn't be magic anywhere other than at the
>>
>>beginning of a file.
>>
>>
> I haven't looked at the code yet, on my list, but I'm guessing this was done to
> avoid a possible circular reference.

    What circular reference? Could you elaborate? The algorithm goes like this:

    1. skip all space till #!
    2. skip #! and read path for the interpreter
    3. find and split arguments
    4. invoke intepreter with it's path at argv[0], arguments at subsequent
       positions and append path to the script at the end.

    That's it, modulo : and no interpreter path at all in the script as legacy
    which is a special case anyway.

/S    
Received on Thu Sep 30 2004 - 10:05:26 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:14 UTC