Discussion:
[1003.1(2013)/Issue7+TC1 0000847]: open(O_CREAT), directories, and EISDIR
Austin Group Bug Tracker
2014-06-19 07:02:39 UTC
Permalink
The following issue has been SUBMITTED.
======================================================================
http://austingroupbugs.net/view.php?id=847
======================================================================
Reported By: rhansen
Assigned To:
======================================================================
Project: 1003.1(2013)/Issue7+TC1
Issue ID: 847
Category: System Interfaces
Type: Error
Severity: Editorial
Priority: normal
Status: New
Name: Richard Hansen
Organization: BBN
User Reference:
Section: open, openat
Page Number: 1394
Line Number: 46098
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2014-06-19 07:02 UTC
Last Modified: 2014-06-19 07:02 UTC
======================================================================
Summary: open(O_CREAT), directories, and EISDIR
Description:
open("/path/to/existing/directory", O_CREAT) should fail with EISDIR, but
implementations should be allowed to support creating and opening a
directory via open("/path/to/directory", O_CREAT|O_DIRECTORY) as an
extension

see discussion at
http://thread.gmane.org/gmane.comp.standards.posix.austin.general/9503
and
http://thread.gmane.org/gmane.comp.standards.posix.austin.general/9451
Desired Action:
On page 1391 at line 45975 (open() description, O_CREAT), change:
<blockquote>Otherwise, the file shall be created</blockquote>
to:
<blockquote>Otherwise, if O_DIRECTORY is not set the file shall be created
as a regular file</blockquote>
On page 1393 after line 46051 (open() description), insert a new
paragraph:
<blockquote>If O_CREAT and O_DIRECTORY are set and the requested access
mode is neither O_WRONLY nor O_RDWR, the result is
unspecified.</blockquote>
On page 1394 at line 46098 (open() errors, EISDIR), change:
<blockquote>The named file is a directory and oflag includes O_WRONLY or
O_RDWR.</blockquote>
to:
<blockquote>The named file is a directory and oflag includes O_WRONLY or
O_RDWR, or includes O_CREAT without O_DIRECTORY.</blockquote>

(wording courtesy of Geoff)
======================================================================

Issue History
Date Modified Username Field Change
======================================================================
2014-06-19 07:02 rhansen New Issue
2014-06-19 07:02 rhansen Name => Richard Hansen
2014-06-19 07:02 rhansen Organization => BBN
2014-06-19 07:02 rhansen Section => open, openat
2014-06-19 07:02 rhansen Page Number => 1394
2014-06-19 07:02 rhansen Line Number => 46098
======================================================================
Austin Group Bug Tracker
2014-06-19 16:40:36 UTC
Permalink
A NOTE has been added to this issue.
======================================================================
http://www.austingroupbugs.net/view.php?id=847
======================================================================
Reported By: rhansen
Assigned To:
======================================================================
Project: 1003.1(2013)/Issue7+TC1
Issue ID: 847
Category: System Interfaces
Type: Error
Severity: Editorial
Priority: normal
Status: New
Name: Richard Hansen
Organization: BBN
User Reference:
Section: open, openat
Page Number: 1394
Line Number: 46098
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2014-06-19 07:02 UTC
Last Modified: 2014-06-19 16:40 UTC
======================================================================
Summary: open(O_CREAT), directories, and EISDIR
======================================================================

----------------------------------------------------------------------
(0002268) rhansen (reporter) - 2014-06-19 16:40
http://www.austingroupbugs.net/view.php?id=847#c2268
----------------------------------------------------------------------
On page 238 line 7885 change:<blockquote>O_DIRECTORY Fail if not a
directory.<blockquote>to:<blockquote>O_DIRECTORY Fail If path resolves to a
non-directory file.<blockquote>On page 1391 at line 45975 (open()
description, O_CREAT), change:<blockquote>Otherwise, the file shall be
created<blockquote>to:<blockquote>Otherwise, if O_DIRECTORY is not set the
file shall be created as a regular file<blockquote>On page 1393 after line
46051 (open() description), insert a new paragraph:<blockquote>If O_CREAT
and O_DIRECTORY are set and the requested access mode is neither O_WRONLY
nor O_RDWR, the result is unspecified.<blockquote>On page 1394 at line
46098 (open() errors, EISDIR), change:<blockquote>The named file is a
directory and oflag includes O_WRONLY or
O_RDWR.<blockquote>to:<blockquote>The named file is a directory and oflag
includes O_WRONLY or O_RDWR, or includes O_CREAT without
O_DIRECTORY.<blockquote>

