View Issue Details

IDProjectCategoryView StatusLast Update
00019771003.1(2024)/Issue8System Interfacespublic2026-05-14 15:40
Reportercollinfunk Assigned To 
PrioritynormalSeverityObjectionTypeError
Status Interpretation RequiredResolutionAccepted As Marked 
NameCollin Funk
OrganizationGNU
User Reference
Sectionposix_spawn_file_actions_addclose, posix_spawn_file_actions_adddup2
Page Number1592-1596
Line Number53537-3542, 53659-53661
Interp Status---
Final Accepted Text
Summary0001977: posix_spawn_file_actions_addopen and posix_spawn_file_actions_adddup2 contridiction with respect to OPEN_MAX.
DescriptionThe ERRORS section for posix_spawn_file_actions_addopen states that it should fail with errno set to EBADF if "The value specified by fildes is negative or greater than or equal to {OPEN_MAX}." It then goes on to state that "It shall not be considered an error for the fildes argument passed to these functions to specify a file descriptor for which the specified operation could not be performed at the time of the call. Any such error shall be detected when the associated file actions object is later used during a posix_spawn() or posix_spawnp() operation." The same text is used for posix_spawn_file_actions_adddup2.

On systems where the open file descriptor limit can be changed and OPEN_MAX returns the limit given by RLIMIT_NOFILE, this text is contradictory. The first quoted text suggests that increasing RLIMIT_NOFILE after posix_spawn_file_actions_addopen, but before posix_spawn, is not allowed. The second quoted text suggests that it is allowed.

The description of https://austingroupbugs.net/view.php?id=418 only mentions the second quoted text for posix_spawn_file_actions_addclose. However, at some point it seems to have changed to "these functions". Therefore, I think it was probably the intention to make this change.
Desired ActionRemove:

    The posix_spawn_file_actions_addopen() function shall fail if:

    [EBADF]
        The value specified by fildes is negative or greater than or equal to {OPEN_MAX}.

    The posix_spawn_file_actions_addclose() function shall fail if:

    [EBADF]
        The value specified by fildes is negative.

Change:

    These functions shall fail if:

To:

    These functions shall fail if:

    [EBADF]
        The value specified by fildes is negative.

Change:

    The posix_spawn_file_actions_adddup2() function shall fail if:

    [EBADF]
        The value specified by fildes or newfildes is negative or greater than or equal to {OPEN_MAX}.

To:

    The posix_spawn_file_actions_adddup2() function shall fail if:

    [EBADF]
        The value specified by fildes is negative.
Tagstc1-2024

Relationships

related to 0000418 Closedajosey 1003.1(2008)/Issue 7 posix_spawn_file_actions_addclose() should not check against OPEN_MAX 

Activities

nick

2026-05-14 15:38

manager   bugnote:0007427

Last edited: 2026-05-14 15:39

Interpretation response:
------------------------
The standard states that these functions must fail if the argument exceeds OPEN_MAX, and conforming implementations must conform to this. However, concerns have been raised about this which are being referred to the sponsor.

Rationale:
----------
See Description.

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

On pages 1592-1593, change the ERRORS clause, lines 53537-53549 to:
    

    These functions shall fail if:
        [EBADF] The value specified by fildes is negative.
        [ENOMEM] Insufficient memory exists to add to the spawn file actions object
    These functions may fail if:
        [EBADF] The value specified by fildes is greater than or equal to {OPEN_MAX}
        [EINVAL] The value specified by file_actions is invalid.

It shall not be considered an error for the fildes argument passed to these functions to specify a file descriptor for which the specified operation could not be performed at the time of the call. Any such error shall be detected when the associated file actions object is later used during a posix_spawn( ) or posix_spawnp( ) operation.


On page 1596, section posix_spawn_file_actions_adddup2 ERRORS, at line 53660-53661, delete

or greater than or equal to {OPEN_MAX}


After line 53663 add

 [EBADF] The value specified by fildes is greater than or equal to {OPEN_MAX}
 

Issue History

Date Modified Username Field Change
2026-03-26 05:23 collinfunk New Issue
2026-05-14 15:12 nick Relationship added related to 0000418
2026-05-14 15:38 nick Status New => Interpretation Required
2026-05-14 15:38 nick Resolution Open => Accepted As Marked
2026-05-14 15:38 nick Interp Status => ---
2026-05-14 15:38 nick Note Added: 0007427
2026-05-14 15:39 nick Note Edited: 0007427
2026-05-14 15:40 nick Tag Attached: tc1-2024