X-Recipient: archive-cygwin@delorie.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@cygwin.com
Delivered-To: cygwin@cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F14433858D1E
Date: Tue, 18 Apr 2023 18:21:48 +0200
To: Bruno Haible <bruno@clisp.org>
Subject: Re: renameat2 works differently than on Linux
Message-ID: <ZD7DnCdknznSO5pq@calimero.vinschen.de>
Mail-Followup-To: Bruno Haible <bruno@clisp.org>, cygwin@cygwin.com
References: <1745205.A0I09U8b9p@nimes>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <1745205.A0I09U8b9p@nimes>
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Corinna Vinschen via Cygwin <cygwin@cygwin.com>
Reply-To: cygwin@cygwin.com
Cc: Corinna Vinschen <corinna-cygwin@cygwin.com>, cygwin@cygwin.com
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cygwin-bounces+archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie.com@cygwin.com>

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
