tech-userlevel archive

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

Re: bug in sh, probably, with test case



In article <20121220220815.GP5010%snowdrop.l8s.co.uk@localhost>,
David Laight  <david%l8s.co.uk@localhost> wrote:
>On Thu, Dec 20, 2012 at 03:20:42PM -0500, Richard Hansen wrote:
>> 
>>   "a${PWD+"*"}" also expands to the string a*, but interestingly it was 
>> the string "a"*"" before the quote removal step (none of those double 
>> quotes are themselves quoted according to the quoting rules, so they are 
>> all eliminated during the quote removal step)
>
>I'm fairly sure netbsd's sh doesn't expand that like that.
>IIRC the inner string is expanded separately with its own quoting (starting
>with no quotes). The unwanted 'ability' to generate multiple tokens
>probably comes from the necessity of expanding "$@".
>
>I think expanding "a${PWD+'*'}" should give a*, not the a'*' you'd get
>from quote removal of "a'*'".
>
>There is probably a nice simple apparrant 'fix' that makes something
>else break 'big time'.

Can't be more broken than how it is currently. Just look at the PR's
in the test suite. I was actually going to replace all the variable
expansion code with the code in current ash, because it seems to work
better. Of course having a more exhausting test suite would give me
more confidence to do that :-)

christos



Home | Main Index | Thread Index | Old Index