Austin Group Defect Tracker

Aardvark Mark III


Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0000701 [1003.1(2013)/Issue7+TC1] System Interfaces Objection Error 2013-05-20 11:20 2016-09-02 15:29
Reporter geoffclare View Status public  
Assigned To
Priority normal Resolution Open  
Status New  
Name Geoff Clare
Organization The Open Group
User Reference
Section ungetc(), ungetwc()
Page Number 2170, 2172
Line Number 69084, 69130
Interp Status ---
Final Accepted Text
Summary 0000701: unget[w]c() and file position after discarding push back
Description The ungetc() description, as updated by TC1, includes the following:

    The value of the file-position indicator for the stream after all
    pushed-back bytes have been read, or discarded by calling fseek(),
    fseeko(), fsetpos(), or rewind() (but not fflush()), shall be the
    same as it was before the bytes were pushed back.

Similarly for ungetwc() (with "characters" instead of "bytes").

The "discarded" part of this requirement does not make any sense.
All of the listed functions which discard the push back also _set_ the
file position. The file position will end up as whatever the function
sets it to, not "the same as it was before the bytes [or characters]
were pushed back".

Since these requirements derive from the C Standard, we should raise
this issue with the C committee.
Desired Action For ungetc() change:

    The value of the file-position indicator for the stream after all
    pushed-back bytes have been read, or discarded by calling fseek(),
    fseeko(), fsetpos(), or rewind() (but not fflush()), shall be the
    same as it was before the bytes were pushed back.

to:

    The value of the file-position indicator for the stream after all
    pushed-back bytes have been read shall be the same as it was
    before the bytes were pushed back.

For ungetwc() change:

    The value of the file-position indicator for the stream after all
    pushed-back characters have been read, or discarded by calling
    fseek(), fseeko(), fsetpos(), or rewind() (but not fflush()), shall
    be the same as it was before the characters were pushed back.

to:

    The value of the file-position indicator for the stream after all
    pushed-back characters have been read shall be the same as it was
    before the characters were pushed back.

Also add something to the RATIONALE sections for these two functions,
pointing out that some text from the C Standard intentionally does
not appear in POSIX. The wording will depend on the response we get
from the C committee.
Tags c99
Attached Files

- Relationships

-  Notes
(0002218)
nick (manager)
2014-04-10 14:54

Under consideration by C. See:
http://open-std.org/JTC1/SC22/WG14/www/docs/n1720.htm [^]

This was discussed at the Chicago C meeting in 2013:
ungetc / ungetwc and file position after discarding push back problems. 
 
Ref Austin Group Defect #701, says that “or discarding” makes no sense.  
Larry Jones pointed out that the Standard is correct as written because the intent is that the 
specified file position indicator is an intermediate state inside the file positioning function after 
the pushed‐back characters are discarded but before the actual seek. That gives you a reliable 
file position from which to do the seek. It’s not intended that the file positioning function doesn’t 
set the file position indicator. 
 
Needs a Committee Response rather than a Suggested Change –or‐ possible footnote to explain why. 
 
Bill Seymour proposed the following Suggested TC. 
 
Add a footnote after “pushed‐back characters” in the second sentence of 7.21.7.10p5: 
 
After the file positioning function discards the characters but before it actually does the 
repositioning. 
 
Add a footnote after “pushed‐back wide characters” in the second sentence of 7.29.3.10p5: 
 
After the file positioning function discards the characters but before it actually does the 
repositioning. 
 
    After some discussion, we decided that the above words needed some editing. 
 
    ACTION: Larry Jones to reword the Suggested TC footnote for DR 438. 
 
    Leave OPEN 
(0003373)
nick (manager)
2016-09-02 15:29

Checking through the C committee DRs, I noticed that this one has in fact been closed for a while. The final disposition is:

Proposed Technical Corrigendum

Add a footnote to 7.21.7.10 paragraph 5, second sentence:

Note that a file positioning function may further modify the file position indicator after discarding any pushed-back characters.

Add a footnote to 7.29.3.10 paragraph 5, second sentence:
Note that a file positioning function may further modify the file position indicator after discarding any pushed-back wide characters.

- Issue History
Date Modified Username Field Change
2013-05-20 11:20 geoffclare New Issue
2013-05-20 11:20 geoffclare Name => Geoff Clare
2013-05-20 11:20 geoffclare Organization => The Open Group
2013-05-20 11:20 geoffclare Section => ungetc(), ungetwc()
2013-05-20 11:20 geoffclare Page Number => 2170, 2172
2013-05-20 11:20 geoffclare Line Number => 69084, 69130
2013-05-20 11:20 geoffclare Interp Status => ---
2013-05-20 11:20 geoffclare Tag Attached: c99
2014-04-10 14:54 nick Note Added: 0002218
2016-09-02 15:29 nick Note Added: 0003373


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