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 30411 invoked from network); 4 Jun 2020 04:07:42 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 4 Jun 2020 04:07:42 -0000 Received: (qmail 5914 invoked by alias); 4 Jun 2020 04:07:33 -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: 45960 Received: (qmail 24212 invoked by uid 1010); 4 Jun 2020 04:07:33 -0000 X-Qmail-Scanner-Diagnostics: from out3-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.27):SA:0(-2.6/5.0):. Processed in 4.293062 secs); 04 Jun 2020 04:07:33 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudegtddgieeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgfgsehtqhertderreejnecuhfhrohhmpedfffgr nhhivghlucfuhhgrhhgrfhdfuceougdrshesuggrnhhivghlrdhshhgrhhgrfhdrnhgrmh gvqeenucggtffrrghtthgvrhhnpeefhfekfeevieelleehiefftdekudejledvhfdtjedt geegvdeuffefleehhfdvgfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrghmvg 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: In-Reply-To: References: <89aed74d-db7b-47ad-b218-8158838049e9@www.fastmail.com> <94e73ebcf39d4d3f9c7ae257b1d75d16@CAMSVWEXC01.scsc.local> <20200604014850.52d241bd@tarpaulin.shahaf.local2> Date: Thu, 04 Jun 2020 04:06:32 +0000 From: "Daniel Shahaf" To: "Bart Schaefer" , "zsh-workers@zsh.org" Cc: "Martin Tournoij" 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 Bart Schaefer wrote on Thu, 04 Jun 2020 02:43 +00:00: > On Wed, Jun 3, 2020 at 6:49 PM Daniel Shahaf = wrote: > > > > I certainly have several cases in my $HISTFILE where I repeated > > a command with =C2=AB>=C2=BB changed to =C2=AB>!=C2=BB,=C2=B9 in the= pattern Martin described. >=20 > Are you sure you haven't set the HIST_ALLOW_CLOBBER option? >=20 I am. I really do have consecutive pairs of lines where the second line= is equal to the first one with s/>/>!/. > > ... thinking out loud, how about an > > option that does the following: > > > > Given =C2=ABfoo > bar=C2=BB, if =C2=ABfoo=C2=BB was run and exit= ed non-zero and > > NO_CLOBBER in effect [which implies that =C2=ABbar=C2=BB didn't = exist before > > foo was run], check whether =C2=ABbar=C2=BB is zero-size and, if= so, unlink it. [ Let's call this UNLINK_EMPTY_AFTER_FAILURE for the sake of discussion.= ] >=20 > How does that user experience differ from HIST_ALLOW_CLOBBER? In > either of those cases, you have to retrieve the command from history > and execute it again ... Well, for one, because that proposal only takes effect when foo exited non-zero, created bar, and bar is zero-sized? HIST_ALLOW_CLOBBER applies even when some of these conditions don't hold. > and silently unlinking a file is not very friendly. The /etc/nologin > example in your next message comes to mind. Doesn't this argument also apply to anyone who might set CLOBBER_EMPTY and then lose the timestamps on empty files, as in your next message? That's why these options are opt-in. Seriously, though, it's perfectly possible that CLOBBER_EMPTY is the better solution here. I was only brainstorming. Cheers, Daniel