Austin Group Defect Tracker

Aardvark Mark III


Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0000832 [1003.1(2013)/Issue7+TC1] Shell and Utilities Objection Clarification Requested 2014-04-06 08:15 2014-06-25 10:13
Reporter ormaaj View Status public  
Assigned To ajosey
Priority normal Resolution Accepted As Marked  
Status Interpretation Required  
Name Dan Douglas
Organization
User Reference
Section 2.6.5
Page Number 2333
Line Number 74133
Interp Status Approved
Final Accepted Text See Note: 0002220.
Summary 0000832: Clarify whether field splitting applies to arithmetic expansion
Description The first paragraph of section 2.6.5 states that after parameter expansion, command substitution, and arithmetic expansion, field splitting should apply to unquoted expansions and substitutions. That sentence could be interpreted as either referring to arithmetic expansion only with regards to the order of operations, or to imply that field splitting should apply to the results.

The subsequent sentence beginning on line 74136 then refers only to parameter expansion and command substitution without being explicit about whether that should exclude arithmetic expansion.

Many but not all current implementations do appear to apply field splitting to the results of arithmetic expansion per the following testcase:

    #!/bin/sh
    
    code='${ZSH_VERSION+false} || emulate sh
    ${BASH_VERSION+set -o posix}
    
    IFS=0
    printf "<%s> " $((1230456))'
    
    for sh in bash zsh ksh mksh posh dash bb; do
        printf '%-7s %s\n' "${sh}:" "$("$sh" -c "$code")"
    done

Which produces:

    bash: <123> <456>
    zsh: <1230456>
    ksh: <123> <456> # AT&T ksh
    mksh: <1230456>
    posh: <1230456>
    dash: <123> <456>
    bb: <123> <456> # Busybox ash
Desired Action Improve the wording so that either:

a) Field splitting is either explicitly required or explicitly disallowed on arithmetic expansion.

b) Field splitting is explicitly unspecified for arithmetic expansion.
Tags tc2-2008
Attached Files

- Relationships

-  Notes
(0002220)
Don Cragun (manager)
2014-04-10 15:40
edited on: 2014-04-10 15:50

Interpretation response
------------------------
The standard is unclear on this issue, and no conformance distinction can be made between alternative implementations based on this. This is being referred to the sponsor.

Rationale:
-------------
Section 2.6.5 doesn't mention arithmetic expansion (which specifies when field splitting is done), but section 2.6 (where is talks about the order of word expansions) does require field splitting after arithmetic expansions.

Notes to the Editor (not part of this interpretation):
-------------------------------------------------------
Change:
  The shell shall treat each character of the IFS as a delimiter and use the delimiters as field
  terminators to split the results of parameter expansion and command substitution into fields.
on P2333, L74136-74137 to:
  The shell shall treat each character of the IFS as a delimiter and use the delimiters as field
  terminators to split the results of parameter expansion, command substitution, and arithmetic
  expansion into fields.

(0002243)
ajosey (manager)
2014-05-02 09:27

Interpretation proposed 2 May 2014
(0002278)
ajosey (manager)
2014-06-25 10:13

Interpretation approved 25 June 2014

- Issue History
Date Modified Username Field Change
2014-04-06 08:15 ormaaj New Issue
2014-04-06 08:15 ormaaj Status New => Under Review
2014-04-06 08:15 ormaaj Assigned To => ajosey
2014-04-06 08:15 ormaaj Name => Dan Douglas
2014-04-06 08:15 ormaaj Section => 2.6.5
2014-04-06 08:15 ormaaj Page Number => 2333
2014-04-06 08:15 ormaaj Line Number => 74133
2014-04-07 15:15 geoffclare Project 2008-TC1 => 1003.1(2013)/Issue7+TC1
2014-04-10 15:40 Don Cragun Interp Status => Pending
2014-04-10 15:40 Don Cragun Note Added: 0002220
2014-04-10 15:40 Don Cragun Status Under Review => Interpretation Required
2014-04-10 15:40 Don Cragun Resolution Open => Accepted As Marked
2014-04-10 15:41 Don Cragun Final Accepted Text => See Note: 0002220.
2014-04-10 15:44 Don Cragun Tag Attached: tc2-2008
2014-04-10 15:50 Don Cragun Note Edited: 0002220
2014-05-02 09:27 ajosey Interp Status Pending => Proposed
2014-05-02 09:27 ajosey Note Added: 0002243
2014-06-25 10:13 ajosey Interp Status Proposed => Approved
2014-06-25 10:13 ajosey Note Added: 0002278


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker