On Fri, Apr 17, 2020 at 02:10:19AM +0700, Robert Elz wrote: > Date: Thu, 16 Apr 2020 19:27:48 +0200 > From: Joerg Sonnenberger <jo...@bec.de> > Message-ID: <20200416172748.ga86...@bec.de> > > | What is the point of this "restriction"? They wanted to make a set flag, > | but allow people to not have to use sub shells when also redirecting > | stderr? > > Sorry, I'm not following the point there, what does any of this have > to do with sub shells or stderr ?
I'm talking about the difference between this new clobber flag and O_EXCL. As in: why doesn't the noclobber flag just set O_EXCL and done. I really dislike such adhoc shell restrictions leaking into the kernel. Actually, let me put the question differently. Why do we care about TOCTOU here at all? As in: it seems reasonable to me to just do the device check afterwards, potentially with O_NOFOLLOW. That would still work in all reasonable situations for devices as they are generally not in a world writable directory anway, so race conditions in that regard are much less problematic. Joerg