X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 23E4A3857706 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1681834924; bh=fL6Nr01E1o7lxJd+SHGBz0wFm1kBG+7CjgtBl9zPOcc=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=AmpRfGwtYsMHND2/2KMRYPUeuGJ73V8CZ4/L2nCAbqdok3rcfinRD3hERdL7N8Zcm wzjyxLxv+MGVvU05YR2tpo0LkT8SgowC1RidwCEolGybPMKx79TcKj8/gN66y88UDI iEQnSaWJtTzGZtMDXssin5WLKMzlNjCHCf0I45qQ= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F14433858D1E Date: Tue, 18 Apr 2023 18:21:48 +0200 To: Bruno Haible Subject: Re: renameat2 works differently than on Linux Message-ID: Mail-Followup-To: Bruno Haible , cygwin AT cygwin DOT com References: <1745205 DOT A0I09U8b9p AT nimes> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1745205.A0I09U8b9p@nimes> X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Corinna Vinschen via Cygwin Reply-To: cygwin AT cygwin DOT com Cc: Corinna Vinschen , cygwin AT cygwin DOT com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" Hi Bruno, On Apr 18 14:47, Bruno Haible via Cygwin wrote: > Hi, > > The renameat2 function is "Linux-specific", says the man page [1]; however, > Cygwin implements it as well. > > In Cygwin 3.4.6, in a specific case, it operates differently than the > Linux function. Namely, if the old* arguments and the new* arguments > are the same and the flag RENAME_NOREPLACE is specified. > [...] > Output on Linux (glibc, musl libc): > ret=-1, errno=17=EEXIST > > Output on Cygwin 3.4.6: > ret=0 > > Note that there is some ambiguity about this case in [1]: One one hand, > there is the general statement about rename(): > "If oldpath and newpath are existing hard links referring to the > same file, then rename() does nothing, and returns a success status." > On the other hand, the text regarding RENAME_NOREPLACE says: > "Return an error if newpath already exists." Thanks for the testcase. I guess the ambiguity doesn't matter, given it's a Linux function anyway. It makes sense to behave the same, if possible. I pushed a patch. The next test release cygwin-3.5.0-0.284.gd30a5917a9c4 will contain the patch for testing. Thanks, Corinna -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple