All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [RFC] a corner case of open(2)
Date: Tue, 26 Apr 2016 18:55:38 +0100	[thread overview]
Message-ID: <20160426175538.GO25498@ZenIV.linux.org.uk> (raw)

	According to POSIX (and behaviour on other Unices) the following
should succeed: open("/tmp", O_CREAT, 0) does not have O_EXCL and the pathname
does refer to existing object, so O_CREAT is ignored and the call is
equivalent to open("/tmp", 0), which succeeds.

	We have it rejected with EISDIR.  The thing is, the standard behaviour
is actually less messy wrt code, and do_last()/lookup_open()/atomic_open()
badly needs untangling.

	Another place where we produce a bogus EISDIR is O_CREAT|O_EXCL on
an existing directory.  POSIX (and other Unices) have EEXIST there.  In some
cases we produce EEXIST, in some - EISDIR.  Uniform EEXIST is actually easier.

	It is a change of user-visible behaviour, but I would be very
surprised if anything broke from that change.  And it would help to simplify
the awful mess we have in there.

	Comments?

             reply	other threads:[~2016-04-26 17:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-26 17:55 Al Viro [this message]
2016-04-26 18:05 ` [RFC] a corner case of open(2) Cedric Blancher
2016-04-26 18:15   ` Al Viro
2016-04-26 18:41 ` Valdis.Kletnieks
2016-04-26 19:02   ` Al Viro
2016-04-26 19:25     ` Valdis.Kletnieks
2016-04-26 20:17       ` Al Viro
2016-04-26 20:17         ` Al Viro
2016-04-27  5:34 ` Al Viro
2016-04-27  9:33   ` Miklos Szeredi
2016-04-27 19:29   ` another patch in #for-linus (was Re: [RFC] a corner case of open(2)) Al Viro
2016-05-02 21:48     ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160426175538.GO25498@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.