From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 31764 invoked from network); 4 Jun 2020 09:43:27 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 4 Jun 2020 09:43:27 -0000 Received: (qmail 27208 invoked by alias); 4 Jun 2020 09:43:16 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45966 Received: (qmail 11957 invoked by uid 1010); 4 Jun 2020 09:43:16 -0000 X-Qmail-Scanner-Diagnostics: from smtpq2.tb.ukmail.iss.as9143.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.3/25828. spamassassin: 3.4.4. Clear:RC:0(212.54.57.97):SA:0(-2.7/5.0):. Processed in 3.816612 secs); 04 Jun 2020 09:43:16 -0000 X-Envelope-From: p.w.stephenson@ntlworld.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _mailcloud.virginmedia.com designates 212.54.57.97 as permitted sender) X-Env-Mailfrom: p.w.stephenson@ntlworld.com X-Env-Rcptto: zsh-workers@zsh.org X-SourceIP: 172.25.160.136 X-CNFS-Analysis: v=2.3 cv=T8IXs8CQ c=1 sm=1 tr=0 a=4AIt8OzuWET5BS7mAkvERw==:117 a=KEnZaF_ea6UA:10 a=IkcTkHD0fZMA:10 a=DoY9bV0jb9AA:10 a=q2GGsy2AAAAA:8 a=hD80L64hAAAA:8 a=IMTaEG6iRRexTNe15g0A:9 a=QEXdDO2ut3YA:10 a=z9dJwno5l634igLiVhy-:22 X-Authenticated-Sender: p.w.stephenson@ntlworld.com Date: Thu, 4 Jun 2020 10:42:33 +0100 (BST) From: Peter Stephenson To: zsh-workers@zsh.org Cc: Martin Tournoij Message-ID: <483300941.422089.1591263753638@mail2.virginmedia.com> In-Reply-To: References: <89aed74d-db7b-47ad-b218-8158838049e9@www.fastmail.com> <94e73ebcf39d4d3f9c7ae257b1d75d16@CAMSVWEXC01.scsc.local> Subject: Re: Any way to allow clobbering empty files when noclobber is set? MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Medium X-Mailer: Open-Xchange Mailer v7.8.4-Rev70 X-Originating-IP: 165.225.81.56 X-Originating-Client: open-xchange-appsuite X-CMAE-Envelope: MS4wfCOQ3ymLnhjBU2RzmoqK3YYBpxvHXkjQy0m0/GogPzaTovmfYyOSnMTd7GLrus662WpyClC+MeF32K5k5rnNqeQ4D6qb7lXQyepCMrpFwvBLjpa7u2Om /E9zLVj4qoLftK/nfF/Ewofq2tiTYqDJcj4lEuykfBxh3psw0EDA5OPzGO5j65Mt3Fo7dmqSXVFMmuJCgXB0q8YQ6mC/+ayBBnMxAlLvE24ab2IKNHeomrp4 > On 04 June 2020 at 06:06 Bart Schaefer wrote: > On Wed, Jun 3, 2020 at 5:05 AM Peter Stephenson > 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've missed. > 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 > conditions? 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. pws