[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarch
From: |
Michael Albinus |
Subject: |
bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy |
Date: |
Sun, 15 Jan 2012 13:50:47 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) |
Thierry Volpiatto <thierry.volpiatto@gmail.com> writes:
> The last patch use this instead, which avoid duplication of code and is
> more readable.
>
> (defun files-copyable-p (from to)
> "Verify if file FROM is not the same than TO on this system."
> (let* ((fromname (file-name-as-directory (file-truename from)))
> (destname (file-name-as-directory (file-truename to)))
> (rem-fromname (and (equal "sudo" (file-remote-p fromname 'method))
> (string-match (system-name)
> (file-remote-p fromname 'host))
> (file-remote-p fromname 'localname)))
> (rem-newname (and (equal "sudo" (file-remote-p destname 'method))
> (string-match (system-name) (file-remote-p
> destname 'host))
> (file-remote-p destname 'localname))))
> (not (equal (or rem-fromname fromname)
> (or rem-newname destname)))))
Again, Thierry: it is the wrong approach, to implement such logic in
files.el (or another package not related to remote files). You do not
know all details of the packages handling it. In this example, you have
handled "/sudo:", but you haven't handled "/su:". And other missing
details.
And you have called `file-truename' before comparing, whether the
"remoteness" of the files are equal. This is a performance issue,
because `file-truename' will always do expansive remote operations, even
if `from' and `to' are located on different hosts, and there is no
reason to find out their respective true names.
You are invited to implement `tramp-handle-file-eual-p', once
`file-equal-p' is added for Emacs 24.2. For the time being (Emacs 24.1),
it is sufficient to compare the result of `file-remote-p' as Drew has
shown in the example.
Best regards, Michael.
- bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy, (continued)
- bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy, Drew Adams, 2012/01/13
- bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy, Thierry Volpiatto, 2012/01/13
- bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy, Drew Adams, 2012/01/13
- bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy, Michael Albinus, 2012/01/13
- bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy, Drew Adams, 2012/01/13
- bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy, Thierry Volpiatto, 2012/01/13
- bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy, Michael Albinus, 2012/01/13
- bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy, Thierry Volpiatto, 2012/01/13
- bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy, Eli Zaretskii, 2012/01/14
- bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy, Thierry Volpiatto, 2012/01/14
- bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy,
Michael Albinus <=
- bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy, Thierry Volpiatto, 2012/01/15
- bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy, Thierry Volpiatto, 2012/01/15
- bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy, Michael Albinus, 2012/01/15
- bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy, Thierry Volpiatto, 2012/01/15
- bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy, Michael Albinus, 2012/01/15
- bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy, Thierry Volpiatto, 2012/01/15
- bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy, Thierry Volpiatto, 2012/01/16
- bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy, Stefan Monnier, 2012/01/16
- bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy, Michael Albinus, 2012/01/16
- bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy, Stefan Monnier, 2012/01/16