NetBSD-Bugs archive

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

bin/50958: /bin/sh $(( )) does not support ?: or assignment operators

>Number:         50958
>Category:       bin
>Synopsis:       /bin/sh $(( )) does not support ?: or assignment operators
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 12 18:05:00 +0000 2016
>Originator:     Robert Elz
>Release:        NetBSD 7.99.26 (any version up to date of PR).
System: NetBSD 7.99.26 NetBSD 7.99.26 (VBOX64-1.1-20160128) #43: Thu Jan 28 16:09:08 ICT 2016 amd64
Architecture: x86_64
Machine: amd64
	According to POSIX, the expressions in $(( )) evaluation should
	allow anything permitted in C expressions, except that ++ and --
	(prefix or postfix) are not required (and not implemented, though
	they would be useful) and sizeof (which wouldn't be rational.)
	(Support is only required for signed integers, which is fine.)

	NetBSD's /bin/sh does not support ?: or any of the assignment

		/bin/sh -c 'echo $(( 1 ? 2 : 3 ))'
		sh: arith: syntax error: " 1 ? 2 : 3 "

		/bin/sh -c 'echo $(( x=3 ))'
		sh: arith: syntax error: " x=3 "

	This is another "placeholder" PR...   I have a fix for ?:
	(actually wanted to use it in a script, only to discover it
	didn't work...)

	The assignment ops will get worked on in time...
	May even include ++ and -- support at the same time, if it
	looks reasonable (they're not prohibited, just not required.)

Home | Main Index | Thread Index | Old Index