delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2023/04/18/12:22:43

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 <bruno AT clisp DOT org>
Subject: Re: renameat2 works differently than on Linux
Message-ID: <ZD7DnCdknznSO5pq@calimero.vinschen.de>
Mail-Followup-To: Bruno Haible <bruno AT clisp DOT org>, cygwin AT cygwin DOT com
References: <1745205 DOT A0I09U8b9p AT nimes>
MIME-Version: 1.0
In-Reply-To: <1745205.A0I09U8b9p@nimes>
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Corinna Vinschen via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>, cygwin AT cygwin DOT com
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019