Zsh Mailing List Archive
Messages sorted by:
Re: Any way to allow clobbering empty files when noclobber is set?
- X-seq: zsh-workers 45966
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Any way to allow clobbering empty files when noclobber is set?
- Date: Thu, 4 Jun 2020 10:42:33 +0100 (BST)
- Cc: Martin Tournoij <martin@xxxxxxxxxx>
- Importance: Medium
- In-reply-to: <CAH+w=7YpQ3CcsMhAvztGHx19FnALBV349RAz4p8iuB+_8AnsxQ@mail.gmail.com>
- List-help: <mailto:firstname.lastname@example.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:email@example.com>
- List-unsubscribe: <mailto:firstname.lastname@example.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CGME20200603020919eucas1p13e26ebcbb335784d14bfb97b137f385a@eucas1p1.samsung.com> <email@example.com> <94e73ebcf39d4d3f9c7ae257b1d75d16@CAMSVWEXC01.scsc.local> <CAH+w=7YpQ3CcsMhAvztGHx19FnALBV349RAz4p8iuB+_8AnsxQ@mail.gmail.com>
> On 04 June 2020 at 06:06 Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Wed, Jun 3, 2020 at 5:05 AM Peter Stephenson
> <p.stephenson@xxxxxxxxxxx> wrote:
> > Martin Tournoij wrote:
> > > I rather miss though: the 'notempty' option in 'noclobber'.
> > This isn't actually hard to implement. What does everyone else think?
> Gmail thinks ".dif" is a spreadsheet, and MacOS thinks it's a video.
And, obviously, as a mere user, you're not allowed to treat it any
differently without actually downloading it...
> More seriously ... what, if any, effect ought this have on "command >>
> nonexistent" ?
I couldn't see any direct relevance, but there may be some overlap
> 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
I'm not entirely sure if we get quite the same behaviour if we do
that. At the least we'd need to open the existing file without
truncating (then either close it or leave it open for writing
if it was already empty). Unless there's a security aspect to this,
with there already being an endless number of things to go wrong if
files are actively changing under you, I'd be inclined just to keep
it simple. Happy to hear a knockout argument the other way.
Messages sorted by: