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

From: Michael Albinus <[email-masked]>
Date: Wed, 29 Feb 2012 12:04:39 +0100

Stefan Monnier <[email-masked]> writes:

>>>> `files-equal-p' still returns t for two non-existing files. Shall be
>>>> fixed too.
>>> I don't see why that should be fixed: files-equal-p only works for
>>> existing files.  If one or both of the files don't exist, the return
>>> value is unspecified.  Oh, yes, the doc needs to be fixed to say it clearly.
>> Why is this better than returning nil (which is easy to achieve)?
>
> It's not.

I see. There might be optimizations in file name handlers, for example
returning immediately t when both file names are identical.

Maybe we could change the entry in files.texi like this:

--8<---------------cut here---------------start------------->8---
*** /home/albinus/src/emacs/doc/lispref/files.texi.~107463~  2012-02-29 11:58:54.000000000 +0100
--- /home/albinus/src/emacs/doc/lispref/files.texi  2012-02-29 11:58:55.000000000 +0100
***************
*** 1020,1028 ****
  
  @defun file-equal-p file1 file2
  This function returns @code{t} if the files @var{file1} and
! @var{file2} name the same file.  Two ordinary files are considered to
! be the same if the function @code{file-attributes} (@pxref{File
! Attributes}) returns @code{equal} values for them.
  @end defun
  
  @defun file-subdir-of-p dir1 dir2
--- 1020,1034 ----
  
  @defun file-equal-p file1 file2
  This function returns @code{t} if the files @var{file1} and
! @var{file2} name the same file.  If @var{file1} or @var{file2} does
! not exist, the return value is unspecified.
! 
! If two files are equal, it does not imply that both file names specify
! accessible files.  For example, @file{/sudo::/foo/bar} might be
! accessible, but @file{file:///foo/bar} might not.  (@pxref{Remote
! Files,, Remote Files, emacs, The GNU Emacs Manual}, and
! @pxref{Supported URL Types,, Supported URL Types, url, URL
! Programmer's Manual})
  @end defun
  
  @defun file-subdir-of-p dir1 dir2
--8<---------------cut here---------------end--------------->8---

>         Stefan

Best regards, Michael.