Email List: Xaustin-group-lX
[All Lists]

XCU XSH #238 (fputc) proposed resolution

To: austin-group-l@xxxxxxxxxxxxx
Subject: XCU XSH #238 (fputc) proposed resolution
From: Don Cragun <don.cragun@xxxxxxx>
Date: Thu, 29 May 2008 15:23:17 -0700 (PDT)
        Here is my proposed resolution for XSH ERN #238.
        This completes my second of two action items from the May 1,
2008 conference call.

        Cheers,
        Don

 _____________________________________________________________________________
 EDITORIAL                                      Enhancement Request Number 238
 sebor:xxxxxxxxxxxxx                            Defect in XSH fputc (rdvk#  5)
 {fputc}                                 Wed, 30 Apr 2008 21:01:30 +0100 (BST)
 _____________________________________________________________________________
 Accept_____    Accept as marked below__X__     Duplicate_____     Reject_____
 Rationale for rejected or partial changes:

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

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 explictly 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, L20983:
        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.
    with shading as indicated by the margin markings.

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

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

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

 4. Split P910, L30422-30423 (1st fputwc() EFBIG error) from:
         CX     [EFBIG] An attempt was made to write to a file that
         CX             exceeds the maxiumum 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 maxiumum 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.

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

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

 7. 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.

 8. Change:
        "In addition to the errors returned by the lio_listio()
        function,"
    on P1222, L40349 to:
        "In addition to the errors returned by the aio_read() and
        aio_write() functions,"
    in the lio_listio() ERRORS section.

 9. 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
        by an aio_read() or aio_write() function,"
    in the lio_listio() ERRORS section.

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

11. 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.)

12. 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.

13. 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.

14. 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.

15. 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.

16. 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.

This should be submitted as an interpretation request and resolved as
"the standard is unclear on this issue", "concerns have been forwarded
to the sponsor" and should be fixed in TC1 of the revision.

 _____________________________________________________________________________
 Page: 425  Line: 13958  Section: fputc


 Problem:

 Edition of Specification (Year): 2004

 Defect code :  2. Omission

 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.

 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.


 _____________________________________________________________________________


<Prev in Thread] Current Thread [Next in Thread>