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

From: Thierry Volpiatto <[email-masked]>
Date: Fri, 13 Jan 2012 15:06:08 +0100

Stefan Monnier <[email-masked]> writes:

> IIUC the problem at hand can be solved by disregarding names and
> comparing (file-attributes) instead, since we're checking whether two
> names refer to the exact same (existing) directory.
>
>>> As this seems like a common occurrence, how comes that we don't have
>>> 
>>> (defun file-name-compare (name1 name2 &optional dir)
>>> "..."
>>> (let ((n1 (file-truename (expand-file-name name1 dir)))
>>> (n2 (file-truename (expand-file-name name2 dir))))
>>> (when (memq system-type '(ms-dos windows-nt))
>>> (setq n1 (downcase n1)
>>> n2 (downcase n2)))
>>> (string= n1 n2)))
>
> file-name-equal-p would be nice, indeed, as discussed a few months
> (years?) ago.

I am for `file-name-equal-p', would be really helpful specially for this
patch. 

>> I wouldn't check for `system-type', there might be other systems which
>> do not care filename cases (VMS?). I would let-bind `case-fold-search',
>> derived from `read-file-name-completion-ignore-case'.
>
> read-file-name-completion-ignore-case is a user configuration which only
> reflects the underlying system's sensitivity by default but the user is
> free to modify it.  I used to set it to t under GNU/Linux, for instance.

So would be better to let-bind case-fold-search as suggested by Michael.
It's what I did in last version of this patch.

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