tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] env executable examples


From: Michael Matz
Subject: Re: [Tinycc-devel] env executable examples
Date: Fri, 11 May 2012 04:40:46 +0200 (CEST)
User-agent: Alpine 2.00 (LNX 1167 2008-08-23)

Hi,

On Thu, 10 May 2012, grischka wrote:

[1] See commit 27a428cd0fae475d7377e1dbe218c064ee217d85

Basically /usr/bin/env tcc -run will try to find "tcc -run" which is then obviously not found. Should we go back to the solution proposed in [2] or do you have another idea?

Why not use just

        #!tcc -tun

Because shebangs are interpreted by the kernel VFS, which doesn't know about $PATH, and hence won't find 'tcc' in any path (and therefore the execution will fail). That's what env(1) was intended for, but the linux kernel unfortunately supports only exactly one (optional) argument for the interpreter, i.e. it breaks with two and more arguments like when the shebang is "#!env firstarg secondarg". So, all in all, when you use an meta-interpreter (like env) that somehow needs the name of the real interpreter as argument (tcc in this case) you can't give further arguments to that real interpreter (-run here).

Otherwise I'd suggest to revert to the original

        #!/usr/local/bin/tcc -tun

Which again would have the problem of hardcoding the path to tcc into the "scripts". You need a meta-interpreter for finding the name of the real interpreter, and you can't give further arguments to it. Hence the best suggestion up to now was to create a wrapper script called tcc-run (just calling "exec tcc -run $1" on its argument), which would be used as argument to the 'env' shebang.

Of course, one could also decide to not care, but IMHO Davids above suggestion (helper script) is the most satisfying one, given the sorry circumstances.


Ciao,
Michael.



reply via email to

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