View Issue Details

IDProjectCategoryView StatusLast Update
00010271003.1(2013)/Issue7+TC1System Interfacespublic2024-06-11 08:57
Reportergeoffclare Assigned To 
PriorityhighSeverityObjectionTypeError
Status ClosedResolutionAccepted As Marked 
NameGeoff Clare
OrganizationThe Open Group
User Reference
Sectionfseek, ftell
Page Number946, 965
Line Number31911, 32581
Interp StatusApproved
Final Accepted TextSee 0001027:0003109
Summary0001027: file-position indicator for open_wmemstream() streams
DescriptionThe descriptions of fseek() and ftell() say that the file-position
indicator is "measured in bytes from the beginning of the file".

However, for streams opened with open_wmemstream() it is supposed
to measure the number of wide characters, not the number of bytes.
(This is how glibc behaves, and the standard's requirements for the
behaviour of open_wmemstream() when it was added in SUSv4 were intended
to match glibc.)
Desired ActionOn Page: 946 Line: 31911 Section: fseek()

Change from:
The new position, measured in bytes from the beginning of the file, shall
to:
The new position, measured in bytes from the beginning of the file, [CX]except in the case of streams opened with open_wmemstream() for which the position is measured in wide characters,[/CX] shall

On Page: 965 Line: 32581 Section: ftell()

Change from:
measured in bytes from the beginning of the file
to:
measured in bytes from the beginning of the file, [CX]except in the case of streams opened with open_wmemstream() for which the position is measured in wide characters.[/CX]

On Page: 947 Line: 31981 Section: fseek()
and Page: 965 Line: 32600 Section: ftell()
Add open_wmemstream to the SEE ALSO section.

Tagsissue8

Activities

rhansen

2016-03-24 16:21

manager   bugnote:0003109

Interpretation response
------------------------
The standard states that ftell() and fseek() operate on byte offsets with streams opened by open_wmemstream(), and conforming implementations must conform to this. However, concerns have been raised about this which are being referred to the sponsor.

Rationale:
-------------
The standard originally attempted to specify glibc's behavior, but an unintentional error was made resulting in a specification that did not match the glibc behavior.

Notes to the Editor (not part of this interpretation):
-------------------------------------------------------
Make the changes in the Desired Action. In addition, make the following changes:

On page 965 line 32596 (ftell() RATIONALE), change "None" to the following new paragraph:
For all streams other than those opened by open_wmemstream(), ftell() and fseek() operate on byte offsets. The behavior with open_wmemstream() streams is intentionally different—ftell() and fseek() operate on wide character offsets. This is because those streams are unique in that the backing storage is not a multibyte representation but a wide character array, and it is useful to be able to use the output of ftell() to index into that array.

On page 947 line 31977 (fseek() RATIONALE), change "None" to:
See the rationale for ftell().

ajosey

2016-03-25 17:08

manager   bugnote:0003111

Interpretation proposed: March 25 2016

ajosey

2016-04-30 05:18

manager   bugnote:0003188

Interpretation Approved: 30 April 2016

Issue History

Date Modified Username Field Change
2016-02-17 10:16 geoffclare New Issue
2016-02-17 10:16 geoffclare Name => Geoff Clare
2016-02-17 10:16 geoffclare Organization => The Open Group
2016-02-17 10:16 geoffclare Section => fseek, ftell
2016-02-17 10:16 geoffclare Page Number => 946, 965
2016-02-17 10:16 geoffclare Line Number => 31911, 32581
2016-02-17 10:16 geoffclare Interp Status => ---
2016-03-24 16:21 rhansen Note Added: 0003109
2016-03-24 16:21 rhansen Tag Attached: issue8
2016-03-24 16:22 rhansen Interp Status --- => Pending
2016-03-24 16:22 rhansen Final Accepted Text => See 0001027:0003109
2016-03-24 16:22 rhansen Status New => Interpretation Required
2016-03-24 16:22 rhansen Resolution Open => Accepted As Marked
2016-03-25 17:08 ajosey Interp Status Pending => Proposed
2016-03-25 17:08 ajosey Note Added: 0003111
2016-04-30 05:18 ajosey Interp Status Proposed => Approved
2016-04-30 05:18 ajosey Note Added: 0003188
2020-04-14 15:07 geoffclare Status Interpretation Required => Applied
2024-06-11 08:57 agadmin Status Applied => Closed