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
0001491 [Issue 8 drafts] Shell and Utilities Editorial Error 2021-07-28 17:00 2021-08-16 13:38
Reporter mirabilos View Status public  
Assigned To
Priority normal Resolution Accepted As Marked  
Status Applied   Product Version Draft 2
Name mirabilos
Organization
User Reference
Section Positional Parameters
Page Number 2312
Line Number 74465-74471
Final Accepted Text See Note: 0005429
Summary 0001491: $0 ≠ ${00} ?
Description There’s a probable oversight in:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_05_01 [^]

   A positional parameter is a parameter denoted by the decimal value represented by one or more digits,
   other than the single digit 0. The digits denoting the positional parameters shall always be interpreted
   as a decimal value, even if there is a leading zero. When a positional parameter with more than one
   digit is specified, the application shall enclose the digits in braces (see [47]Parameter Expansion).

This reads as $0 or ${0} is not a positional parameter (single digit 0)
but ${00} is.
Desired Action Change…

    other than the single digit 0

… to:

    other than the number 0
Tags tc3-2008
Attached Files

- Relationships
related to 0001514Applied 1003.1(2016/18)/Issue7+TC2 More "positional parameter" problems 

-  Notes
(0005418)
shware_systems (reporter)
2021-07-28 17:33

I'd prefer "that evaluate to a positive value other than zero" instead. Then the ${00} case is the same, functionally, as ${0}, I'd think, for evaluation purposes. Use of "number" I see as leaving open implementations allowing other number formats as extensions.

Also, it is one or more leading zeros, not just a single leading one, that gets ignored for establishing the final value.
(0005419)
kre (reporter)
2021-07-28 22:26

Why is this in "online pubs" which is mostly (I believe) intended for
errors in the conversion to HTML format?

While it would be tempting to define ${00} to mean the same as $0 (or ${0})
I am not sure we can, as currently you're right, that's not the way the spec
reads, and yash implemented things according to the spec... There's no way
to set the 0'th numeric parameter, so ${00} there is always empty, but it isn't
the same as $0.

I think that means that the updated spec needs to say that ${0...0} gives
unspecified results (any number of 0's > 1)- which is OK, as there's no
rational reason to ever write such an expansion.

So, perhaps what is needed is something a long the lines of

    If the value 0 is written with more than one 0 character, the
    results of the expansion are unspecified, this is neither a special
    parameter nor a numeric parameter (nor a variable).

Re Note: 0005418 - you're right, it is "one or more leading zeroes" that are
irrelevant (except for $0 of course) - but the way the spec is written now
is fine - the point there is that a leading 0 does not make the value be
interpreted as octal (or hex if it was 0x - not that that is possible since
only digits are allowed), and for that it is only the first leading zero that
is material, in any context either 00000013 is octal, or it is decimal,
in exactly the same circumstances as 013 is - the extra 0's are irrelevant.
(0005420)
Don Cragun (manager)
2021-07-28 23:17

Was filed against Online pubs with URL https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_05_01 [^] but this is not an issue about publication problems. Moved to Issue 8 drafts with page and lines numbers from Issue 8 draft 2.
(0005429)
Don Cragun (manager)
2021-08-05 15:29

On page 2312 change lines 74465-74466 from:

    
A positional parameter is a parameter denoted by the decimal value represented by one or more digits, other than the single digit 0. The digits denoting the positional parameters shall always be interpreted as a decimal value, even if there is a leading zero. When a positional parameter with more than one digit is specified, the application shall enclose the digits in braces (see Section 2.6.2). Positional parameters are initially assigned...


to:

    
A positional parameter is a parameter denoted by a decimal representation of a positive integer. The digits denoting the positional parameters shall always be interpreted as a decimal value, even if there is a leading zero. When a positional parameter with more than one digit is specified, the application shall enclose the digits in braces (see Section 2.6.2).


    Examples:


        
  • "$8", "${8}", "${08}", "${008}", etc. all expand to the value of the eighth positional parameter.


  •     
  • "${10}" expands to the value of the tenth positional parameter.


  •     
  • "$10" expands to the value of the first positional parameter followed by the character '0'.


  •     



    <small>Note: 0 is a special parameter, not a positional parameter, and therefore the results of expanding ${00} are unspecified.</small>


    Positional parameters are initially assigned...



On page 2318 change lines 74733-74736 from:

    
If the parameter is not enclosed in braces, and is a name, the expansion shall use the longest valid name (see XBD Section 3.207), whether or not the variable represented by that name exists. Otherwise, the parameter is a single-character symbol, and behavior is unspecified if that character is neither a digit nor one of the special parameters (see Section 2.5.2).


to:

    
For a parameter that is not enclosed in braces:

    


        
  • If the parameter is a name, the expansion shall use the longest valid name (see XBD Section 3.207), whether or not the variable denoted by that name exists.


  •     
  • Otherwise, the parameter is a single-character symbol, and behavior is unspecified if that character is neither a digit nor one of the special parameters (see Section 2.5.2).


  •     

- Issue History
Date Modified Username Field Change
2021-07-28 17:00 mirabilos New Issue
2021-07-28 17:00 mirabilos Name => mirabilos
2021-07-28 17:00 mirabilos URL => https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_05_01 [^]
2021-07-28 17:00 mirabilos Section => (section number or name, can be interface name)
2021-07-28 17:33 shware_systems Note Added: 0005418
2021-07-28 22:26 kre Note Added: 0005419
2021-07-28 23:10 Don Cragun Project Online Pubs => Issue 8 drafts
2021-07-28 23:17 Don Cragun Section (section number or name, can be interface name) => Positional Parameters
2021-07-28 23:17 Don Cragun Page Number => 2312
2021-07-28 23:17 Don Cragun Line Number => 74465-74471
2021-07-28 23:17 Don Cragun Note Added: 0005420
2021-07-28 23:17 Don Cragun version => Draft 2
2021-08-05 15:29 Don Cragun Note Added: 0005429
2021-08-05 15:30 Don Cragun Final Accepted Text => See Note: 0005429
2021-08-05 15:30 Don Cragun Status New => Resolved
2021-08-05 15:30 Don Cragun Resolution Open => Accepted As Marked
2021-08-05 15:30 Don Cragun Tag Attached: tc3-2008
2021-08-16 13:38 geoffclare Status Resolved => Applied
2021-08-20 09:48 geoffclare Relationship added related to 0001514


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