From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.bugs Subject: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Date: Fri, 24 Feb 2012 17:02:16 +0100 Message-ID: <8762eww77b.fsf@gmail.com> References: <87mx9su32g.fsf@web.de> <871uqzn3bc.fsf@gmx.de> <871uqz651u.fsf@gmx.de> <87pqd89lh4.fsf@gmail.com> <87mx8b3nvb.fsf@gmail.com> <87pqd6wnvv.fsf@gmail.com> <87d395y1w0.fsf@gmail.com> <87zkc8x04p.fsf@gmail.com> <87vcmwwvk7.fsf@gmail.com> <834nugtwqf.fsf@gnu.org> <87r4xkwhky.fsf@gmail.com> <83vcmws3bs.fsf@gnu.org> <87ehtkwaiz.fsf@gmail.com> <87wr7cgsm3.fsf@gmx.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1330099423 5572 80.91.229.3 (24 Feb 2012 16:03:43 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 24 Feb 2012 16:03:43 +0000 (UTC) Cc: 10489@debbugs.gnu.org To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Feb 24 17:03:41 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1S0xcR-0003H2-Ow for geb-bug-gnu-emacs@m.gmane.org; Fri, 24 Feb 2012 17:03:40 +0100 Original-Received: from localhost ([::1]:54948 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0xcQ-0002fy-UL for geb-bug-gnu-emacs@m.gmane.org; Fri, 24 Feb 2012 11:03:38 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:47552) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0xcN-0002f6-7A for bug-gnu-emacs@gnu.org; Fri, 24 Feb 2012 11:03:36 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S0xcH-0001cl-2s for bug-gnu-emacs@gnu.org; Fri, 24 Feb 2012 11:03:35 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:52431) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0xcG-0001cc-U3 for bug-gnu-emacs@gnu.org; Fri, 24 Feb 2012 11:03:29 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1S0xek-0002R9-UL for bug-gnu-emacs@gnu.org; Fri, 24 Feb 2012 11:06:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Thierry Volpiatto Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Feb 2012 16:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10489 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 10489-submit@debbugs.gnu.org id=B10489.13300995059278 (code B ref 10489); Fri, 24 Feb 2012 16:06:02 +0000 Original-Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 16:05:05 +0000 Original-Received: from localhost ([127.0.0.1]:54323 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0xdn-0002Pa-VM for submit@debbugs.gnu.org; Fri, 24 Feb 2012 11:05:04 -0500 Original-Received: from mail-wi0-f172.google.com ([209.85.212.172]:48045) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0xdk-0002Ox-4s for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 11:05:02 -0500 Original-Received: by wibhm9 with SMTP id hm9so1550808wib.3 for <10489@debbugs.gnu.org>; Fri, 24 Feb 2012 08:02:19 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.77.228 as permitted sender) client-ip=10.180.77.228; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.77.228 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Original-Received: from mr.google.com ([10.180.77.228]) by 10.180.77.228 with SMTP id v4mr6540154wiw.2.1330099339971 (num_hops = 1); Fri, 24 Feb 2012 08:02:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=rBa5n7noGS0s1dOemadWFGabQtlPE8kYsLcmQMXa59g=; b=oTQKRb6HiJpnk3UVcUOAeLNcwwtwJauUvE9sH3pJeskIvxKj5K7X7GiWMMu7DjO7cJ vMgVEGvrVQkf0wfMKCiNw/X+Uku83X5oP+zq6CBMwtvdqzeO0njf5W6MiDdCmAlFbVH3 /uo+0Ep3kC9G+J3zpYgVSBZ4iE/64WV7cjheY= Original-Received: by 10.180.77.228 with SMTP id v4mr5244630wiw.2.1330099339909; Fri, 24 Feb 2012 08:02:19 -0800 (PST) Original-Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id s8sm4343010wiz.8.2012.02.24.08.02.17 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 24 Feb 2012 08:02:18 -0800 (PST) In-Reply-To: <87wr7cgsm3.fsf@gmx.de> (Michael Albinus's message of "Fri, 24 Feb 2012 16:26:28 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:57176 Archived-At: Michael Albinus writes: > Thierry Volpiatto writes: > >> However, Michael I would like to have more precisions for the call of >> tramp handlers. > > What exactly? It's always the same scenario: Check for the handler, and > if there is any, call it. You can reuse the code snippet from all > functions which do so. > > If you are uncertain, show your code; I'll comment. So here the functions, please have a look: (defun files-equal-p (file1 file2) "Return non-nil if FILE1 and FILE2 name the same file." (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) (and (equal (file-remote-p file1) (file-remote-p file2)) (equal (file-attributes (file-truename file1)) (file-attributes (file-truename file2))))))) (defun file-subdir-of-p (dir1 dir2) "Return non-nil if DIR1 is a subdirectory of DIR2. Note that a directory is treated by this function as a subdirectory of itself. This function only works when its two arguments already exist, when they don't, it returns nil." (let ((handler (or (find-file-name-handler dir1 'file-subdir-of-p) (find-file-name-handler dir2 'file-subdir-of-p)))) (if handler (funcalll handler 'file-subdir-of-p dir1 dir2) (when (and (file-directory-p dir1) (file-directory-p dir2)) (loop with f1 = (file-truename dir1) with f2 = (file-truename dir2) with ls1 = (or (split-string f1 "/" t) (list "/")) with ls2 = (or (split-string f2 "/" t) (list "/")) for p = (string-match "^/" f1) for i in ls1 for j in ls2 when (string= i j) concat (if p (concat "/" i) (concat i "/")) into root finally return (files-equal-p (file-truename root) f2)))))) BTW I have added the COPY-CONTENTS arg to your handler in `copy-directory'. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997