standards/52972: /bin/sh arithmetic not POSIX compliant

Jens Schweikhardt schweikh at schweikhardt.net
Tue Jun 24 10:50:09 PDT 2003


The following reply was made to PR standards/52972; it has been noted by GNATS.

From: Jens Schweikhardt <schweikh at schweikhardt.net>
To: Wartan Hachaturow <wart at tepkom.ru>
Cc: Dag-Erling Sm?rgrav <des at des.no>,
	freebsd-gnats-submit at freebsd.org
Subject: Re: standards/52972: /bin/sh arithmetic not POSIX compliant
Date: Tue, 24 Jun 2003 19:16:00 +0200

 On Tue, Jun 24, 2003 at 01:46:24PM +0400, Wartan Hachaturow wrote:
 # On Mon, Jun 23, 2003 at 11:30:14AM -0700, Dag-Erling Sm?rgrav wrote:
 # 
 # >  He's wrong.  The full text of section 2.6.4 is:
 # 
 # Now, he has clarified himself, and pointed me to rationale.
 # This is the relevant part of rationale for 2.6.4:
 # 
 # "The syntax and semantics for arithmetic were changed for the ISO/IEC
 # 9945-2:1993 standard. The language is essentially a pure arithmetic
 # evaluator of constants and operators (excluding assignment) and
 # represents a simple subset of the previous arithmetic language (which
 # was derived from the KornShell "(())" construct)."
 # ..
 # "The portion of the ISO C standard arithmetic operations selected
 # corresponds to the operations historically supported in the KornShell."
 # 
 # In other words, rationale says that only constants and operators are the
 # language of arithmetic evaluation, and assignment shouldn't be
 # supported.
 
 The rationale is not a normative part of POSIX 2001. If it disagrees
 with anything in POSIX 2001, then POSIX 2001 is what counts.
 
 # Jens, perhaps, you may clarify further, what particular test you've run,
 # post snippets of the code in question? If the tests are valid and
 # verified OpenGroup ones, we may have to ask them for clarification,
 # or issue a defect report..
 
 I'm using the VSC-lite test suite with the TET3.6 Test Environment as
 made available for Austin Group members by the OpenGroup. The TET
 contains scripts to generate the automated test suite. It is the
 generation step that already fails (so I can't even *run* the actual
 test suite). The script in question from tet3.6-lite.src.tar.gz is
 src/posix_sh/api/tcm.sh:
 
 schweikh at hal9000:/tmp $ fgrep '$((' src/posix_sh/api/tcm.sh
                         : $((tet_l1_iccount += 1))
                 while test $((tet_l1_tpnum += 1)) -le $tet_tpcount
                         : $((tet_l1_tpcount += 1))
         while test $((tet_l3_sig += 1)) -lt $TET_NSIG
                         : $((tet_l31_testnum += $#))
                 : $((tet_testnum += tet_l33_tpnum - 1))
                         if test $tet_l36_icstart -lt $((tet_l34_last_icend + 1))
                                 tet_l36_icstart=$((tet_l34_last_icend + 1))
                                                 : $((tet_l36_icstart += 1))
                 while test $((tet_l36_icstart += 1)) -le $tet_l36_icend
                         while test $((tet_l36_icend -= 1)) -gt $tet_l36_icstart
         tet_l37_icnum=$((tet_l37_icstart - 1))
         while test $((tet_l37_icnum += 1)) -le $tet_l37_icend
 
 
 Regards,
 
 	Jens
 -- 
 Jens Schweikhardt http://www.schweikhardt.net/
 SIGSIG -- signature too long (core dumped)


More information about the freebsd-standards mailing list