Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Any way to allow clobbering empty files when noclobber is set?
- X-seq: zsh-workers 46009
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- Subject: Re: Any way to allow clobbering empty files when noclobber is set?
- Date: Sat, 6 Jun 2020 08:24:20 -0700
- Cc: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>
- In-reply-to: <CAN=4vMrtTugN6gBmC1A75m9Q2xLDuEzbf2sBacZNgAKcSoa6-w@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CGME20200603020919eucas1p13e26ebcbb335784d14bfb97b137f385a@eucas1p1.samsung.com> <89aed74d-db7b-47ad-b218-8158838049e9@www.fastmail.com> <94e73ebcf39d4d3f9c7ae257b1d75d16@CAMSVWEXC01.scsc.local> <CAH+w=7YpQ3CcsMhAvztGHx19FnALBV349RAz4p8iuB+_8AnsxQ@mail.gmail.com> <CAN=4vMqBCZqD04QO-hw0DwipmCVkdq+QNOEGNaSEfNxyRBqiiw@mail.gmail.com> <20200605020748.635b9bb3@tarpaulin.shahaf.local2> <1941572212.466119.1591360860372@mail2.virginmedia.com> <e7f7dfe2-eb4a-457b-85fb-091935a74c0e@www.fastmail.com> <13acd486e6457c1f708304026c3e1b59521ad328.camel@ntlworld.com> <CAN=4vMrtTugN6gBmC1A75m9Q2xLDuEzbf2sBacZNgAKcSoa6-w@mail.gmail.com>
On Sat, Jun 6, 2020 at 5:49 AM Roman Perepelitsa
<roman.perepelitsa@xxxxxxxxx> wrote:
>
> Having unspecified file content that is the result of interleaved
> writes seems pretty bad.
>
> [... code example ...]
>
> This output implies that one command has overwritten the output of
> another and the user has received no indication to this effect.
This returns to my point that this isn't the intended use case for
either NO_CLOBBER or CLOBBER_EMPTY. That code example always yields
unspecified file contents in a POSIX shell if the empty file already
exists and is writable (the only case you couldn't have is the file
empty at the end).
If you're going to use zsh + noclobber for concurrent programming,
then the implementation of clobberempty is entirely irrelevant,
because your correct program won't use it.
If you're attempting to use zsh + noclobber defensively, that won't
work either because any other process not written in zsh won't pay
attention to it.
Consequently we should be looking at this as an entirely interactive
user DWIM feature, and choosing how to implement (or not to) based on
that.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author