Zsh Mailing List Archive
Messages sorted by:
Re: Any way to allow clobbering empty files when noclobber is set?
- X-seq: zsh-workers 45958
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Vin Shelton <acs@xxxxxxxxxxxxxxxxxxxx>
- Subject: Re: Any way to allow clobbering empty files when noclobber is set?
- Date: Thu, 4 Jun 2020 02:36:50 +0000
- Cc: Peter Stephenson <p.stephenson@xxxxxxxxxxx>, Martin Tournoij <martin@xxxxxxxxxx>, "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- In-reply-to: <CACeGjnXVt2GNcpmftV6vqoA8Q0_9rG4Dodwp9aHgOK6=J=e2GA@mail.gmail.com>
- List-help: <mailto:email@example.com>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:firstname.lastname@example.org>
- List-unsubscribe: <mailto:email@example.com>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CGME20200603020919eucas1p13e26ebcbb335784d14bfb97b137f385a@eucas1p1.samsung.com> <firstname.lastname@example.org> <94e73ebcf39d4d3f9c7ae257b1d75d16@CAMSVWEXC01.scsc.local> <CACeGjnXVt2GNcpmftV6vqoA8Q0_9rG4Dodwp9aHgOK6=J=e2GA@mail.gmail.com>
Vin Shelton wrote on Wed, 03 Jun 2020 22:13 -0400:
> What is the significance of a 0-length file as opposed to a file with
There _are_ some cases where a 0-length file is treated differently to
a non-existing one:
- «cat foo» (also #include's in C)
- GNU make(1)'s lookup order: GNUmakefile / Makefile / makefile
> If we want to support this feature, why don't we change the meaning of
> NO_CLOBBER to mean only non-empty files?
Because users might be relying on the semantics that the documentation
For example, a user who does «echo foo > /etc/nologin» and doesn't get
an error may infer that it's fine to delete the file once they finish
whatever change they're working on. Keeping the error would alert that
user that they shouldn't remove the file when they're done (and, most
likely, should pause to coordinate with whoever created /etc/nologin
> - Vin
> On Wed, Jun 3, 2020 at 8:05 AM Peter Stephenson <p.stephenson@xxxxxxxxxxx>
> > Martin Tournoij wrote:
> > > I switched from tcsh to zsh a while ago (many years too late, I know),
> > > and found zsh can do pretty much everything better. There's one thing
> > > I rather miss though: the 'notempty' option in 'noclobber'.
> > This isn't actually hard to implement. What does everyone else think?
> > pws
Messages sorted by: