[Nix-dev] Make wrappers be binaries instead of shell scripts?
Shea Levy
shea at shealevy.com
Tue Nov 18 16:26:12 CET 2014
Some time ago I had an idea for a ‘wrapper interpreter’, seems like execline might be similar. No reason we can’t have such a thing.
> On Nov 18, 2014, at 9:02 AM, Thomas Tuegel <ttuegel at gmail.com> wrote:
>
> On Tue, Nov 18, 2014 at 7:32 AM, Wout Mertens <wout.mertens at gmail.com> wrote:
>> Hi all,
>>
>> I'm wondering if it wouldn't be better to make the application wrapper
>> scripts generated by makeWrapper be binaries that do the environment
>> massaging and config in binary code before exec() ing the wrapped program.
>>
>> The advantages would be that the wrapper itself loads very fast since all
>> the shell init and shell parsing is skipped. You also get precise control
>> over the execv() call or other desired factors.
>
> I was discussing this on #nixos yesterday in light of a long standing
> bug in our wrapper for Hoogle. Hoogle requires its arguments in a very
> specific order, so it has a custom wrapper which had a bug because I
> didn't fully understand the vagaries of $@ versus "$@" in bash. My
> point being, I think precision is the stronger argument here.
>
>> The disadvantages are that you can't read what a wrapper does and the
>> wrapper file is bigger (about 4KB in my tests for a simple execv()).
>
> The middle ground here would be to use something like execline [1]
> which avoids the overhead of loading a traditional shell, but still
> reads a human-inspectable script.
>
>> Thoughts?
>>
>> Wout.
>>
>> _______________________________________________
>> nix-dev mailing list
>> nix-dev at lists.science.uu.nl
>> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>>
>
> [1] http://skarnet.org/software/execline/
>
> --
> Thomas Tuegel
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
More information about the nix-dev
mailing list