bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] tests: avoid problematic $(< file) shell construct


From: Bernhard Voelker
Subject: Re: [PATCH] tests: avoid problematic $(< file) shell construct
Date: Mon, 16 Dec 2013 15:53:24 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0

On 12/16/2013 03:27 PM, Eric Blake wrote:
> On 12/15/2013 12:59 PM, Bernhard Voelker wrote:
> 
>> +# Avoid problematic redirect-only statements in $(...) shell construct.
>> +# Although the "man bash" states that this is faster, it does not seem
>> +# to be portable.  Issues have been seen on dash v0.5.6 and on the shell
>> +# on FreeBSD.
>> +sc_prohibit_redirect_only_command_substitution:
>> +    @prohibit='\$$\(<'              \
> 
> Shouldn't you also prevent $(> ...)?

Maybe yes, but I don't think that it's use is very likely,
because one wanting to create a file that way would most
probably do it without the $(...) command substitution.

The check is quite rough anyway because nothing prevents
a user from writing a command after the redirection:

  u="$(</etc/passwd  head -n1 | cut -d: -f1)"

However, I think such use is very rare.

Have a nice day,
Berny




reply via email to

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