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
0001562 [Issue 8 drafts] Shell and Utilities Editorial Clarification Requested 2022-02-13 00:28 2022-05-26 10:13
Reporter calestyo View Status public  
Assigned To
Priority normal Resolution Accepted As Marked  
Status Applied   Product Version Draft 2.1
Name Christoph Anton Mitterer
Organization
User Reference
Section Utilities, printf
Page Number 3084
Line Number 104239
Final Accepted Text Note: 0005818
Summary 0001562: printf utility: clarify what is (byte) string an what is character string
Description 3.375 String, defines:
"A contiguous sequence of bytes terminated by and including the first null byte."
i.e. a byte string, not - by itself - subject to the locale.


The description of the printf utility, uses the phrase "string" in some cases without clearly telling whether character or byte string is meant.


Line 104239, OPERANDS:
> format
> A string describing the format to use to write the remaining operands. See the
> EXTENDED DESCRIPTION section.

=> At least when following line 104273...
"The format operand shall be used as the format string described in XBD Chapter 5 (on page 101)", where it clearly says:
"The format is a character string that contains three types of objects defined below"

... format should be a character string, and as such, it would be subject to LC_CTYPE?!

=> OTOH, the APPLICATION USAGE tells that it's modelled after the printf() function, which in turn uses a C-string as format string,... and if that would also apply to the printf utility, it would be a (byte) string and XBD Chapter 5's provisions would fully apply (which should then be explicitly mentioned).


(See below, for an analogue example for why I think the difference matters.)


> argument
> The strings to be written to standard output, under the control of format.
> See the EXTENDED DESCRIPTION section.

Seems clearly a (byte) string, whose interpretation (byte, character) depends on the respective conversion specifier.



It may further make sense, to explicitly clarify in line 104288, that string here is a "byte string", especially because in 104290 and following, it's laid out how characters are part of it.
Consider e.g. some weird multibyte locale in which a character named A' is composed of bytes that include the binary representation of e.g. '\' (assuming some ASCII encodings for '\' and 'n')... I take as example for A' = 0xAA 0x5C
A string: A'n ... that is 0xAA 0x5C 0x6E should probably be interpreted as: 0xAA \n and thus giving 0xAA 0x0A ... and not the character A' followed by n.


Given that the whole section uses quite often the term "format string" (in the sense of character string)... it may make things more clear, to emphasise that this is a byte string.

The same probably at line 104321.
Desired Action See above.

Clarify more explicitly, what is byte string, and what is character string, or whether that's unspecified.
Tags tc3-2008
Attached Files

- Relationships
related to 0001561New clarify what kind of data shell variables need to be able to hold 

-  Notes
(0005673)
Don Cragun (manager)
2022-02-13 01:08

Character String and String are both defined terms in D2.1:
3.62
Character String
A contiguous sequence of characters terminated by and including the first null byte.

3.344
String
A contiguous sequence of bytes terminated by and including the first null byte.
(0005792)
geoffclare (manager)
2022-04-08 14:48
edited on: 2022-04-08 14:49

> it's modelled after the printf() function, which in turn uses a C-string as format string

The description of printf() says:
The format is a character string, beginning and ending in its initial shift state, if any.

The printf utility should have the same requirement.

(0005793)
geoffclare (manager)
2022-04-11 08:58

Actually, the wording for printf() needs to change to reflect the fact that this is a requirement on applications.

On page 898 line 30642 section fprintf(), and
page 940 line 32183 section fscanf(), and
page 1995 line 64733 section strftime(), change:
The format is a character string, beginning and ending in its initial shift state, if any
to:
The application shall ensure that the format is a character string, beginning and ending in its initial shift state, if any
Note to the editor: these pages are inconsistent about the use of italics on "format"; they should all use plain text, as in the C standard.

On page 2017 line 65452 section strptime(), insert:
The application shall ensure that the format is a character string, beginning and ending in its initial shift state, if any.
before:
The format is composed of zero or more directives.

On page 3085 line 104273 section printf, insert:
The application shall ensure that the format operand is a character string, beginning and ending in its initial shift state, if any.
before:
The format operand shall be used ...
(0005806)
calestyo (reporter)
2022-04-15 02:55

a) What about line 104239,... shouldn't we use there "character string", too?

Here "string" isn't the term "format-string" but rather describing what the parameter "format" is. So I think this should also explicitly use "character..." despite the whole thing being narrowed down further below, with your proposed insertion in line 104273.


b) At any places (e.g. in the printf utility, the functions you've listed above, and chapter 5 "File Format Notation") where "format string" is used, would it perhaps be better to use e.g. "format-string" instead,... to kinda indicate that this doesn't mean the 3.344 "string"?


c) I assume you don't like the idea of pointing out in lines 104288 and 104321 that it's specifically a *byte* string, which is IMO okayish, now that it's more clear where the string is a character string.

But what about line 3095, should it read "An optional CHARACTER string of decimal digits to specify" - or is that already clear enough because of it containing of decimal digits?



Other than that... looks good to me.
(0005818)
geoffclare (manager)
2022-04-22 15:18
edited on: 2022-04-22 15:19

New proposal ...

On page 898 line 30642 section fprintf(), and
page 940 line 32183 section fscanf(), and
page 1995 line 64733 section strftime(), change:
The format is a character string, beginning and ending in its initial shift state, if any
to:
The application shall ensure that the format is a character string, beginning and ending in its initial shift state, if any
Note to the editor: these pages are inconsistent about the use of italics on "format"; they should all use plain text, as in the C standard.

On page 2017 line 65452 section strptime(), insert:
The application shall ensure that the format is a character string, beginning and ending in its initial shift state, if any.
before:
The format is composed of zero or more directives.

On page 3084 line 104239 section printf, change:
A string describing the format to use ...
to:
A character string describing the format to use ...

On page 3084 line 104241 section printf, change:
The strings to be written ...
to:
The values to be written ...

On page 3085 line 104273 section printf, insert:
The application shall ensure that the format operand is a character string, beginning and ending in its initial shift state, if any.
before:
The format operand shall be used ...



- Issue History
Date Modified Username Field Change
2022-02-13 00:28 calestyo New Issue
2022-02-13 00:28 calestyo Name => Christoph Anton Mitterer
2022-02-13 00:28 calestyo Section => Utilities, printf
2022-02-13 00:28 calestyo Page Number => 3084
2022-02-13 00:28 calestyo Line Number => 104239
2022-02-13 01:08 Don Cragun Note Added: 0005673
2022-04-07 16:30 geoffclare Relationship added related to 0001561
2022-04-08 14:48 geoffclare Note Added: 0005792
2022-04-08 14:49 geoffclare Note Edited: 0005792
2022-04-11 08:58 geoffclare Note Added: 0005793
2022-04-15 02:55 calestyo Note Added: 0005806
2022-04-22 15:18 geoffclare Note Added: 0005818
2022-04-22 15:19 geoffclare Note Edited: 0005818
2022-04-28 15:31 geoffclare Final Accepted Text => Note: 0005818
2022-04-28 15:31 geoffclare Status New => Resolved
2022-04-28 15:31 geoffclare Resolution Open => Accepted As Marked
2022-04-28 15:32 geoffclare Tag Attached: tc3-2008
2022-05-26 10:13 geoffclare Status Resolved => Applied


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