Bug 240452 - open(2) specifies EISDIR with existing directory for O_CREAT without O_DIRECTORY
Summary: open(2) specifies EISDIR with existing directory for O_CREAT without O_DIRECTORY
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: standards (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-standards mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-09 17:10 UTC by Ed Maste
Modified: 2019-09-24 06:22 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Maste freebsd_committer 2019-09-09 17:10:34 UTC
From sortix's POSIX test suite we return success for

  open(tmpdir, O_RDONLY | O_CREAT, 0777)

while we should fail with EISDIR - POSIX now says (https://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html):

[EISDIR]
    The named file is a directory and oflag includes O_WRONLY or O_RDWR, or includes O_CREAT without O_DIRECTORY.

References:
https://sortix.org/os-test/
https://sortix.org/os-test/io/open-tmpdir-rdonly-creat.c
https://twitter.com/sortiecat/status/1171092062671908866
Comment 1 Konstantin Belousov freebsd_committer 2019-09-13 10:38:27 UTC
https://reviews.freebsd.org/D21634
Comment 2 commit-hook freebsd_committer 2019-09-17 18:33:14 UTC
A commit references this bug:

Author: kib
Date: Tue Sep 17 18:32:19 UTC 2019
New revision: 352455
URL: https://svnweb.freebsd.org/changeset/base/352455

Log:
  Return EISDIR when directory is opened with O_CREAT without O_DIRECTORY.

  Reviewed by:	bcr (man page), emaste (previous version)
  PR:	240452
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week
  DIfferential revision:	https://reviews.freebsd.org/D21634

Changes:
  head/lib/libc/sys/open.2
  head/sys/kern/vfs_vnops.c
Comment 3 commit-hook freebsd_committer 2019-09-24 06:19:37 UTC
A commit references this bug:

Author: kib
Date: Tue Sep 24 06:18:49 UTC 2019
New revision: 352643
URL: https://svnweb.freebsd.org/changeset/base/352643

Log:
  MFC r352455:
  Return EISDIR when directory is opened with O_CREAT without O_DIRECTORY.

  PR:	240452

Changes:
_U  stable/12/
  stable/12/lib/libc/sys/open.2
  stable/12/sys/kern/vfs_vnops.c
Comment 4 commit-hook freebsd_committer 2019-09-24 06:22:41 UTC
A commit references this bug:

Author: kib
Date: Tue Sep 24 06:21:49 UTC 2019
New revision: 352645
URL: https://svnweb.freebsd.org/changeset/base/352645

Log:
  MFC r352455:
  Return EISDIR when directory is opened with O_CREAT without O_DIRECTORY.

  PR:	240452

Changes:
_U  stable/11/
  stable/11/lib/libc/sys/open.2
  stable/11/sys/kern/vfs_vnops.c