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
0000146 [1003.1(2008)/Issue 7] System Interfaces Objection Error 2009-09-07 19:34 2013-04-16 13:06
Reporter eblake View Status public  
Assigned To ajosey
Priority normal Resolution Accepted As Marked  
Status Closed  
Name Eric Blake
Organization N/A
User Reference ebb.symlink
Section symlink
Page Number 2058
Line Number 56095
Interp Status Approved
Final Accepted Text Note: 0000253
Summary 0000146: symlinkat failure cases
Description The standard is contradictory for symlink (and symlinkat). By a strict reading, symlink can never succeed, since EEXIST failure is required if path2 exists, while ENOENT is required if a component of path2 does not exist. In reality, the last component of path2 must not exist for a symlink to be created, while all earlier components must exist.

Meanwhile, the standard does not require failure for symlink("text","link/"). This seems like an oversight compared to the other improvements made in POSIX 2008 dealing with trailing slashes. Linux fails with ENOENT, Solaris 10 with ENOTDIR.
Desired Action Replace line 65095:

[ENOENT] A component of path2 does not name an existing file or path2 is an empty string.

with:

[ENOENT] A component of the path prefix of path2 does not name an existing file or path2 is an empty string.

After line 65102, add a new row:

[ENOENT] or [ENOTDIR] The path2 argument does not name an existing file or symbolic link, contains at least one non-<slash> character, and ends with one or more trailing <slash> characters.

Tags tc1-2008
Attached Files

- Relationships
related to 0000433Closedajosey 2008-TC1 Interactions between XSH/TC1/D1/0093 and 0092, 0101 
related to 0000435Closedajosey 2008-TC1 Missing "empty string" text in XSH/TC1/D1/0174 
related to 0000436Closedajosey 2008-TC1 Missing "empty string" text in XSH/TC1/D1/0312 
related to 0000475Closedajosey 2008-TC1 Missing "empty string" text in XSH/TC1/D2/0043 
related to 0000822Closed 1003.1(2013)/Issue7+TC1 missing symlink [ENOENT] or [ENOTDIR] error 

-  Notes
(0000219)
geoffclare (manager)
2009-09-08 09:33
edited on: 2009-09-08 09:34

The trailing-slash-when-creating-non-directory issue also applies to:

bind()
fattach()
fopen()
freopen()
mkfifo() and mkfifoat()
mknod() and mknodat()
open() and openat()

(Plus creat(), but that page refers to the open() page for errors.)

The issue also applies to link() but in a more complicated way - see
my note in 0000147).

(0000220)
eblake (manager)
2009-09-08 12:54

Indeed; open("missing/",O_CREAT|O_RDONLY) is not required to fail.

In addition to the trailing-slash-when-creating-non-directory, I noticed:

open("missing/",O_RDONLY) is required to fail with both ENOTDIR and ENOENT

open("dir/",O_CREAT|O_RDONLY) is not required to fail. On one hand, open("dir/",O_RDONLY) should succeed, and O_CREAT is ignored for existing files; on the other, O_CREAT is never useful with a trailing slash for any other scenario, so requiring failure might make sense.

Also, I noticed that Solaris 10 has mkfifoat(".",...) fail with EINVAL, rather than EEXIST; so while sweeping for trailing slash behavior, we may also need to address "." and ".." behavior.
(0000253)
geoffclare (manager)
2009-10-09 14:18
edited on: 2009-10-15 15:28

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

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

After line 65056, add a new paragraph:

    If path2 names a symbolic link, symlink() shall fail and set
    errno to [EEXIST].

At line 65087 (EEXIST) change:

    existing file or symbolic link

to:

    existing file

At line 65095 change:

    [ENOENT] A component of path2 does not name an existing file

to:

    [ENOENT] A component of the path prefix of path2 does not name an
             existing file

After line 65096, add:

    [ENOENT] or [ENOTDIR]
             The path2 argument contains at least one non-<slash>
             character and ends with one or more trailing <slash>
             characters.  If path2 names an existing file, an
             [ENOENT] error shall not occur.

At page 482 line 16419 section 2.3, replace the ENOTDIR description
with:

    [ENOTDIR]
        Not a directory. A component of the specified pathname exists,
        but it is not a directory, when a directory was expected; or
        an attempt was made to create a non-directory file, and the
        specified pathname contains at least one non-<slash> character
        and ends with one or more trailing <slash> characters.

