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
0000308 [1003.1(2004)/Issue 6] System Interfaces Editorial Omission 2010-09-13 14:04 2019-10-16 13:40
Reporter geoffclare View Status public  
Assigned To ajosey
Priority normal Resolution Accepted As Marked  
Status Applied  
Name Martin Sebor
Organization
User Reference fputc
Section fputc
Page Number 425
Line Number 13958
Interp Status Approved
Final Accepted Text Note: 0000547
Summary 0000308: stdio function EFBIG errors and SIGXFSZ
Description  The description of the setrlimit() function states:

   RLIMIT_FSIZE This is the maximum size of a file, in bytes, that
                 may be created by a process. If a write or truncate
                 operation would cause this limit to be exceeded,
                 SIGXFSZ shall be generated for the thread.

 However, stdio functions such as fputc() that write to the output
 stream do not mention SIGXFSZ in association with the EFBIG error
 they return when an attempt was made to write to a file that exceeds
 the process file size limit.
Desired Action
 Change the description of EFBIG on line 13958 in fputc() from

   [EFBIG] An attempt was made to write a file that exceeds the
           process' file size limit.

 to read:

   [EFBIG] An attempt was made to write a file that exceeds the
           process' file size limit.  A SIGXFSZ signal shall also
           be sent to the thread.

Tags tc3-2008
Attached Files

- Relationships

-  Notes
(0000546)
geoffclare (manager)
2010-09-13 14:05

Copied from xshbug2.txt ERN 238
(0000547)
geoffclare (manager)
2010-09-13 14:09
edited on: 2010-09-13 14:12

Interpretation response
------------------------
The standard is unclear on this issue, and no conformance distinction can be made between alternative implementations based on this. This is being referred to the sponsor.

Rationale:
-------------
As noted by the submitter, all stdio functions have this problem; not just fputc().


Notes to the Editor (not part of this interpretation):
-------------------------------------------------------

All page and line numbers in this response refer to the XSH volume of
draft 5.1 of the revision.

Subclause 2.5.1 (Interaction of File Descriptors and Standard I/O
Streams) says that stdio functions have underlying functions (P493,
L16896-16899 and P492, L16855-16856). If the standard listed the
underlying functions for each stdio function, we could just point out
that the description of errors and signals could be derived by looking
at the descriptions of the underlying functions. But, there is no text
in the standard that explicitly lists the underlying functions for any
of the stdio functions.

Furthermore, the non-stdio functions ftruncate(), pwrite(), truncate(),
write(), and writev() (indirectly through its reference to write())
describe the delivery of the SIGXFSZ signal in their description
sections but not in their ERRORS sections. (This is inconsistent with
the way SIGPIPE is described in ESPIPE errors in the rest of the
standard.) However, the sending of the SIGPIPE signal is unconditional
when the file descriptor refers to a pipe, but a SIGXSFZ signal is not
sent if a partial write can be completed without crossing the process's
file size limit. Therefore, some text is needed in the description
section of many of these functions to describe the requirement to
perform a partial write to extend the file to the limit instead of
generating the signal. This also affects flushing of trace log files.

