Austin Group Defect Tracker

Aardvark Mark IV


Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0000709 [1003.1(2013)/Issue7+TC1] Shell and Utilities Objection Error 2013-06-11 06:30 2019-06-10 08:55
Reporter philip-guenther View Status public  
Assigned To ajosey
Priority normal Resolution Accepted As Marked  
Status Closed  
Name Philip Guenther
Organization OpenBSD
User Reference
Section expr
Page Number 2740
Line Number 89683-89684
Interp Status Approved
Final Accepted Text Note: 0001650
Summary 0000709: specification of when a string is converted to integer doesn't match existing practice
Description The extended description of expr says:
        A string argument is an argument that cannot be identified
        as an integer argument or as one of the expression operator
        symbols shown in the OPERANDS section.

According to that, the "010" in each of the following commands:
    expr 010
    expr \( 010 \)
    expr 010 : '\(.*\)'
    expr 0 '|' 010

is _not_ a string argument because they _can_ be identified as an
integer argument, which means that the output of each of those
should be "10", but that isn't done in Solaris, Linux, FreeBSD, or
OpenBSD. They all consistently output "010" for those.

I believe that existing implementations all only convert a string
to an integer only when it is used as an operand of a binary operator
other than ':'.


Side note: the HTML formatting of the table is misleading/wrong, as
the rows separators are identical within and between precedence.
Desired Action Replace lines 89682 through 89684 with something like:
      Identification as Integer or String

        An argument or the value of a subexpression that consists
        only of an (optional) unary minus followed by digits is
        identified as an integer if it is used as the left argument
        to the | operator or as either argument to any of the
        following operators: & = > >= < <= != + - * / %

        Otherwise the argument or subexpression value is identified
        as a string.
Tags tc2-2008
Attached Files

- Relationships

-  Notes
(0001649)
geoffclare (manager)
2013-06-11 08:22

The suggested change does not take into account cases such
as the following where an all-digit argument is treated as
a string:

$ LC_ALL=C expr A \< 1
0
$ LC_ALL=C expr \$ \< 1
1

The binary operators that can operate on either strings or
integers only treat their operands as integers if both of
them consist of an optional minus sign followed by digits.
(0001650)
geoffclare (manager)
2013-06-13 15:27
edited on: 2013-06-13 15:32

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:
-------------
None.

Notes to the Editor (not part of this interpretation):
-------------------------------------------------------
Replace lines 89682 through 89684 with:

      Identification as Integer or String

        An argument or the value of a subexpression that consists
        only of an optional unary minus followed by digits is
        a candidate for treatment as an integer if it is used as the
        left argument to the | operator or as either argument to any
        of the following operators: & = > >= < <= != + - * / %.
        Otherwise, the argument or subexpression value shall be
        treated as a string.

(0001807)
ajosey (manager)
2013-09-06 04:54

Interpretation Proposed 6 Sep 2013
(0001893)
ajosey (manager)
2013-10-14 13:07

Interpretation approved 14 October 2013

- Issue History
Date Modified Username Field Change
2013-06-11 06:30 philip-guenther New Issue
2013-06-11 06:30 philip-guenther Status New => Under Review
2013-06-11 06:30 philip-guenther Assigned To => ajosey
2013-06-11 06:30 philip-guenther Name => Philip Guenther
2013-06-11 06:30 philip-guenther Organization => OpenBSD
2013-06-11 06:30 philip-guenther Section => expr
2013-06-11 06:30 philip-guenther Page Number => 2740
2013-06-11 06:30 philip-guenther Line Number => 89683-89684
2013-06-11 08:22 geoffclare Note Added: 0001649
2013-06-13 15:22 nick Project 2008-TC1 => 1003.1(2013)/Issue7+TC1
2013-06-13 15:27 geoffclare Note Added: 0001650
2013-06-13 15:28 geoffclare Note Edited: 0001650
2013-06-13 15:32 geoffclare Note Edited: 0001650
2013-06-13 15:32 geoffclare Interp Status => Pending
2013-06-13 15:32 geoffclare Final Accepted Text => Note: 0001650
2013-06-13 15:32 geoffclare Status Under Review => Interpretation Required
2013-06-13 15:32 geoffclare Resolution Open => Accepted As Marked
2013-06-13 15:32 geoffclare Tag Attached: tc2-2008
2013-09-06 04:54 ajosey Interp Status Pending => Proposed
2013-09-06 04:54 ajosey Note Added: 0001807
2013-10-14 13:07 ajosey Interp Status Proposed => Approved
2013-10-14 13:07 ajosey Note Added: 0001893
2019-06-10 08:55 agadmin Status Interpretation Required => Closed


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