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 12186 invoked from network); 4 Jun 2020 06:32:41 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 4 Jun 2020 06:32:41 -0000 Received: (qmail 17196 invoked by alias); 4 Jun 2020 06:32:32 -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: 45964 Received: (qmail 10373 invoked by uid 1010); 4 Jun 2020 06:32:31 -0000 X-Qmail-Scanner-Diagnostics: from out4-smtp.messagingengine.com 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(66.111.4.28):SA:0(-2.7/5.0):. Processed in 3.862769 secs); 04 Jun 2020 06:32:31 -0000 X-Envelope-From: martin@arp242.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at spf.messagingengine.com designates 66.111.4.28 as permitted sender) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudegtddgleehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgfgsehtqhertderreejnecuhfhrohhmpedfofgr rhhtihhnucfvohhurhhnohhijhdfuceomhgrrhhtihhnsegrrhhpvdegvddrnhgvtheqne cuggftrfgrthhtvghrnhepgeejgfdtieetffehteeggfekgedvgedvtdeuveeviefhgedt veeijeetueehfffgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepmhgrrhhtihhnsegrrhhpvdegvddrnhgvth X-ME-Proxy: X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.3.0-dev0-519-g0f677ba-fm-20200601.001-g0f677ba6 Mime-Version: 1.0 Message-Id: <92413353-973e-4bc5-94fa-7bb5b7f2fae0@www.fastmail.com> In-Reply-To: <20200604014850.52d241bd@tarpaulin.shahaf.local2> References: <89aed74d-db7b-47ad-b218-8158838049e9@www.fastmail.com> <94e73ebcf39d4d3f9c7ae257b1d75d16@CAMSVWEXC01.scsc.local> <20200604014850.52d241bd@tarpaulin.shahaf.local2> Date: Thu, 04 Jun 2020 14:31:51 +0800 From: "Martin Tournoij" To: "Daniel Shahaf" , "Peter Stephenson" Cc: zsh-workers@zsh.org Subject: Re: Any way to allow clobbering empty files when noclobber is set? Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable On Thu, Jun 4, 2020, at 09:48, Daniel Shahaf wrote: > However, I wonder whether there are other ways to peel this orange. F= or > example, I don't recall _other_ cases where I might have found the > proposed behaviour useful =E2=80=94 that is, cases where I used =C2=AB= >=C2=BB to create > a file, got an error because the file had been created as empty before= > I executed my command, and would have preferred for shell to just > proceed without flagging an error =E2=80=94 so, thinking out loud, how= about an > option that does the following: >=20 > Given =C2=ABfoo > bar=C2=BB, if =C2=ABfoo=C2=BB was run and exited= non-zero and > NO_CLOBBER in effect [which implies that =C2=ABbar=C2=BB didn't ex= ist before > foo was run], check whether =C2=ABbar=C2=BB is zero-size and, if s= o, unlink it. >=20 > ? >=20 > [To be clear, no objection to CLOBBER_EMPTY as posted; just brainstorm= ing > alternatives.] The thinking was that it's the "least magical" behaviour I could think o= f: if I tell zsh to "NO_CLOBBER" then I'm telling it to "don't make me lose= data when I'm being stupid". I think allowing it to overwrite empty file= s fits rather nicely with the intent of NO_CLOBBER. This seems less magic to me than "> creates a file, except when [...]". That being said, you solution would obviously also be workable, and don'= t overly care one way or the other, but this was my thinking behind it. Also, I'm almost disappointed Peter wrote a patch already, as I was look= ing forward to doing it myself heh =F0=9F=98=85 Cheerio, Martin