The following changes make the handling of SIGXFSZ consistent with the
way SIGPIPE is handled in stdio and non-stdio functions, and regularizes
the wording in EFBIG error clauses:
 1. Add a new paragraph after P582, L20093:
        If the request would cause the file size to exceed the soft
        file size limit for the process and there is no room for any
        bytes to be written, the request shall fail and the
        implementation shall generate the SIGXFSZ signal for the
        thread.
    as the new last paragraph of the aio_write() DESCRIPTION section
    with XSI shading.

 2. Change the wording on P583, L20120-21023 from:
        The following condition may be detected synchronously or
        asynchronously:
        [EFBIG] The file is a regular file, aiobcp->aio_nbytes is
                greater than 0, and the starting offset in
                aiobcp->aio_offset is at or beyond the offset maximum
                in the open file description associated with
                aiocbp->aio_fildes.
    in the aio_write() ERRORS section to:
        The following conditions may be detected synchronously or
        asynchronously:
                [EFBIG] The file is a regular file, aiobcp->aio_nbytes
                        is greater than 0, and the starting position is
                        greater than or equal to the offset maximum in
                        the open file description associated with
                        aiocbp->aio_fildes.
          XSI   [EFBIG] The file is a regular file, aiobcp->aio_nbytes
          XSI           is greater than 0, and there is no room for any
          XSI           bytes to be written at the starting position
          XSI           without exceeding the file size limit for the
          XSI           process.  A SIGXFSZ signal shall also be sent to
          XSI           the thread.
                [EFBIG] The file is a regular file, aiobcp->aio_nbytes
                        is greater than 0, and there is no room for any
                        bytes to be written at the starting position
                        without exceeding the implementation-defined
                        maximum file size.
    with shading as indicated by the margin markings.

 3. Add to end of P805, L26824 (2nd fclose() EFBIG error):
        A SIGXFSZ signal shall also be sent to the thread.
    with XSI shading.

 4. Add to end of P844, L28042 (2nd fflush() EFBIG error):
        A SIGXFSZ signal shall also be sent to the thread.
    with XSI shading.

 5. Add to end of P906, L30298 (2nd fputc() EFBIG error):
        A SIGXFSZ signal shall also be sent to the thread.
    with XSI shading.

 6. Split P910, L30422-30423 (1st fputwc() EFBIG error) from:
         CX     [EFBIG] An attempt was made to write to a file that
         CX             exceeds the maximum file size or the file size
         CX             limit of the process.
    to:
         CX     [EFBIG] An attempt was made to write to a file that
         CX             exceeds the maximum file size.

         XSI    [EFBIG] An attempt was made to write to a file that
         XSI            exceeds the file size limit of the process.  A
         XSI            SIGXFSZ signal shall also be sent to the thread.
    with shading as indicated by the margin markings.

 7. Add to end of P938, L31434 (2nd fseek() EFBIG error):
        A SIGXFSZ signal shall also be sent to the thread.
    with XSI shading.

 8. Add to end of P940, L31521 (2nd fsetpos() EFBIG error):
        A SIGXFSZ signal shall also be sent to the thread.
    with XSI shading.

 9. Add a 3rd EFBIG error after P961, L32202:
        [EFBIG] The <italic>length</italic> argument exceeds the file
                size limit of the process.  A SIGXFSZ signal shall also
                be sent to the thread.
    with XSI shading in the ftruncate() errors section.

10. Change:
        "In addition to the errors returned by the lio_listio()
        function, if"
    on P1222, L40349 to:
        "If"
    in the lio_listio() ERRORS section.

11. Change:
        "The error codes that can be set are the same as would be set
        by a read() or write() function,"
    on P1222, L40355-40356 to:
        "The error codes that can be set are the same as would be set
        if the I/O operation had been initiated by an aio_read() or
        aio_write() function,"
    in the lio_listio() ERRORS section.

12. Delete the ECANCELED error condition on P1223, L40358-40359 in the
    lio_listio() ERRORS section.  (This is covered by the ECANCELED
    errors in the aio_read() and aio_write() ERRORS sections.)


13. Delete the EFBIG error condition on P1223, L40360-40363 in the
    lio_listio() ERRORS section.  (This is covered by the EFBIG error
    in the aio_write() ERRORS section.)

14. Delete the EOVERFLOW error condition on P1223, L40365-40368 in the
    lio_listio() ERRORS section.  (This is covered by the EOVERFLOW
    error in the aio_read() ERRORS section.)

15. Add a 2nd EFBIG error after P1412, L46279:
        [EFBIG] The value of <italic>offset</italic>+<italic>len</italic>
                exceeds the file size limit of the process.  A
                SIGXFSZ signal shall also be sent to the thread.
    with XSI shading in the posix_fallocate() errors section.

16. Add a new paragraph after P1485, L48109:
        For an active trace stream with log, if the value of the
        <italic>log-max-size</italic> attribute associated with the
        trace stream is larger than the soft file size limit of the
        process and a trace flush operation attempts to create a file
        larger than the file size limit, data up to the file size limit
        shall be flushed, the request shall fail, and the
        implementation shall generate the SIGXFSZ signal for the
        thread.
    with TRL and XSI shading in the posix_trace_create() page
    DESCRIPTION section.

17. Add a 2nd EFBIG error after P1486, L48158:
        [EFBIG] The trace log file has attempted to exceed the file
                size limit of the process.  A SIGXFSZ signal shall also
                be sent to the thread.
    with TRL and XSI shading in the posix_trace_flush() and
    posix_trace_shutdown() shall fail errors section on the
    posix_trace_create() page.

