coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] env: support encoding of args into command.


From: Eric Blake
Subject: Re: [PATCH] env: support encoding of args into command.
Date: Tue, 30 May 2017 07:25:00 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0

On 05/29/2017 09:37 PM, Kaz Kylheku (Coreutils) wrote:
> With excellent language-level backward compatibility, a given
> scripting language interpreter "interp" can provide support
> for being invoked in the following manner:
> 
>   #!/usr/bin/env interp\000trailing material

I'm glad that hack works for you.

> A possible objection is that every interpreter has to implement its
> own hack for recognizing the material after the null byte

Another objection: this hack FORCES the file to be treated as binary (a
text file cannot contain NUL bytes), so it becomes very awkward to
process the file via usual means (editors may give you grief about the
embedded NUL, tools like sed, grep, and awk may corrupt your file or
give you unexpected output [although the GNU tools try to allow NUL
bytes where possible], and even shells may refuse to run your script
because they detect a NUL byte).  Not insurmountable, but worth thinking
about the consequences before relying on the hack.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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