Re: Anyone interested in implementing O_NOCLOBBER ?

2020-04-18 Thread Robert Elz
Date:Sat, 18 Apr 2020 01:23:34 +0200 From:Joerg Sonnenberger Message-ID: <20200417232334.ga59...@bec.de> | I don't understand this argument. I would invert the logic in /bin/sh, Actually, I just looked at our code again, and I am not currently seeing any problems w

Re: Anyone interested in implementing O_NOCLOBBER ?

2020-04-18 Thread Robert Elz
Date:Sat, 18 Apr 2020 01:23:34 +0200 From:Joerg Sonnenberger Message-ID: <20200417232334.ga59...@bec.de> | I don't understand this argument. I would invert the logic in /bin/sh, | e.g. try to open with O_CREAT|O_EXCL first and only do the open dance if | it fail

Re: Anyone interested in implementing O_NOCLOBBER ?

2020-04-18 Thread Robert Elz
Date:Sat, 18 Apr 2020 01:02:48 +0200 From:Kamil Rytarowski Message-ID: <007e1cda-6988-7b7a-3125-0f138a951...@gmx.com> | I just use it to protect from overwriting preexisting files by an | accident. If O_NOCLOBBER can be useful in the implementation of this | fe

Re: Anyone interested in implementing O_NOCLOBBER ?

2020-04-17 Thread Joerg Sonnenberger
On Sat, Apr 18, 2020 at 12:01:37AM +0700, Robert Elz wrote: > Date:Fri, 17 Apr 2020 18:15:01 +0200 > From:Joerg Sonnenberger > Message-ID: <20200417161501.gb72...@bec.de> > > | I'm talking about the difference between this new clobber flag and > | O_EXCL. > > OK.

Re: Anyone interested in implementing O_NOCLOBBER ?

2020-04-17 Thread Kamil Rytarowski
On 17.04.2020 18:46, Robert Elz wrote: > Date:Fri, 17 Apr 2020 16:49:40 +0200 > From:Kamil Rytarowski > Message-ID: > > | I use this in ksh and I find this as a useful feature. > > If you just mean that you use noclobber mode (set -C) for > protection (what little

Re: Anyone interested in implementing O_NOCLOBBER ?

2020-04-17 Thread Robert Elz
Date:Fri, 17 Apr 2020 18:15:01 +0200 From:Joerg Sonnenberger Message-ID: <20200417161501.gb72...@bec.de> | I'm talking about the difference between this new clobber flag and | O_EXCL. OK. | As in: why doesn't the noclobber flag just set O_EXCL and done. That'

Re: Anyone interested in implementing O_NOCLOBBER ?

2020-04-17 Thread Robert Elz
Date:Fri, 17 Apr 2020 16:49:40 +0200 From:Kamil Rytarowski Message-ID: | I use this in ksh and I find this as a useful feature. If you just mean that you use noclobber mode (set -C) for protection (what little it offers) then that's fine - that's never going away

Re: Anyone interested in implementing O_NOCLOBBER ?

2020-04-17 Thread Joerg Sonnenberger
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 > Message-ID: <20200416172748.ga86...@bec.de> > > | What is the point of this "restriction"? They wanted to make a set flag, > | but allow

Re: Anyone interested in implementing O_NOCLOBBER ?

2020-04-17 Thread Kamil Rytarowski
On 16.04.2020 21:10, Robert Elz wrote: > Date:Thu, 16 Apr 2020 19:27:48 +0200 > From:Joerg Sonnenberger > 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

Re: Anyone interested in implementing O_NOCLOBBER ?

2020-04-16 Thread Robert Elz
Date:Thu, 16 Apr 2020 19:27:48 +0200 From:Joerg Sonnenberger 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?

Re: Anyone interested in implementing O_NOCLOBBER ?

2020-04-16 Thread Joerg Sonnenberger
On Thu, Apr 16, 2020 at 07:17:06PM +0700, Robert Elz wrote: > O_NOCLOBBER|O_CREAT is intended to be the same as O_EXCL|O_CREAT when the > file named is a regular file, but unlike the O_EXCL variant, succeed if > the file is a special file (like /dev/ttyN) which exists already. What is the point of

Re: Anyone interested in implementing O_NOCLOBBER ?

2020-04-16 Thread Robert Elz
Oh, and of course, like almost everyone doe smost of the time, I forgot rump ... there's always rump mods needed! kre

Re: Anyone interested in implementing O_NOCLOBBER ?

2020-04-16 Thread Robert Elz
Date:Thu, 16 Apr 2020 15:48:00 +0200 From:Joerg Sonnenberger Message-ID: <20200416134800.gc21...@bec.de> | It strikes me as a lot of complexity for a limited use case. That argument (almost identically, but with more verbosity) was made back when the discussions on

Re: Anyone interested in implementing O_NOCLOBBER ?

2020-04-16 Thread Joerg Sonnenberger
On Thu, Apr 16, 2020 at 07:17:06PM +0700, Robert Elz wrote: > Its main purpose would be to implement noclobber mode (set -C) in sh > (and one presumes, the similar thing in csh). It strikes me as a lot of complexity for a limited use case. Joerg PS: I would find something like O_NOATIME to be mu

Anyone interested in implementing O_NOCLOBBER ?

2020-04-16 Thread Robert Elz
POSIX are considering this: O_NOCLOBBER If O_CREAT and O_NOCLOBBER are set, open() shall fail if the file exists and is either a regular file or a symbolic link that resolves to a regular file. The check for the existence and type of the file and the creation o