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
0000396 [1003.1(2008)/Issue 7] System Interfaces Objection Error 2011-03-17 18:11 2013-04-16 13:06
Reporter eblake View Status public  
Assigned To ajosey
Priority normal Resolution Accepted  
Status Closed  
Name Eric Blake
Organization Red Hat
User Reference ebb.fmemopen
Section fmemopen
Page Number 866
Line Number 28743
Interp Status Approved
Final Accepted Text See Note: 0000795
Summary 0000396: fmemopen vs. 'b' mode flag
Description When fmemopen was first proposed for addition in the standard during the
2006 Extended API Set documents, it was derived from the glibc
implementation, which at that time silently ignored the 'b' flag in the
mode argument. However, before POSIX 2008 was ratified, the glibc
implementation changed behavior to give the 'b' flag a specific meaning:
http://sourceware.org/bugzilla/show_bug.cgi?id=6544 [^] (Aug 2008)
with the current glibc documentation of:

   Since glibc 2.9, the letter 'b' may be specified as the second
   character in mode. This provides "binary" mode: writes don't
   implicitly add a terminating null byte, and fseek(3) SEEK_END is
   relative to the end of the buffer (i.e., the value specified by
   the size argument), rather than the current string length.

When this was pointed out to the glibc maintainers, they argued that since
the POSIX specification of fmemopen used the glibc implementation as the
reference, then POSIX rather than glibc should be changed to permit the
glibc behavior that was in effect at the time POSIX 2008 was ratified:
http://sourceware.org/bugzilla/show_bug.cgi?id=12503 [^]

The desired action for this bug is designed for TC1, to permit current
glibc behavior without penalizing other implementations that implemented
what was standardized (most other implementations documented fmemopen
mode flags based on POSIX wording, so the new wording can require
implementation-defined rather than unspecified behavior). However,
given that glibc has determined that binary string processing seems
useful, we should probably also open consider a separate proposal for
Issue 8 that mandates the new glibc behavior (although possibly with a
new mode flag, rather than 'b').
Desired Action At lines 28743-28749 [XSH fmemopen DESCRIPTION], change the first column:

r or rb
w or wb
a or ab
r+ or rb+ or r+b
w+ or wb+ or w+b
a+ or ab+ or a+b

to:

r
w
a
r+
w+
a+

At line 28751, replace:

The character ’b’ shall have no effect.

with:

Implementations shall accept all mode strings allowed by fopen(),
but the use of the character 'b' shall produce implementation-defined
results, where the resulting FILE * need not behave the same as if 'b'
were omitted.

At line 28824 [FUTURE DIRECTIONS], change "None." to:

A future revision of this standard may mandate specific behavior when
the mode argument includes 'b'.
Tags tc1-2008
Attached Files

- Relationships
parent of 0000456Appliedajosey mandate binary mode of fmemopen 
related to 0000461Closedajosey missing shalls in interfaces new to Issue 7 
related to 0000657Under Reviewajosey Conditions under which fmemopen() write a NUL to the buffer are insufficiently specified 

-  Notes
(0000795)
nick (manager)
2011-05-26 15:42

Interpretation response
------------------------
The standard states that the character 'b' shall have no effect, and
conforming implementations must conform to this. However, concerns have
been raised about this which are being referred to the sponsor.

Rationale:
-------------
Existing practice at the time of final acceptance of POSIX.1:2008 had
expanded to include use of the letter 'b' as the second
character in mode. This provides "binary" mode: writes don't
implicitly add a terminating null byte, and fseek(3) SEEK_END is
relative to the end of the buffer (i.e., the value specified by
the size argument), rather than the current string length.

Notes to the Editor (not part of this interpretation):
-------------------------------------------------------
See Desired Action.
(0000842)
ajosey (manager)
2011-06-16 10:15

Interpretation proposed 16 June 2011 for final 30 day review
(0000910)
ajosey (manager)
2011-07-29 06:15

The interpretation is now approved.

- Issue History
Date Modified Username Field Change
2011-03-17 18:11 eblake New Issue
2011-03-17 18:11 eblake Status New => Under Review
2011-03-17 18:11 eblake Assigned To => ajosey
2011-03-17 18:11 eblake Name => Eric Blake
2011-03-17 18:11 eblake Organization => Red Hat
2011-03-17 18:11 eblake User Reference => ebb.fmemopen
2011-03-17 18:11 eblake Section => fmemopen
2011-03-17 18:11 eblake Page Number => 866
2011-03-17 18:11 eblake Line Number => 28743
2011-03-17 18:11 eblake Interp Status => ---
2011-05-26 15:42 nick Note Added: 0000795
2011-05-26 15:43 nick Interp Status --- => Pending
2011-05-26 15:43 nick Final Accepted Text => See Note: 0000795
2011-05-26 15:43 nick Status Under Review => Interpretation Required
2011-05-26 15:43 nick Resolution Open => Accepted
2011-05-26 15:43 nick Tag Attached: tc1-2008
2011-06-02 19:11 eblake Desired Action Updated
2011-06-02 19:12 eblake Relationship added parent of 0000456
2011-06-07 21:00 eblake Relationship added related to 0000461
2011-06-16 10:15 ajosey Interp Status Pending => Proposed
2011-06-16 10:15 ajosey Note Added: 0000842
2011-07-29 06:15 ajosey Interp Status Proposed => Approved
2011-07-29 06:15 ajosey Note Added: 0000910
2013-02-14 16:55 eblake Relationship added related to 0000657
2013-04-16 13:06 ajosey Status Interpretation Required => Closed


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