After page 616 line 21046 section bind, add a new paragraph:

    If the address family of the socket is AF_UNIX and the pathname in
    address names a symbolic link, bind() shall fail and set errno to
    [EADDRINUSE].

At page 617 line 21086 section bind, change:

    [ENOENT] A component of the pathname does not name an existing file

to:

    [ENOENT] A component of the path prefix of the pathname in address
             does not name an existing file

After page 617 line 21087 section bind, add:

    [ENOENT] or [ENOTDIR]
             The pathname in address contains at least one non-<slash>
             character and ends with one or more trailing <slash>
             characters.  If the pathname names an existing file, an
             [ENOENT] error shall not occur.

At page 795 line 26555 section fattach, delete:

    and the last pathname component names an existing file
    that is neither a directory nor a symbolic link to a directory

At page 878 line 29180 section fopen, and
at page 924 line 30923 section freopen, change:

    [ENOENT] A component of filename does not name an existing file or
             filename is an empty string.

to:

    [ENOENT] The mode string begins with 'r' and a component of
             filename does not name an existing file, or mode begins
             with 'w' or 'a' and a component of the path prefix of
             filename does not name an existing file, or filename is
             an empty string.

After page 878 line 29181 section fopen, and
after page 924 line 30924 section freopen, add:

    [ENOENT] or [ENOTDIR]
             The filename argument contains at least one non-<slash>
             character and ends with one or more trailing <slash>
             characters.  If filename names an existing file, an
             [ENOENT] error shall not occur.

At page 1296 line 42537 section mkfifo, and
at page 1299 line 42689 section mknod, change:

     [ENOENT] A component of the path prefix specified by path does
              not name an existing directory

to:

     [ENOENT] A component of the path prefix of path does not name
              an existing file

After page 1296 line 42538 section mkfifo, and
after page 1299 line 42690 section mknod, add:

    [ENOENT] or [ENOTDIR]
             The path argument contains at least one non-<slash>
             character and ends with one or more trailing <slash>
             characters.  If path names an existing file, an
             [ENOENT] error shall not occur.

At page 1382 line 45322 section open, change:

    [ENOENT] O_CREAT is not set and the named file does not exist; or
             O_CREAT is set and either the path prefix does not exist
             or the path argument points to an empty string.

to:

    [ENOENT] O_CREAT is not set and a component of path does not name
             an existing file, or O_CREAT is set and a component of
             the path prefix of path does not name an existing file,
             or path points to an empty string.

After page 1382 line 45324 section open, add:

    [ENOENT] or [ENOTDIR]
             O_CREAT is set, and the path argument contains at least
             one non-<slash> character and ends with one or more
             trailing <slash> characters.  If path names an existing
             file, an [ENOENT] error shall not occur.




- Issue History
Date Modified Username Field Change
2009-09-07 19:34 eblake New Issue
2009-09-07 19:34 eblake Status New => Under Review
2009-09-07 19:34 eblake Assigned To => ajosey
2009-09-07 19:34 eblake Name => Eric Blake
2009-09-07 19:34 eblake Organization => N/A
2009-09-07 19:34 eblake User Reference => ebb.symlink
2009-09-07 19:34 eblake Section => symlink
2009-09-07 19:34 eblake Page Number => 2058
2009-09-07 19:34 eblake Line Number => 56095
2009-09-08 09:33 geoffclare Note Added: 0000219
2009-09-08 09:34 geoffclare Note Edited: 0000219
2009-09-08 12:54 eblake Note Added: 0000220
2009-10-09 14:18 geoffclare Note Added: 0000253
2009-10-15 15:28 geoffclare Note Edited: 0000253
2009-10-15 15:29 geoffclare Interp Status => Pending
2009-10-15 15:29 geoffclare Final Accepted Text => Note: 0000253
2009-10-15 15:29 geoffclare Status Under Review => Interpretation Required
2009-10-15 15:29 geoffclare Resolution Open => Accepted As Marked
2009-11-07 07:32 ajosey Interp Status Pending => Proposed
2009-12-07 16:56 ajosey Interp Status Proposed => Approved
2010-09-21 11:17 geoffclare Tag Attached: tc1-2008
2011-05-13 15:18 eblake Relationship added related to 0000433
2011-05-13 15:25 eblake Relationship added related to 0000435
2011-05-13 15:27 eblake Relationship added related to 0000436
2011-07-15 13:31 eblake Relationship added related to 0000475
2013-04-16 13:06 ajosey Status Interpretation Required => Closed
2014-03-13 12:54 eblake Relationship added related to 0000822


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