A NOTE has been added to this issue. 
====================================================================== 
https://austingroupbugs.net/view.php?id=1798 
====================================================================== 
Reported By:                eblake
Assigned To:                
====================================================================== 
Project:                    Issue 8 drafts
Issue ID:                   1798
Category:                   System Interfaces
Type:                       Clarification Requested
Severity:                   Objection
Priority:                   normal
Status:                     New
Name:                       Eric Blake 
Organization:               Red Hat 
User Reference:             ebb.posix_getdents 
Section:                    XSH posix_getdents 
Page Number:                1567 
Line Number:                52609 
Final Accepted Text:         
====================================================================== 
Date Submitted:             2024-01-22 15:13 UTC
Last Modified:              2024-02-29 17:27 UTC
====================================================================== 
Summary:                    Must posix_getdents remember file offsets across
exec?
====================================================================== 

---------------------------------------------------------------------- 
 (0006695) geoffclare (manager) - 2024-02-29 17:27
 https://austingroupbugs.net/view.php?id=1798#c6695 
---------------------------------------------------------------------- 
Proposed interpretation (review timer to start after approval of issue 8)
...

Interpretation response
------------------------
The standard states that the posix_getdents() function starts reading at
the current file offset in the open file description associated with
fildes, and conforming implementations must conform to this. However,
concerns have been raised about this which are being referred to the
sponsor.

Rationale:
-------------
Elsewhere the standard makes allowances for implementations where directory
streams are not implemented using a file descriptor, but this was not
extended to the new posix_getdents() function when it was added.

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

After page 920 line 31407 section fdopendir(), add a new paragraph:
<blockquote>If the file descriptor specified by <i>fd</i> is associated
with an open file description on which <i>posix_getdents</i>() has
previously been used, the behavior is unspecified.</blockquote>

After page 1567 line 52616 section posix_getdents():
<blockquote>The behavior is unspecified if <i>lseek</i>() is used to set
the file offset to a value other than zero or a value returned by a
previous call to <i>lseek</i>() on the same open file
description.</blockquote>
add these sentences:
<blockquote>The behavior is unspecified if calls to <i>posix_getdents</i>()
are made on different file descriptors that refer to the same open file
description (for example, before and after a file descriptor is inherited
across <i>fork</i>() or the <i>exec</i> family of functions, or is
duplicated using <i>dup</i>() or <i>fcntl</i>()), unless <i>lseek</i>() is
used to set the file offset to zero in between the calls to
<i>posix_getdents</i>(). A single exception to this condition is that after
a call to <i>fork</i>(), either the parent or child (but not both) can
continue processing the directory using <i>posix_getdents</i>(); if both
the parent and child processes use the function, the result is unspecified.
Likewise, the behavior is unspecified if in between two calls to
<i>posix_getdents</i>() on one file descriptor, the file offset is altered
by a call made on a different file descriptor that refers to the same open
file description and the new offset is not zero.</blockquote>

After page 1571 line 52771 section posix_getdents(), add a new paragraph to
RATIONALE:
<blockquote>The restrictions on the use of different file descriptors that
refer to the same open file description are needed in order to enable
implementations where directory streams are not implemented using a file
descriptor to maintain some internal state related to a particular file
descriptor.</blockquote>

At page 1858 line 61319 section readdir(), change:
    <blockquote>the result is undefined.</blockquote>
to:
    <blockquote>the result is unspecified.</blockquote> 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2024-01-22 15:13 eblake         New Issue                                    
2024-01-22 15:13 eblake         Name                      => Eric Blake      
2024-01-22 15:13 eblake         Organization              => Red Hat         
2024-01-22 15:13 eblake         User Reference            => ebb.posix_getdents
2024-01-22 15:13 eblake         Section                   => XSH posix_getdents
2024-01-22 15:13 eblake         Page Number               => 1567            
2024-01-22 15:13 eblake         Line Number               => 52609           
2024-01-22 15:30 eblake         Note Added: 0006632                          
2024-01-22 15:39 eblake         Note Edited: 0006632                         
2024-02-16 10:18 corinna_vinschenNote Added: 0006658                          
2024-02-29 17:27 geoffclare     Note Added: 0006695                          
======================================================================


  • [Issue 8 dra... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [Issue ... Austin Group Bug Tracker via austin-group-l at The Open Group
      • Re:... Eric Blake via austin-group-l at The Open Group
    • [Issue ... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [Issue ... Austin Group Bug Tracker via austin-group-l at The Open Group
      • Re:... Corinna Vinschen via austin-group-l at The Open Group
        • ... Corinna Vinschen via austin-group-l at The Open Group
    • [Issue ... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [Issue ... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [Issue ... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [Issue ... Austin Group Bug Tracker via austin-group-l at The Open Group
      • Re:... Steffen Nurpmeso via austin-group-l at The Open Group
    • [Issue ... Austin Group Bug Tracker via austin-group-l at The Open Group
      • Re:... Steffen Nurpmeso via austin-group-l at The Open Group
    • [Issue ... Austin Group Bug Tracker via austin-group-l at The Open Group

Reply via email to