Subject: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy

From: Michael Albinus <[email-masked]>
Date: Fri, 24 Feb 2012 16:19:13 +0100

Eli Zaretskii <[email-masked]> writes:

>> This implementation requires, that inode number and filesystem device
>> number are always unique. This is true for local files, if you run a
>> Unix-like system. It is not guaranteed for remote files. And it is even
>> not guaranted, if the local system is Windows: on mounted drives, the
>> returned inode number is 0:
>
> Mounted how (i.e. with what command or feature)?

Don't know, somebody has added "network drives" to my login. All I can
say is

--8<---------------cut here---------------start------------->8---
U:\>net use
New connections will be remembered.

Status       Local     Remote                    Network
-------------------------------------------------------------------------------
Disconnected R:        \\ASLSDA0\ZENTRAL         Microsoft Windows Network
OK           U:        \\DESTGSFILN2\lb01177$    Microsoft Windows Network
OK           Y:        \\sambager1\albinus       Microsoft Windows Network
The command completed successfully.
--8<---------------cut here---------------end--------------->8---

> Btw, this function is only interested in directories; do directories
> also return a zero for inode in that case?

We are speaking about (defun files-equal-p (file1 file2) ...
This is also for files.

However, there is the same problem with directories:

(file-attributes "y:/")
=> (t 1 101567 513 (0 0) (0 0) (0 0) 0 "drwxrwxrwx" nil 0 (47631 . 5881))

> Anyway, I'd consider this a bug in `stat' implemented in w32.c, and
> wouldn't bother the Lisp code with that.

OK, that would be fine. Do we know, that device number and inode number
are trustworthy on all systems Emacs runs? When I've started with Tramp
years ago, it was the first lesson I've learnt, that we shouldn't use
inode and device numbers for serious things. And I have the impression,
both values aren't used heavily (this was a result of code inspection
some years ago, it might have changed).

> The probability of 2 directories having _all_ of their attributes
> identical is very small, even if we don't fix this in w32.c.

We are also speaking about files. And then it is a problem. Example:

On UNIX:

# cp -p ~/.emacs ~/to-be-tested

On Windows (y: is my UNIX home directory):

(equal (file-attributes "y:/.emacs") (file-attributes "y:/to-be-tested"))
=> t

Best regards, Michael.