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

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



Martin Tournoij wrote on Thu, 04 Jun 2020 14:31 +0800:
> The thinking was that it's the "least magical" behaviour I could think of:
> if I tell zsh to "NO_CLOBBER" then I'm telling it to "don't make me lose
> data when I'm being stupid". I think allowing it to overwrite empty files
> fits rather nicely with the intent of NO_CLOBBER.
> 
> This seems less magic to me than "> creates a file, except when [...]".
> 
> That being said, you solution would obviously also be workable, and don't
> overly care one way or the other, but this was my thinking behind it.
> 

*nod*

I was going to give as an example commands such as «tar -cf
foo /does/not/exist», «curl -o foo https://will/respond/404/not/found»;,
and so on, but it turns out they actually do create a zero-length file
and return non-zero.

The evidence does seem to argue in favour of the CLOBBER_EMPTY approach…

> Also, I'm almost disappointed Peter wrote a patch already, as I was looking
> forward to doing it myself heh 😅

Our apologies, then ☺

Perhaps you'd be interested in writing some other patch?  See Etc/BUGS
and Test/list-XFails for known issues.  workers/45843#1, for example,
is a recently-reported segfault.

Cheers,

Daniel



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