GNU bug report logs - #44444
RFE for 'env'?

Previous Next

Package: coreutils;

Reported by: L A Walsh <coreutils <at> tlinx.org>

Date: Wed, 4 Nov 2020 15:28:01 UTC

Severity: normal

To reply to this bug, email your comments to 44444 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#44444; Package coreutils. (Wed, 04 Nov 2020 15:28:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to L A Walsh <coreutils <at> tlinx.org>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Wed, 04 Nov 2020 15:28:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: L A Walsh <coreutils <at> tlinx.org>
To: Bernhard Voelker <mail <at> bernhard-voelker.de>
Cc: Coreutils <bug-coreutils <at> gnu.org>
Subject: RFE for 'env'?
Date: Wed, 04 Nov 2020 07:27:17 -0800
Rewriting this bug as the other one, apparently, was too unclear
to be understood.

This gives an example, two in fact.


On 2020/11/03 14:48, Bernhard Voelker wrote:
> On 11/3/20 6:29 PM, L A Walsh wrote:
>> 	I tried to use 'env' to find perl in my path and wanted to pass
>> the -T option to perl.
>>
>> cat >/tmp/taint+print
#!/usr/bin/env perl -T
printf "Hello World\n";

I am unable to get this to run and print out:

"Hello World" \

Instead of expected output, I get:
/usr/bin/env: ‘perl -T’: No such file or directory


So I tried turning off env's arg parsing as we know the linux kernel
does handle this.

#!/usr/bin/env -- perl -T
/usr/bin/env: unrecognized option '-- perl -T'
Try '/usr/bin/env --help' for more information.

I am not able find a syntax that will generate what I want.

1) '--'  isn't handled as being the end of 'env' arguments
2) It isn't splitting white-space to to generate separate arguments
  but seems to concatenate together as 1 argument. 
3) This overrides normal linux kernel behavior.  This is a kernel policy
that is overridden  by a user-level program.

*>>* If these behaviors were under user control, I don't think it would be a
problem.  While some utils/progs like "find" tend to ignore symlinks
unless they are on the command line.  Others, like bash, by default,
try to give a logical view by following the symlinks and restoring when
backing out.  Both options can have utility.  find even has suboptions for
ignoring their use on the cmdline, but expanding them in subtrees. 

> Bernhard V. Thanks, so it seems 'env' works as expected and 
> supports the way you need it to run.
---
	Hopefully you understand you had it backwards -- in that it doesn't
work as expected (doesn't break arguments in same places as kernel). and does
not support the way I need it to run.

Do to your misunderstanding you closed the original bug -- Hopefully it is
clear explained enough so this note won't also get deleted.


> Have a nice day,
> Berny
----
	Trying -- at least elections are over.










Information forwarded to bug-coreutils <at> gnu.org:
bug#44444; Package coreutils. (Wed, 04 Nov 2020 16:10:02 GMT) Full text and rfc822 format available.

Message #8 received at 44444 <at> debbugs.gnu.org (full text, mbox):

From: Erik Auerswald <auerswal <at> unix-ag.uni-kl.de>
To: L A Walsh <coreutils <at> tlinx.org>
Cc: 44444 <at> debbugs.gnu.org, Bernhard Voelker <mail <at> bernhard-voelker.de>
Subject: Re: bug#44444: RFE for 'env'?
Date: Wed, 4 Nov 2020 17:09:34 +0100
Hi,

On Wed, Nov 04, 2020 at 07:27:17AM -0800, L A Walsh wrote:
> Rewriting this bug as the other one, apparently, was too unclear
> to be understood.
> 
> This gives an example, two in fact.
> 
> 
> On 2020/11/03 14:48, Bernhard Voelker wrote:
> >On 11/3/20 6:29 PM, L A Walsh wrote:
> >>	I tried to use 'env' to find perl in my path and wanted to pass
> >>the -T option to perl.
> >>
> >>cat >/tmp/taint+print
> #!/usr/bin/env perl -T
> printf "Hello World\n";
> 
> I am unable to get this to run and print out:
> 
> "Hello World" \
> 
> Instead of expected output, I get:
> /usr/bin/env: ‘perl -T’: No such file or directory

That is not env, that is the Linux kernel providing 'perl -T' as single argument to env.

    $ cat taint+print
    #!/usr/bin/env perl -T
    printf "Hello World\n";
    $ ./taint+print
    /usr/bin/env: ‘perl -T’: No such file or directory
    $ /usr/bin/env perl -T taint+print
    Hello World
    $ 

Please see
https://www.gnu.org/software/coreutils/manual/html_node/env-invocation.html#g_t_002dS_002f_002d_002dsplit_002dstring-usage-in-scripts
for an explanation.

HTH,
Erik
-- 
Ow, you made me look at perl code.
                        -- Andrew Morton




Information forwarded to bug-coreutils <at> gnu.org:
bug#44444; Package coreutils. (Thu, 05 Nov 2020 19:43:02 GMT) Full text and rfc822 format available.

Message #11 received at 44444 <at> debbugs.gnu.org (full text, mbox):

From: L A Walsh <coreutils <at> tlinx.org>
To: Erik Auerswald <auerswal <at> unix-ag.uni-kl.de>
Cc: 44444 <at> debbugs.gnu.org, Bernhard Voelker <mail <at> bernhard-voelker.de>
Subject: Re: bug#44444: RFE for 'env'?
Date: Thu, 05 Nov 2020 11:41:44 -0800
Ah...so what I asked for has already been added in a newer version.

I seem to have > env --version
env (GNU coreutils) 8.26.18-5e871

What version of env should I try and test?


Thanks!


On 2020/11/04 08:09, Erik Auerswald wrote:
> Please see
> https://www.gnu.org/software/coreutils/manual/html_node/env-invocation.html#g_t_002dS_002f_002d_002dsplit_002dstring-usage-in-scripts
> for an explanation.
> 
> HTH,
> Erik




Information forwarded to bug-coreutils <at> gnu.org:
bug#44444; Package coreutils. (Fri, 06 Nov 2020 08:58:02 GMT) Full text and rfc822 format available.

Message #14 received at 44444 <at> debbugs.gnu.org (full text, mbox):

From: Erik Auerswald <auerswal <at> unix-ag.uni-kl.de>
To: L A Walsh <coreutils <at> tlinx.org>
Cc: 44444 <at> debbugs.gnu.org, Bernhard Voelker <mail <at> bernhard-voelker.de>
Subject: Re: bug#44444: RFE for 'env'?
Date: Fri, 6 Nov 2020 09:57:13 +0100
Hi,

On Thu, Nov 05, 2020 at 11:41:44AM -0800, L A Walsh wrote:
> On 2020/11/04 08:09, Erik Auerswald wrote:
> >Please see
> >https://www.gnu.org/software/coreutils/manual/html_node/env-invocation.html#g_t_002dS_002f_002d_002dsplit_002dstring-usage-in-scripts
> >for an explanation.
> 
> Ah...so what I asked for has already been added in a newer version.
> 
> I seem to have > env --version
> env (GNU coreutils) 8.26.18-5e871
> 
> What version of env should I try and test?

According to the NEWS file, env from Coreutils 8.30 introduced this option.

Thanks,
Erik
-- 
Thinking doesn't guarantee that we won't make mistakes. But not thinking
guarantees that we will.
                        -- Leslie Lamport




This bug report was last modified 4 years and 18 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.