Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Any way to allow clobbering empty files when noclobber is set?

On Thu, Jun 4, 2020, at 13:06, Bart Schaefer wrote:
> More seriously ... what, if any, effect ought this have on "command >>
> nonexistent" ?

Probably none?

> I'm not familiar with the tcsh variation of this.  Does it matter if
> the file is a symlink?
> Should this be done with open()-then-fstat() as is done for
> non-regular files instead of stat()-then-open(), to avoid race
> conditions?

tcsh does a stat() to check the file permissions and size, and then
xcreat()s (some wrapper around creat()?) it if it all looks good; see:


You're right that this is subject to race conditions since there might be
data written to the file in between the 2 calls. I'm not entirely sure how
realistic this scenario is though?

Messages sorted by: Reverse Date, Date, Thread, Author