delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/08/03/11:26:00

X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Eric Blake <ebb9 AT byu DOT net>
Subject: Re: New rename(2) function
Date: Fri, 3 Aug 2007 15:25:26 +0000 (UTC)
Lines: 45
Message-ID: <loom.20070803T171100-285@post.gmane.org>
References: <loom DOT 20070801T164915-207 AT post DOT gmane DOT org> <loom DOT 20070803T160617-952 AT post DOT gmane DOT org>
Mime-Version: 1.0
User-Agent: Loom/3.14 (http://gmane.org/)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Eric Blake <ebb9 <at> byu.net> writes:

> 
> However, there is still a bug:

And another bug, involving the rename of a directory onto a broken symlink.

On Linux:

$ mkdir a
$ ln -s b c
$ mv a c/
mv: cannot overwrite non-directory `c' with directory `a'
$ ./rename a c/
result -1, errno 20: Not a directory

But on cygwin:

$ mkdir a
$ ln -s b c
$ ./rename a c/
result 0, errno 0: No error
$ ls -Fd ?
b/  c@

Oops - rather than detecting that resolving c/ fails because b does not exist 
as a directory (ENOTDIR), cygwin went ahead and moved the directory according 
to the symlink contents of c.

I assume once you fix the above problem, that the following testcase will then 
match linux' behavior:

$ ln -s d d
$ ./rename a d/
result -1, errno 20: Not a directory

rather than cygwin's current ELOOP behavior, which doesn't make sense, since d/ 
was not a valid pathname to be detecting a loop with.
$ ln -s d d
$ ./rename a d/
result -1, errno 92: Too many levels of symbolic links

-- 
Eric Blake



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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