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 Wed, Jun 3, 2020 at 9:06 PM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:>
> [ Let's call this UNLINK_EMPTY_AFTER_FAILURE for the sake of discussion. ]
> Bart Schaefer wrote on Thu, 04 Jun 2020 02:43 +00:00:
> >
> > How does that user experience differ from HIST_ALLOW_CLOBBER?
> Well, for one, because that proposal only takes effect when foo exited
> non-zero, created bar, and bar is zero-sized?

Fair enough, although (silly example) "false > empty" would remove the
file?  Wouldn't you at least want the reason for the unlink to be that
the redirection failed, rather than that the command exited non-zero?

What if the redirection target is a symbolic link?  What if it isn't a
plain file?

> > and silently unlinking a file is not very friendly.  The /etc/nologin
> > example in your next message comes to mind.
> Doesn't this argument also apply to anyone who might set CLOBBER_EMPTY
> and then lose the timestamps on empty files, as in your next message?

Yes, but to a lesser degree, because the file is at least still
present if it's presence means something.

> Seriously, though, it's perfectly possible that CLOBBER_EMPTY is the
> better solution here.  I was only brainstorming.

Sure, you just got me curious about thinking through it.

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