bug-bash
[Top][All Lists]
Advanced

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

Re: [here string] uncompatible change on here string function


From: Chet Ramey
Subject: Re: [here string] uncompatible change on here string function
Date: Wed, 22 Nov 2017 14:23:25 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

On 11/22/17 9:19 AM, DJ Mills wrote:
> On Wed, Nov 22, 2017 at 9:00 AM, Peter & Kelly Passchier <
> peterkelly@passchier.net> wrote:
> 
>> On 11/22/2017 08:04 PM, Greg Wooledge wrote:
>>
>>> wooledg:~$ bash-4.2
>>> wooledg:~$ var=$'foo\t\tbar'
>>> wooledg:~$ cat <<< "$var"
>>> foo             bar
>>>
>>
>> I think you are missing the point. He is claiming/reporting:
>> $ bash-4.4-12
>> $ var=$'foo\t\tbar'
>> $ cat <<<$var
>> foo             bar
>>
>> # Without the quotes, the tabs still get expanded, that should not
>> # happen, they should collapse into 1 space, this is a bug if true.
>>
>> Peter
>>
> 
> The bash 4.4 man page states:
> 
>  The word undergoes brace  expansion,  tilde  expansion,  parameter  and
>        variable  expansion,  command  substitution,  arithmetic expansion,
> and
>        quote removal.  Pathname expansion and  word  splitting  are  not
> per‐
>        formed.   The  result  is  supplied  as a single string, with a
> newline
>        appended, to the command on its standard input (or file descriptor n
> if
>        n is specified).
> 
> It would seem that this is an intentional change

The bash-4.2 man page defers the description of here strings to the
description of here documents. The lines in a here document do not undergo
word splitting.  It was a bug in bash-4.2 that the WORD in a here string
was split.

This finally got fixed in bash-4.4, as described by this CHANGES entry:

z.  Bash no longer splits the expansion of here-strings, as the documentation
    has always said.

I updated the documentation very soon after bash-4.2 was released, back in
2011, and that updated documentation was part of bash-4.3. The bug itself
got fixed in September, 2015 as the result of

http://lists.gnu.org/archive/html/bug-bash/2015-09/msg00022.html

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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