View Issue Details

IDProjectCategoryView StatusLast Update
00005711003.1(2008)/Issue 7System Interfacespublic2019-06-10 08:55
Reportergeoffclare Assigned Toajosey  
PrioritynormalSeverityObjectionTypeClarification Requested
Status ClosedResolutionAccepted As Marked 
NameGeoff Clare
OrganizationThe Open Group
User Reference
Sectiongetdelim
Page Number1005
Line Number33753
Interp StatusApproved
Final Accepted TextSee 0000571:0001246
Summary0000571: getdelim() end-of-file behaviour needs clarifying
DescriptionThe RETURN VALUE section for getdelim() states:

    If no characters were read, and the end-of-file indicator for
    the stream is set, or if the stream is at end-of-file, the
    end-of-file indicator for the stream shall be set and the
    function shall return -1.

It is not clear from this what happens if the end-of-file indicator
is already set, and the stream is not at end-of-file, before the
call. The inclusion of the "no characters were read" condition
could be taken as implying that when the end-of-file indicator is
set getdelim() can attempt to read some characters and only needs
to return -1 if it does not read any. However, XSH Section 2.5
states "All input takes place as if bytes were read by successive
calls to fgetc()", and fgetc() is required to return EOF when the
eof-of-file indicator is set regardless of whether the stream is
at end-of-file. Therefore, in fact getdelim() is required not to
try to read any characters and the "no characters were read"
condition will always be true if the end-of-file indicator is
already set.

This is consistent with the "sticky end-of-file" behaviour of all
the C99 stdio input functions.
Desired ActionChange:

    If no characters were read, and the end-of-file indicator for the
    stream is set, or if the stream is at end-of-file, the end-of-file
    indicator for the stream shall be set and the function shall
    return -1.

to:

    If the end-of-file indicator for the stream is set, or if no
    characters were read and the stream is at end-of-file, the
    end-of-file indicator for the stream shall be set and the
    function shall return -1.
Tagstc2-2008

Activities

Don Cragun

2012-05-31 15:44

manager   bugnote:0001246

Interpretation response
------------------------

The standard does not speak to this issue, and as such no conformance distinction can be made between alternative implementations based on this. This is being referred to the sponsor.

Rationale:
-------------
We believe that this has always been the expected behavior and that existing implementations already behave as suggested.

Notes to the Editor (not part of this interpretation):
-------------------------------------------------------
Make the changes suggested in the Desired Action.

ajosey

2012-06-29 16:14

manager   bugnote:0001285

Interpretation proposed 29 June 2012 for final 45 day review

ajosey

2012-08-30 09:12

manager   bugnote:0001348

Interpretation approved 30 Aug 2012

Issue History

Date Modified Username Field Change
2012-05-30 14:50 geoffclare New Issue
2012-05-30 14:50 geoffclare Status New => Under Review
2012-05-30 14:50 geoffclare Assigned To => ajosey
2012-05-30 14:50 geoffclare Name => Geoff Clare
2012-05-30 14:50 geoffclare Organization => The Open Group
2012-05-30 14:50 geoffclare Section => getdelim
2012-05-30 14:50 geoffclare Page Number => 1005
2012-05-30 14:50 geoffclare Line Number => 33753
2012-05-30 14:50 geoffclare Interp Status => ---
2012-05-31 15:44 Don Cragun Final Accepted Text => See 0000571:0001246
2012-05-31 15:44 Don Cragun Note Added: 0001246
2012-05-31 15:44 Don Cragun Status Under Review => Interpretation Required
2012-05-31 15:44 Don Cragun Resolution Open => Accepted
2012-05-31 15:44 Don Cragun Tag Attached: tc2-2008
2012-05-31 15:44 Don Cragun Resolution Accepted => Accepted As Marked
2012-05-31 15:51 Don Cragun Interp Status --- => Pending
2012-06-29 16:14 ajosey Interp Status Pending => Proposed
2012-06-29 16:14 ajosey Note Added: 0001285
2012-08-30 09:12 ajosey Interp Status Proposed => Approved
2012-08-30 09:12 ajosey Note Added: 0001348
2019-06-10 08:55 agadmin Status Interpretation Required => Closed