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

From: Thierry Volpiatto <[email-masked]>
Date: Mon, 27 Feb 2012 20:33:47 +0100

Michael Albinus <[email-masked]> writes:

> Thierry Volpiatto <[email-masked]> writes:
>
>> If you don't create "test1" and file-subdir-of-p is unable to handle a
>> non--existing directory,I don't understand how you want to do.
>
> I was saying that files-equal-p returns unexpected results in case both
> files do not exist. 
In this case this version return nil even if noexist is not provided.

(defun files-equal-p (file1 file2 &optional noexist)
  "Return non-nil if FILE1 and FILE2 name the same file.
This function works even on non--existing files."
  (let ((handler (or (find-file-name-handler file1 'files-equal-p)
                     (find-file-name-handler file2 'files-equal-p))))
    (if handler
        (funcall handler 'files-equal-p file1 file2 noexist)
      (let ((f1-attr (file-attributes (file-truename file1)))
            (f2-attr (file-attributes (file-truename file2))))
        (if (and f1-attr f2-attr)
            (equal f1-attr f2-attr)
          (when noexist
            (string= (file-truename
                      (file-name-as-directory file1))
                     (file-truename
                      (file-name-as-directory file2)))))))))

> I haven't spoken about file-subdir-of-p.
>
> Best regards, Michael.

-- 
  Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997