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
0000215 [1003.1(2008)/Issue 7] System Interfaces Objection Error 2010-01-26 17:04 2013-04-16 13:06
Reporter geoffclare View Status public  
Assigned To ajosey
Priority normal Resolution Accepted  
Status Closed  
Name Geoff Clare
Organization The Open Group
User Reference
Section pwrite
Page Number 2265-2267
Line Number 71229,71245,71251,71255,71277
Interp Status Approved
Final Accepted Text Note: 0000386
Summary 0000215: Inconsistencies in pwrite() and write() errors
Description The error conditions on the pwrite() page associated with pipes/FIFOs
and sockets are inconsistently specified between pwrite() and write(),
and between pwrite() and lseek().

* Line 71229 specifies EAGAIN when O_NONBLOCK flag is set and pwrite()
  or write() would block, regardless of the file type. This conflicts
  with line 71251 which allows EWOULDBLOCK as an alternative error
  for write() when the file descriptor refers to a socket. There is
  no equivalent "EAGAIN or EWOULDBLOCK" error specified for pwrite().

* EPIPE for a pipe/FIFO is specified for both pwrite() and write(),
  but EPIPE for a socket is only specified for write().

  for write().

* EINVAL for a negative offset is required for pwrite() on all file
  types, whereas for lseek() it is only required for regular files,
  block special files, and directories. (I.e. implementations are
  allowed to support lseek() to negative offsets on character
  special files.)

* ESPIPE for pwrite() is only specified for a pipe/FIFO but should
  also be specified for a socket (cf. lseek()).

When deciding how to correct these problems, a precedence issue
between the ESPIPE and other pwrite() errors needs to be
considered. Normally the standard does not specify precedence
between different error conditions - if this convention is
followed, then the full set of write() errors associated with
pipes, FIFOs and sockets should also be specified for pwrite(),
to allow those conditions to be detected before ESPIPE. However,
in practice it seems unlikely that any implementation of pwrite()
would get as far as detecting whether the write operation would
block, or is to a pipe/FIFO with no readers, or is to a socket
that has been shut down for writing etc., without having detected
the ESPIPE condition. The ESPIPE can be detected using only the
file type, whereas these other conditions require further
file-type-dependent information (i.e. they can only be detected
after the file type has been determined). Therefore the suggested
changes remove the existing pipe/FIFO/socket-related errors for
pwrite(), other than ESPIPE, instead of adding the missing ones.

In addition there are a couple of editorial problems that would be
worth addressing. Line 71230 refers to "the write() operation", but
the error applies to both write() and pwrite(); and, the pwrite()
"shall fail" block should be moved to before the "may fail" errors.
Desired Action
At line 71229 change

    [EAGAIN] The O_NONBLOCK flag is set for the file descriptor and
             the thread would be delayed in the write() operation.


    [EAGAIN] The file is neither a pipe, nor a FIFO, nor a socket,
             the O_NONBLOCK flag is set for the file descriptor, and
             the thread would be delayed in the write operation.

Move lines 71245-71247 (EPIPE on pipe/FIFO) to after line 71254

Before line 71250 insert

    The pwrite() function shall fail if:

    [EINVAL] The file is a regular file or block special file, and
             the offset argument is negative. The file pointer shall
             remain unchanged.

    [ESPIPE] The file is a pipe, FIFO or socket.

At line 71251 change

             The file descriptor is for a socket, is marked
             O_NONBLOCK, and write would block.


    [EAGAIN] The file is a pipe or FIFO, the O_NONBLOCK flag is set
             for the file descriptor, and the thread would be delayed
             in the write operation.

             The file is a socket, the O_NONBLOCK flag is set for the
             file descriptor, and the thread would be delayed in the
             write operation.

Delete lines 71275-71277 (the pwrite() "shall fail" errors).

Add a new paragraph to the end of RATIONALE (line 71388):

    This volume of POSIX.1-2008 intentionally does not specify any
    pwrite() errors related to pipes, FIFOs and sockets other than

Tags tc1-2008
Attached Files

- Relationships
related to 0000218Closedajosey Inconsistencies in pread() and read() errors 
related to 0000225Closedajosey ENXIO and 'may fail' 

-  Notes
geoffclare (manager)
2010-01-27 11:45

There are similar problems with the errors for pread(). I intend to
submit a separate bug for those after the group has decided which way
to go on the ESPIPE precedence issue.
msbrown (manager)
2010-02-11 16:59
edited on: 2010-03-04 16:29

Interpretation response
The standard states the current pwrite() and write() error conditions , and conforming implementations must conform to this. However, concerns have been raised about this which are being referred to the sponsor.

Notes to the Editor (not part of this interpretation):
Make change suggested by Submitter. This interpretation should be considered in tamdem with 0000218 .

- Issue History
Date Modified Username Field Change
2010-01-26 17:04 geoffclare New Issue
2010-01-26 17:04 geoffclare Status New => Under Review
2010-01-26 17:04 geoffclare Assigned To => ajosey
2010-01-26 17:04 geoffclare Name => Geoff Clare
2010-01-26 17:04 geoffclare Organization => The Open Group
2010-01-26 17:04 geoffclare Section => pwrite
2010-01-26 17:04 geoffclare Page Number => 2265-2267
2010-01-26 17:04 geoffclare Line Number => 71229,71245,71251,71255,71277
2010-01-26 17:04 geoffclare Interp Status => ---
2010-01-27 11:45 geoffclare Note Added: 0000382
2010-02-11 16:55 msbrown Status Under Review => Resolved
2010-02-11 16:55 msbrown Resolution Open => Accepted
2010-02-11 16:55 msbrown Desired Action Updated
2010-02-11 16:59 msbrown Interp Status --- => Pending
2010-02-11 16:59 msbrown Note Added: 0000386
2010-02-11 16:59 msbrown Status Resolved => Interpretation Required
2010-02-11 17:00 msbrown Final Accepted Text => Note: 0000386
2010-02-11 17:00 msbrown Note Edited: 0000386
2010-03-04 16:27 msbrown Relationship added related to 0000218
2010-03-04 16:29 msbrown Note Edited: 0000386
2010-03-25 15:46 msbrown Relationship added related to 0000225
2010-04-16 10:16 ajosey Interp Status Pending => Proposed
2010-05-28 14:03 ajosey Interp Status Proposed => Approved
2010-09-24 16:58 Don Cragun Tag Attached: tc1-2008
2013-04-16 13:06 ajosey Status Interpretation Required => Closed

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