bug-bash
[Top][All Lists]
Advanced

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

Re: "$@" expansion when it is consists of only null strings


From: Chet Ramey
Subject: Re: "$@" expansion when it is consists of only null strings
Date: Thu, 28 Feb 2019 10:36:22 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.5.1

On 2/25/19 5:38 PM, Grisha Levit wrote:
> On Sun, Feb 24, 2019 at 11:22 PM Robert Elz <address@hidden> wrote:
>> I think these are actually more the insertion of explicit null
>> strings, rather than $@ when it contains null strings.   These
>> are essentially the same as the ${b+s ''} issue that was discussed
>> a week or so ago, and which Chet already said he would look into.
> 
> Apologies to Chet if I'm bringing up issues with something that still
> a WIP. 

Well, it's sort of always a work in progress. As long as you keep sending
me reports of apparently incorrect results, we can debate the proper
behavior and fix bash, if necessary.


> The two older commits I mentioned were changes to bring a great
> number of things in compliance with interpretation 888 and the corner
> case bugs I mention above are AFAICT casualties of those fixes. 

There were some longstanding assumptions that were deeply baked into
bash's word expansion code. I'm sure there are still some more that need
to be changed as a result of 888 and a couple other interpretations.

>>   | And these have always been the case, but I'm not sure if it should be so?
>>   |
>>   |     $ set --
>>   |     $ n "${_+"$@"}"
>>   |     1
>>   |     $ n "address@hidden"
>>   |     1
>>
>> Those are, I believe, unspecified cases.   The first is definitely
>> because of the strange quoting (the " chare are in order, open, close,
>> open, close, not open open close close).

There is an interpretation that somewhat decoupled quotes outside the
expansion with quotes inside it, but I can't remember the specifics
right now. It might be 888, but I seem to remember another.

The root of the issue is whether or not the expansion starts a new logical
"quoting context," so the $@ is treated as double-quoted instead of
unquoted.

> 
> I think I'm missing something but how can that be the case regarding
> the quoting?
> For example "${x+" a   b "}" expands to a single field in
> bash/dash/yash/zsh/netbsd sh (though not in ksh..)

Because ksh uses the open, open, close, close interpretation.

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



reply via email to

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