18. Add a 2nd EFBIG error after P2136, L67582:
        [EFBIG] The <italic>length</italic> argument exceeds the file
                size limit of the process.  A SIGFSZ signal shall also
                be sent to the thread.
    with XSI shading in the truncate() errors section.

19. Split P2265, L71232-71234... from:
                [EFBIG] An attempt was made to write a file that exceeds
                        the implementation-defined maximum file size
         XSI            or the file size limit of the process,
                        and there was no room for any bytes to be
                        written.
    to:
                [EFBIG] An attempt was made to write a file that exceeds
                        the implementation-defined maximum file size
                        and there was no room for any bytes to be
                        written.

         XSI    [EFBIG] An attempt was made to write a file that exceeds
         XSI            the file size limit of the process and there was
         XSI            no room for any bytes to be written.  A SIGXFSZ
         XSI            signal shall also be sent to the thread.
    with shading as indicated by the margin markings.


(0003529)
faizan (reporter)
2017-01-05 08:12

As per the discussion dated 16 Sep 2010 http://austingroupbugs.net/ [^] this bug need to tagged as TC1 - 2008.

-----------------------------------
XSHbug2 ERN 238

Already entered into mantis as an interpretation.
It should be tagged as a TC1-2008 candidate.
-----------------------------------

I expect that this interpretation should be applied only for 2008 standard and above. I see that none of the documentation have been updated so far. Also
recently we noticed that the test suite version VSX4.7.11 has been modified to comply with the above text for all the standard versions, instead of applying these changes for standard 2008 and above.

Need some clarification on implementing this interpretation and changes done to standards test suites.
(0003530)
geoffclare (manager)
2017-01-05 10:15

I have added a tc3-2008 tag. (Adding a tc1-2008 tag would no longer be appropriate as TC1 is now in the past.)

The description of RLIMIT_FSIZE on the getrlimit() page in all versions of the standard clearly requires SIGXFSZ to be generated if a write operation would cause the limit to be exceeded, so I would not have expected there to be any problem with the test suite checking that the signal is generated for write operations performed via stdio functions. Anyone failing the updated tests should contact The Open Group through the appropriate test suite support channel.
(0003532)
faizan (reporter)
2017-01-05 11:20

The changes described in "Desired Action" and all the changes (1 to 19) listed under notes for "Interpretation response" are not reflected in 2008/2013 standards documentation. I am referring online publication of standard documentation.
Example link http://pubs.opengroup.org/onlinepubs/9699919799/functions/fputc.html [^]
(0003533)
geoffclare (manager)
2017-01-05 11:52

The tc3-2008 tag means that the changes listed in Note: 0000547 will be applied in a TC3 if we decide to do one, otherwise they will be applied in Issue 8.

- Issue History
Date Modified Username Field Change
2010-09-13 14:04 geoffclare New Issue
2010-09-13 14:04 geoffclare Status New => Under Review
2010-09-13 14:04 geoffclare Assigned To => ajosey
2010-09-13 14:04 geoffclare Name => Martin Sebor
2010-09-13 14:04 geoffclare User Reference => fputc
2010-09-13 14:04 geoffclare Section => fputc
2010-09-13 14:04 geoffclare Page Number => 425
2010-09-13 14:04 geoffclare Line Number => 13958
2010-09-13 14:04 geoffclare Interp Status => ---
2010-09-13 14:05 geoffclare Note Added: 0000546
2010-09-13 14:09 geoffclare Note Added: 0000547
2010-09-13 14:11 geoffclare Interp Status --- => Pending
2010-09-13 14:11 geoffclare Final Accepted Text => Note: 0000547
2010-09-13 14:11 geoffclare Status Under Review => Interpretation Required
2010-09-13 14:11 geoffclare Resolution Open => Accepted As Marked
2010-09-13 14:12 geoffclare Note Edited: 0000547
2010-09-17 09:07 ajosey Interp Status Pending => Proposed
2010-11-11 17:26 ajosey Interp Status Proposed => Approved
2017-01-05 08:12 faizan Note Added: 0003529
2017-01-05 09:53 geoffclare Tag Attached: tc3-2008
2017-01-05 10:15 geoffclare Note Added: 0003530
2017-01-05 11:20 faizan Note Added: 0003532
2017-01-05 11:52 geoffclare Note Added: 0003533
2019-10-16 13:40 geoffclare Status Interpretation Required => Applied


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