Issue History
Date Modified Username Field Change
======================================================================
2014-06-19 07:02 rhansen New Issue
2014-06-19 07:02 rhansen Name => Richard Hansen
2014-06-19 07:02 rhansen Organization => BBN
2014-06-19 07:02 rhansen Section => open, openat
2014-06-19 07:02 rhansen Page Number => 1394
2014-06-19 07:02 rhansen Line Number => 46098
2014-06-19 16:40 rhansen Note Added: 0002268
======================================================================
Geoff Clare
2014-06-20 09:44:14 UTC
Permalink
Post by Austin Group Bug Tracker
----------------------------------------------------------------------
(0002268) rhansen (reporter) - 2014-06-19 16:40
http://www.austingroupbugs.net/view.php?id=847#c2268
----------------------------------------------------------------------
On page 238 line 7885 change:<blockquote>O_DIRECTORY Fail if not a
directory.<blockquote>to:<blockquote>O_DIRECTORY Fail If path resolves to a
non-directory file.
This wording isn't suitable for the <fcntl.h> page because "path" is
a broken reference. It needs to be worded more like the O_CREAT
description on that page ("Create file if it does not exist"), e.g.:

O_DIRECTORY Fail if file is a non-directory file.
--
Geoff Clare <g.clare-7882/***@public.gmane.org>
The Open Group, Apex Plaza, Forbury Road, Reading, RG1 1AX, England
Joerg Schilling
2014-06-20 10:05:45 UTC
Permalink
Post by Geoff Clare
Post by Austin Group Bug Tracker
----------------------------------------------------------------------
(0002268) rhansen (reporter) - 2014-06-19 16:40
http://www.austingroupbugs.net/view.php?id=847#c2268
----------------------------------------------------------------------
On page 238 line 7885 change:<blockquote>O_DIRECTORY Fail if not a
directory.<blockquote>to:<blockquote>O_DIRECTORY Fail If path resolves to a
non-directory file.
This wording isn't suitable for the <fcntl.h> page because "path" is
a broken reference. It needs to be worded more like the O_CREAT
O_DIRECTORY Fail if file is a non-directory file.
This text does not match the intended requirements because a file is an object
that previously exists.

But O_DIRECTORY was a typo. It should have been EISDIR.

If you really like to avoid path here, I propose:

EISDIR Fail if the operation tries to access an existing non-directory file.



Jörg
--
EMail:joerg-3Qm2Liu6aU2sY6utFDHCwYAplN+***@public.gmane.org (home) Jörg Schilling D-13353 Berlin
js-CFLBMwTPW48UNGrzBIF7/***@public.gmane.org (uni)
joerg.schilling-8LS2qeF34IpklNlQbfROjRvVK+***@public.gmane.org (work) Blog: http://schily.blogspot.com/
URL: http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily
Geoff Clare
2014-06-20 10:49:15 UTC
Permalink
Post by Joerg Schilling
Post by Geoff Clare
Post by Austin Group Bug Tracker
----------------------------------------------------------------------
(0002268) rhansen (reporter) - 2014-06-19 16:40
http://www.austingroupbugs.net/view.php?id=847#c2268
----------------------------------------------------------------------
On page 238 line 7885 change:<blockquote>O_DIRECTORY Fail if not a
directory.<blockquote>to:<blockquote>O_DIRECTORY Fail If path resolves to a
non-directory file.
This wording isn't suitable for the <fcntl.h> page because "path" is
a broken reference. It needs to be worded more like the O_CREAT
O_DIRECTORY Fail if file is a non-directory file.
This text does not match the intended requirements because a file is an object
that previously exists.
But O_DIRECTORY was a typo. It should have been EISDIR.
EISDIR Fail if the operation tries to access an existing non-directory file.
Sorry, but you're not making any sense.

Page 238 line 7885 is the <fcntl.h> description of O_DIRECTORY. It is
currently:

O_DIRECTORY Fail if not a directory.

Richard's comment proposed changing this to:

O_DIRECTORY Fail if path resolves to a non-directory file.

which is almost exactly what the O_DIRECTORY description on the open()
page says (without the errno value).

I am saying that it should instead be changed to:

O_DIRECTORY Fail if file is a non-directory file.

which amounts to the same thing but is more fitting for <fcntl.h>
--
Geoff Clare <g.clare-7882/***@public.gmane.org>
The Open Group, Apex Plaza, Forbury Road, Reading, RG1 1AX, England
Joerg Schilling
2014-06-20 11:17:21 UTC
Permalink
Post by Geoff Clare
Post by Joerg Schilling
But O_DIRECTORY was a typo. It should have been EISDIR.
EISDIR Fail if the operation tries to access an existing non-directory file.
Sorry, but you're not making any sense.
Page 238 line 7885 is the <fcntl.h> description of O_DIRECTORY. It is
O_DIRECTORY Fail if not a directory.
OK, it seems that I confused things.
Post by Geoff Clare
O_DIRECTORY Fail if path resolves to a non-directory file.
which is almost exactly what the O_DIRECTORY description on the open()
page says (without the errno value).
O_DIRECTORY Fail if file is a non-directory file.
which amounts to the same thing but is more fitting for <fcntl.h>
This wording does not include the situation where no file exists and it would
in special not fit the case where open() should create a directory.

Jörg
--
EMail:joerg-3Qm2Liu6aU2sY6utFDHCwYAplN+***@public.gmane.org (home) Jörg Schilling D-13353 Berlin
js-CFLBMwTPW48UNGrzBIF7/***@public.gmane.org (uni)
joerg.schilling-8LS2qeF34IpklNlQbfROjRvVK+***@public.gmane.org (work) Blog: http://schily.blogspot.com/
URL: http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily
Richard Hansen
2014-06-23 17:13:06 UTC
Permalink
Post by Joerg Schilling
Post by Geoff Clare
O_DIRECTORY Fail if path resolves to a non-directory file.
which is almost exactly what the O_DIRECTORY description on the open()
page says (without the errno value).
O_DIRECTORY Fail if file is a non-directory file.
which amounts to the same thing but is more fitting for <fcntl.h>
Thanks Geoff -- I edited the comment to use your proposed wording.

Is it specified somewhere that the meaning of "a directory file" would
include symlinks to directories? That's one of the nice things about
the "path resolves" wording -- it's clear that a symlink to a directory
is OK.
Post by Joerg Schilling
This wording does not include the situation where no file exists
If O_CREAT is not set, ENOENT would cover that situation.
Post by Joerg Schilling
and it would
in special not fit the case where open() should create a directory.
I don't think it precludes directory creation via O_CREAT|O_DIRECTORY.
It only says to fail if the file exists ("file is a [...] file" implies
existence as one of the requirements for meeting the fail condition) and
is not a directory -- it does not say what should or should not happen
if the file doesn't exist.

Perhaps the following would be more clear:

O_DIRECTORY If file exists, fail if file is not a directory.

-Richard
Geoff Clare
2014-06-24 10:32:38 UTC
Permalink
Post by Richard Hansen
Post by Joerg Schilling
Post by Geoff Clare
O_DIRECTORY Fail if path resolves to a non-directory file.
which is almost exactly what the O_DIRECTORY description on the open()
page says (without the errno value).
O_DIRECTORY Fail if file is a non-directory file.
which amounts to the same thing but is more fitting for <fcntl.h>
Thanks Geoff -- I edited the comment to use your proposed wording.
Is it specified somewhere that the meaning of "a directory file" would
include symlinks to directories? That's one of the nice things about
the "path resolves" wording -- it's clear that a symlink to a directory
is OK.
Any reference to file being accessed via a pathname (e.g. "names a
<whatever> file" or "is a <whatever> file") necessarily implies
that pathname resolution is performed, since pathname resolution is
the mechanism by which pathnames identify files.

Saying that a pathname is resolved does not always imply that symbolic
links are followed. It depends on the description of the function doing
the resolution (see item 3 in XBD 4.12).
Post by Richard Hansen
Post by Joerg Schilling
This wording does not include the situation where no file exists
If O_CREAT is not set, ENOENT would cover that situation.
Post by Joerg Schilling
and it would
in special not fit the case where open() should create a directory.
I don't think it precludes directory creation via O_CREAT|O_DIRECTORY.
It only says to fail if the file exists ("file is a [...] file" implies
existence as one of the requirements for meeting the fail condition) and
is not a directory -- it does not say what should or should not happen
if the file doesn't exist.
I agree with your reasoning here.
Post by Richard Hansen
O_DIRECTORY If file exists, fail if file is not a directory.
If we want to make the existence condition explicit (although I don't
see the need), I would prefer to word it as:

O_DIRECTORY Fail if file exists and is not a directory.
--
Geoff Clare <g.clare-7882/***@public.gmane.org>
The Open Group, Apex Plaza, Forbury Road, Reading, RG1 1AX, England
Austin Group Bug Tracker
2014-06-26 15:14:36 UTC
Permalink
The following issue NEEDS AN INTERPRETATION.
======================================================================
http://austingroupbugs.net/view.php?id=847
======================================================================
Reported By: rhansen
Assigned To:
======================================================================
Project: 1003.1(2013)/Issue7+TC1
Issue ID: 847
Category: System Interfaces
Type: Error
Severity: Editorial
Priority: normal
Status: Interpretation Required
Name: Richard Hansen
Organization: BBN
User Reference:
Section: open, openat
Page Number: 1394
Line Number: 46098
Interp Status: ---
Final Accepted Text: See http://austingroupbugs.net/view.php?id=847#c2268

======================================================================
Date Submitted: 2014-06-19 07:02 UTC
Last Modified: 2014-06-26 15:14 UTC
======================================================================
Summary: open(O_CREAT), directories, and EISDIR
======================================================================

Issue History
Date Modified Username Field Change
======================================================================
2014-06-19 07:02 rhansen New Issue
2014-06-19 07:02 rhansen Name => Richard Hansen
2014-06-19 07:02 rhansen Organization => BBN
2014-06-19 07:02 rhansen Section => open, openat
2014-06-19 07:02 rhansen Page Number => 1394
2014-06-19 07:02 rhansen Line Number => 46098
2014-06-19 16:40 rhansen Note Added: 0002268
2014-06-19 16:41 rhansen Note Edited: 0002268
2014-06-23 16:43 rhansen Note Edited: 0002268
2014-06-26 15:13 rhansen Note Edited: 0002268
2014-06-26 15:14 nick Interp Status => ---
2014-06-26 15:14 nick Final Accepted Text => See
http://austingroupbugs.net/view.php?id=847#c2268
2014-06-26 15:14 nick Status New => Interpretation
Required
2014-06-26 15:14 nick Resolution Open => Accepted As
Marked
======================================================================
Austin Group Bug Tracker
2014-06-26 15:15:07 UTC
Permalink
The following issue has been UPDATED.
======================================================================
http://austingroupbugs.net/view.php?id=847
======================================================================
Reported By: rhansen
Assigned To:
======================================================================
Project: 1003.1(2013)/Issue7+TC1
Issue ID: 847
Category: System Interfaces
Type: Error
Severity: Editorial
Priority: normal
Status: Interpretation Required
Name: Richard Hansen
Organization: BBN
User Reference:
Section: open, openat
Page Number: 1394
Line Number: 46098
Interp Status: Pending
Final Accepted Text: See http://austingroupbugs.net/view.php?id=847#c2268

======================================================================
Date Submitted: 2014-06-19 07:02 UTC
Last Modified: 2014-06-26 15:15 UTC
======================================================================
Summary: open(O_CREAT), directories, and EISDIR
======================================================================

Issue History
Date Modified Username Field Change
======================================================================
2014-06-19 07:02 rhansen New Issue
2014-06-19 07:02 rhansen Name => Richard Hansen
2014-06-19 07:02 rhansen Organization => BBN
2014-06-19 07:02 rhansen Section => open, openat
2014-06-19 07:02 rhansen Page Number => 1394
2014-06-19 07:02 rhansen Line Number => 46098
2014-06-19 16:40 rhansen Note Added: 0002268
2014-06-19 16:41 rhansen Note Edited: 0002268
2014-06-23 16:43 rhansen Note Edited: 0002268
2014-06-26 15:13 rhansen Note Edited: 0002268
2014-06-26 15:14 nick Interp Status => ---
2014-06-26 15:14 nick Final Accepted Text => See
http://austingroupbugs.net/view.php?id=847#c2268
2014-06-26 15:14 nick Status New => Interpretation
Required
2014-06-26 15:14 nick Resolution Open => Accepted As
Marked
2014-06-26 15:14 nick Tag Attached: tc2-2008
2014-06-26 15:15 nick Interp Status --- => Pending
======================================================================
Austin Group Bug Tracker
2014-06-27 11:09:44 UTC
Permalink
The following issue has been UPDATED.
======================================================================
http://austingroupbugs.net/view.php?id=847
======================================================================
Reported By: rhansen
Assigned To:
======================================================================
Project: 1003.1(2013)/Issue7+TC1
Issue ID: 847
Category: System Interfaces
Type: Error
Severity: Editorial
Priority: normal
Status: Interpretation Required
Name: Richard Hansen
Organization: BBN
User Reference:
Section: open, openat
Page Number: 1394
Line Number: 46098
Interp Status: Proposed
Final Accepted Text: See http://austingroupbugs.net/view.php?id=847#c2268

======================================================================
Date Submitted: 2014-06-19 07:02 UTC
Last Modified: 2014-06-27 11:09 UTC
======================================================================
Summary: open(O_CREAT), directories, and EISDIR
======================================================================

----------------------------------------------------------------------
(0002289) ajosey (manager) - 2014-06-27 11:09
http://austingroupbugs.net/view.php?id=847#c2289
----------------------------------------------------------------------
Interpretation proposed June 27 2014

Issue History
Date Modified Username Field Change
======================================================================
2014-06-19 07:02 rhansen New Issue
2014-06-19 07:02 rhansen Name => Richard Hansen
2014-06-19 07:02 rhansen Organization => BBN
2014-06-19 07:02 rhansen Section => open, openat
2014-06-19 07:02 rhansen Page Number => 1394
2014-06-19 07:02 rhansen Line Number => 46098
2014-06-19 16:40 rhansen Note Added: 0002268
2014-06-19 16:41 rhansen Note Edited: 0002268
2014-06-23 16:43 rhansen Note Edited: 0002268
2014-06-26 15:13 rhansen Note Edited: 0002268
2014-06-26 15:14 nick Interp Status => ---
2014-06-26 15:14 nick Final Accepted Text => See
http://austingroupbugs.net/view.php?id=847#c2268
2014-06-26 15:14 nick Status New => Interpretation
Required
2014-06-26 15:14 nick Resolution Open => Accepted As
Marked
2014-06-26 15:14 nick Tag Attached: tc2-2008
2014-06-26 15:15 nick Interp Status --- => Pending
2014-06-27 11:09 ajosey Interp Status Pending => Proposed
2014-06-27 11:09 ajosey Note Added: 0002289
======================================================================
Loading...