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 23960 invoked from network); 6 Jun 2020 08:03:58 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 6 Jun 2020 08:03:58 -0000 Received: (qmail 9977 invoked by alias); 6 Jun 2020 08:03:49 -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: 46002 Received: (qmail 10458 invoked by uid 1010); 6 Jun 2020 08:03:49 -0000 X-Qmail-Scanner-Diagnostics: from out2-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.26):SA:0(-2.6/5.0):. Processed in 1.146951 secs); 06 Jun 2020 08:03:49 -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: gggruggvucftvghtrhhoucdtuddrgeduhedrudeggedguddulecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkjghfofggtgfgsehtjedttdertddvnecuhfhrohhmpeffrghn ihgvlhcuufhhrghhrghfuceougdrshesuggrnhhivghlrdhshhgrhhgrfhdrnhgrmhgvqe enucggtffrrghtthgvrhhnpeefudetgeevhedvhfetveetvdduleduieejueduueejjedt teeutdejhfdtgfeiteenucfkphepjeelrddujeeirdefledrieelnecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepugdrshesuggrnhhivghlrdhs hhgrhhgrfhdrnhgrmhgv X-ME-Proxy: Date: Sat, 6 Jun 2020 08:03:03 +0000 From: Daniel Shahaf To: Bart Schaefer Cc: "zsh-workers@zsh.org" , Martin Tournoij Subject: Re: Any way to allow clobbering empty files when noclobber is set? Message-ID: <20200606080303.0ab42262@tarpaulin.shahaf.local2> In-Reply-To: References: <89aed74d-db7b-47ad-b218-8158838049e9@www.fastmail.com> <94e73ebcf39d4d3f9c7ae257b1d75d16@CAMSVWEXC01.scsc.local> <20200605020748.635b9bb3@tarpaulin.shahaf.local2> <20200606045531.4b506c8e@tarpaulin.shahaf.local2> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Bart Schaefer wrote on Sat, 06 Jun 2020 00:08 -0700: > On Fri, Jun 5, 2020 at 9:55 PM Daniel Shahaf wrote: > > > > Bart Schaefer wrote on Fri, 05 Jun 2020 18:41 -0700: > > > > > > I don't think that's the intended typical usage of noclobber. It's > > > not set by default, and it can't have any effect outside the local > > > shell. > > > > NO_CLOBBER causes open() to be called with the O_EXCL bit, which does > > affect other processes as well. > > ?? All that O_EXCL guarantees is that no other process is able to > create the file. Once it exists, another file can open it and > truncate it and write to it, unless prevented by umask. But in Roman's example, _both_ backgrouned processes use O_EXCL, so whichever process loses the race will get an error when it calls open(2). Yes, attempts to open() the file without O_EXCL will succeed, but when a file is used as a mutex, everyone who tries to open the file will try to use O_EXCL. Makes sense? Cheers, Daniel