NetBSD-Bugs archive

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

Re: bin/50827 (sh -c ': "${x=$((1))}"' gives bogus syntax error)



On Feb 19,  2:50pm, kre%munnari.OZ.AU@localhost (Robert Elz) wrote:
-- Subject: Re: bin/50827 (sh -c ': "${x=$((1))}"' gives bogus syntax error)

| The following reply was made to PR bin/50827; it has been noted by GNATS.
| 
| From: Robert Elz <kre%munnari.OZ.AU@localhost>
| To: gnats-bugs%NetBSD.org@localhost
| Cc: 
| Subject: Re: bin/50827 (sh -c ': "${x=$((1))}"' gives bogus syntax error)
| Date: Fri, 19 Feb 2016 21:49:24 +0700
| 
|      Date:        Fri, 19 Feb 2016 14:02:00 +0000 (UTC)
|      From:        wiz%NetBSD.org@localhost
|      Message-ID:  <20160219140200.3F64A7ACAF%mollari.NetBSD.org@localhost>
|  
|    | christos committed a fix, does it work for you?
|  
|  I know this was not directed at me, so don't take this as an answer,
|  but it still fails on even more bizarre usages...
|  
|  	./sh -c 'echo ${x:-$(( ${y:-"$((4))"} ))}'
|  	sh: Syntax error: Unterminated quoted string
|  
|  this fails if the quotes are inside the outer $(( )), but not inside the
|  inner $(( )) .. doesn't matter if the entire ${y...} is quoted or just
|  as shown, it fails the same way.   But works if it is just the "4" quoted.
|  
|  And to go even further into the absurd ...
|  
|  	./sh -c 'echo ${x:-"$(( "${y:-$(( ${z:-$(( 9 ))} ))}" ))"}'
|  	sh: Syntax error: Missing '))'
|  
|  sh is better now than it was, but this stuff ought to be fixed as well.
|  Without quoting, that works (believe it or not.)
|  
|  I am looking into it, but maybe the PR can remain open for now.

If you are looking into quoting, please look at: bin/43469. Also it might
be worthwhile to compare ours with FreeBSD's sh and switch to their code
if it is better.

christos


Home | Main Index | Thread Index | Old Index