delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/04/14/11:49:10

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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
From: ericblake AT comcast DOT net (Eric Blake)
To: cygwin AT cygwin DOT com
Subject: bug in rename(2)
Date: Thu, 14 Apr 2005 15:48:28 +0000
Message-Id: <041420051548.25022.425E90CA00078468000061BE22070009530A050E040D0C079D0A@comcast.net>
X-Authenticated-Sender: ZXJpY2JsYWtlQGNvbWNhc3QubmV0

Coreutils testsuite found another bug, this time in rename(2), as tested on the 20050412 snapshot:

$ cd /cygdrive/c      # local NTFS drive
$ mknod fifo p
$ ls -lF fifo
prw-rw-rw-  1 eblake Domain Users 102 Apr 14 09:27 fifo|
$ mv fifo /cygdrive/u  # remote NFS drive
$ ls -lF /cygdrive/u/fifo
-r--r--r--  1 eblake Domain Users 102 Apr 14 09:27 /cygdrive/u/fifo

Oops - the rename succeeded but changed the file type; if this can't be made to work cross device, it would be better if it failed with EXDEV; mv(1) will then live up to its requirements and gracefully handle the EXDEV by creating a fifo on the destination before unlinking it on the source.

$ mkfifo fifo
$ ls -liF fifo
673851094245318183 prw-rw-rw-  1 eblake Domain Users 102 Apr 14 09:41 fifo|
$ mv fifo fifo1
$ ls -liF fifo1
673851094245318183 -r--r--r--  1 eblake Domain Users 102 Apr 14 09:41 fifo1

Oops - now we are on the same device, and mv(1) defers to rename(2) for semantics.  Rename is not permitted to change file types, and on the same device, is not permitted to fail with EXDEV.  At least it preserved the inode, as required.

--
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