From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 12 14:35:15 2012 Received: (at submit) by debbugs.gnu.org; 12 Jan 2012 19:35:15 +0000 Received: from localhost ([127.0.0.1]:55416 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlQQc-0001nJ-CV for submit@debbugs.gnu.org; Thu, 12 Jan 2012 14:35:15 -0500 Received: from eggs.gnu.org ([140.186.70.92]:33132) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlQQZ-0001nB-Hw for submit@debbugs.gnu.org; Thu, 12 Jan 2012 14:35:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RlQQ1-0003Ir-Tp for submit@debbugs.gnu.org; Thu, 12 Jan 2012 14:34:38 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([140.186.70.17]:55596) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlQQ1-0003In-SQ for submit@debbugs.gnu.org; Thu, 12 Jan 2012 14:34:37 -0500 Received: from eggs.gnu.org ([140.186.70.92]:36371) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlQPw-0004VQ-8c for bug-gnu-emacs@gnu.org; Thu, 12 Jan 2012 14:34:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RlQPr-0003Hc-Q6 for bug-gnu-emacs@gnu.org; Thu, 12 Jan 2012 14:34:32 -0500 Received: from fmmailgate03.web.de ([217.72.192.234]:57189) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlQPr-0003HF-IB for bug-gnu-emacs@gnu.org; Thu, 12 Jan 2012 14:34:27 -0500 Received: from moweb002.kundenserver.de (moweb002.kundenserver.de [172.19.20.108]) by fmmailgate03.web.de (Postfix) with ESMTP id 3F9681AF81C97 for ; Thu, 12 Jan 2012 20:33:58 +0100 (CET) Received: from snow ([82.113.98.174]) by smtp.web.de (mrweb002) with ESMTPA (Nemesis) id 0MhlT9-1S6eSV3iiJ-00MgVY; Thu, 12 Jan 2012 20:33:58 +0100 From: Michael Heerdegen To: bug-gnu-emacs@gnu.org Subject: 24.0.92; dired-do-copy may create infinite directory hierarchy Date: Thu, 12 Jan 2012 20:35:19 +0100 Message-ID: <87mx9su32g.fsf@web.de> MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V02:K0:mLCYDIIdtO4FrEsc0eBJAFxkSpy9NQNUD8wZ+6xnUMC kW0oGDF0tA70wU0Bs3FxieSwil99TyrP3fmen5ue/XeqgQOSSe GkPde7V/H9oN+vhgYzC/rcIo95yVlMGHdwNIIh9GpRlaTqnazN oo0GddLKQZGvCWYQGmS5gcmg4m9+VR2wZ16lb7zJlMaxCio1xG xQbCvcGNXq2xXgtjRFrom/by+7qgSU0v3VaQiQYTwo= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: michael_heerdegen@web.de List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) Hello, start emacs -Q. Suppose you have a directory "~/Test". Do C-x d ~ RET. Jump to the line showing "Test". Hit C and enter "~/Test". Answer "yes" to the Recursive copies of /home/micha/Test? (yes or no) question. This creates an huge recursive hierarchy of "Test" directories ~/Test/Test/Test/Test/Test/Test/Test/Test/Test/Test/Test/Test/... The error copy-directory: Variable binding depth exceeds max-specpdl-size finally stops that. The user may do something like that per accident. Emacs should IMHO not behave like that. The problem also appears in Emacs 23. Thanks, Michael. In GNU Emacs 24.0.92.1 (i486-pc-linux-gnu, GTK+ Version 3.2.3) of 2012-01-11 on zelenka, modified by Debian (emacs-snapshot package, version 1:20120111-1) Windowing system distributor `The X.Org Foundation', version 11.0.11102902 configured using `configure '--build' 'i486-linux-gnu' '--host' 'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/24.0.92/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.0.92/site-lisp:/usr/share/emacs/site-lisp' '--without-compress-info' '--with-crt-dir=/usr/lib/i386-linux-gnu/' '--with-x=yes' '--with-x-toolkit=gtk3' '--with-imagemagick=yes' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2'' Important settings: value of $LC_ALL: de_DE.utf8 value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: C value of $LANG: de_DE.utf8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default enable-multibyte-characters: t From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 12 16:34:47 2012 Received: (at submit) by debbugs.gnu.org; 12 Jan 2012 21:34:47 +0000 Received: from localhost ([127.0.0.1]:55579 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlSIJ-0004bP-3N for submit@debbugs.gnu.org; Thu, 12 Jan 2012 16:34:47 -0500 Received: from eggs.gnu.org ([140.186.70.92]:33348) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlSIG-0004bG-D3 for submit@debbugs.gnu.org; Thu, 12 Jan 2012 16:34:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RlSHg-0006bY-U3 for submit@debbugs.gnu.org; Thu, 12 Jan 2012 16:34:10 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([140.186.70.17]:53006) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlSHg-0006bS-Qq for submit@debbugs.gnu.org; Thu, 12 Jan 2012 16:34:08 -0500 Received: from eggs.gnu.org ([140.186.70.92]:57352) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlSHf-000817-AA for bug-gnu-emacs@gnu.org; Thu, 12 Jan 2012 16:34:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RlSHd-0006aY-HI for bug-gnu-emacs@gnu.org; Thu, 12 Jan 2012 16:34:07 -0500 Received: from lo.gmane.org ([80.91.229.12]:34589) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlSHd-0006Zj-23 for bug-gnu-emacs@gnu.org; Thu, 12 Jan 2012 16:34:05 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RlSHa-0002Ia-Em for bug-gnu-emacs@gnu.org; Thu, 12 Jan 2012 22:34:02 +0100 Received: from 121.77.197.77.rev.sfr.net ([77.197.77.121]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 12 Jan 2012 22:34:02 +0100 Received: from thierry.volpiatto by 121.77.197.77.rev.sfr.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 12 Jan 2012 22:34:02 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Date: Thu, 12 Jan 2012 22:33:38 +0100 Lines: 98 Message-ID: <87sjjkfvwt.fsf@gmail.com> References: <87mx9su32g.fsf@web.de> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 121.77.197.77.rev.sfr.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) Cancel-Lock: sha1:04kkHZjcDkrt+QtrIuP0dFFrIHY= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, here a patch tha should fix this. I resent it because I am not sure precedent post have been sent. Michael Heerdegen writes: > Hello, > > start emacs -Q. > > Suppose you have a directory "~/Test". Do C-x d ~ RET. Jump to the > line showing "Test". Hit C and enter "~/Test". Answer "yes" to the > > Recursive copies of /home/micha/Test? (yes or no)=20 > > question. > > This creates an huge recursive hierarchy of "Test" directories > > ~/Test/Test/Test/Test/Test/Test/Test/Test/Test/Test/Test/Test/... > > The error > > copy-directory: Variable binding depth exceeds max-specpdl-size > > finally stops that. > > The user may do something like that per accident. Emacs should IMHO not > behave like that. > > The problem also appears in Emacs 23. =2D-=20 Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997=20 --=-=-= Content-Type: application/octet-stream Content-Disposition: attachment; filename=patch-r118414 Content-Transfer-Encoding: base64 IyBIRyBjaGFuZ2VzZXQgcGF0Y2gKIyBVc2VyIFRoaWVycnkgVm9scGlhdHRvIDx0aGllcnJ5LnZv bHBpYXR0b0BnbWFpbC5jb20+CiMgRGF0ZSAxMzI2NDAyNTI3IC0zNjAwCiMgTm9kZSBJRCAwYjM5 ODQxZTRjMjJhYTJlMjQxZjE4NTEzNmM4ZmNlYzVkOWFjZjE4CiMgUGFyZW50ICA0MDJkNjI2MTJk YWY3NjUyMjE5NGYyYThkMDI0NjNjYmJkNjQ2MjZlCkZpeCBlcnJvciB3aGVuIHRyeWluZyB0byBj b3B5IGRpcmVjdG9yeSBvbiBpdHNlbGYgKGJ1ZyMxMDQ4OSkuCiogbGlzcC9kaXJlZC1hdXguZWwg KGRpcmVkLWNvcHktZmlsZS1yZWN1cnNpdmUpOiBFcnJvciB3aGVuIHRyeWluZyB0byBjb3B5IGZp bGUgb3IgZGlyIG9uIGl0c2VsZi4KKGRpcmVkLWNyZWF0ZS1maWxlKTogQmUgc3VyZSBkZXN0aW5h dGlvbiBpcyBzZXQgd2hlbiBmcm9tIGFuZCB0byBhcmUgdGhlIHNhbWUgZmlsZS9kaXIuCiogbGlz cC9maWxlcy5lbCAoY29weS1kaXJlY3RvcnkpOiBFcnJvciB3aGVuIHRyeWluZyB0byBjb3B5IGZp bGUgb3IgZGlyIG9uIGl0c2VsZi4KCmRpZmYgLS1naXQgYS9saXNwL2RpcmVkLWF1eC5lbCBiL2xp c3AvZGlyZWQtYXV4LmVsCi0tLSBhL2xpc3AvZGlyZWQtYXV4LmVsCisrKyBiL2xpc3AvZGlyZWQt YXV4LmVsCkBAIC0xMjY0LDYgKzEyNjQsOSBAQAogCiAoZGVmdW4gZGlyZWQtY29weS1maWxlLXJl Y3Vyc2l2ZSAoZnJvbSB0byBvay1mbGFnICZvcHRpb25hbAogCQkJCSAgICAgICBwcmVzZXJ2ZS10 aW1lIHRvcCByZWN1cnNpdmUpCisgICh3aGVuIChzdHJpbmc9IChmaWxlLW5hbWUtYXMtZGlyZWN0 b3J5IGZyb20pCisgICAgICAgICAgICAgICAgIChmaWxlLW5hbWUtYXMtZGlyZWN0b3J5IHRvKSkK KyAgICAoZXJyb3IgIkNhbid0IGNvcHkgdG8gc2FtZSBkaXJlY3RvcnkiKSkKICAgKGxldCAoKGF0 dHJzIChmaWxlLWF0dHJpYnV0ZXMgZnJvbSkpKQogICAgIChpZiAoYW5kIHJlY3Vyc2l2ZQogCSAg ICAgKGVxIHQgKGNhciBhdHRycykpCkBAIC0xNDMxLDcgKzE0MzQsMTAgQEAKICAgICAgICAgICAg ICAgICAgICAgICAgICAobWFya2VyLWNoYXIgKGRpcmVkLWZpbGUtbWFya2VyIGZyb20pKSA7IHNs b3cKICAgICAgICAgICAgICAgICAgICAgICAgICAodCBuaWwpKSkpCiAJICAgICh3aGVuIChhbmQg KGZpbGUtZGlyZWN0b3J5LXAgZnJvbSkKLQkJICAgICAgIChmaWxlLWRpcmVjdG9yeS1wIHRvKQor CQkgICAgICAgKG9yIChmaWxlLWRpcmVjdG9yeS1wIHRvKQorICAgICAgICAgICAgICAgICAgICAg ICAgICAgKHN0cmluZz0gKGZpbGUtbmFtZS1hcy1kaXJlY3RvcnkgZnJvbSkKKyAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIChmaWxlLW5hbWUtYXMtZGlyZWN0b3J5CisgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGZpbGUtbmFtZS1kaXJlY3RvcnkgdG8pKSkp CiAJCSAgICAgICAoZXEgZmlsZS1jcmVhdG9yICdkaXJlZC1jb3B5LWZpbGUpKQogCSAgICAgIChz ZXRxIHRvIChmaWxlLW5hbWUtZGlyZWN0b3J5IHRvKSkpCiAgICAgICAgICAgICAoY29uZGl0aW9u LWNhc2UgZXJyCmRpZmYgLS1naXQgYS9saXNwL2ZpbGVzLmVsIGIvbGlzcC9maWxlcy5lbAotLS0g YS9saXNwL2ZpbGVzLmVsCisrKyBiL2xpc3AvZmlsZXMuZWwKQEAgLTQ5MjgsNiArNDkyOCw5IEBA CiAJICAgIChmb3JtYXQgIkNvcHkgZGlyZWN0b3J5ICVzIHRvOiAiIGRpcikKIAkgICAgZGVmYXVs dC1kaXJlY3RvcnkgZGVmYXVsdC1kaXJlY3RvcnkgbmlsIG5pbCkKIAkgICBjdXJyZW50LXByZWZp eC1hcmcgdCBuaWwpKSkKKyAgKHdoZW4gKHN0cmluZz0gKGZpbGUtbmFtZS1hcy1kaXJlY3Rvcnkg ZGlyZWN0b3J5KQorICAgICAgICAgICAgICAgICAoZmlsZS1uYW1lLWFzLWRpcmVjdG9yeSBuZXdu YW1lKSkKKyAgICAoZXJyb3IgIkNhbid0IGNvcHkgdG8gc2FtZSBkaXJlY3RvcnkiKSkKICAgOzsg SWYgZGVmYXVsdC1kaXJlY3RvcnkgaXMgYSByZW1vdGUgZGlyZWN0b3J5LCBtYWtlIHN1cmUgd2Ug ZmluZCBpdHMKICAgOzsgY29weS1kaXJlY3RvcnkgaGFuZGxlci4KICAgKGxldCAoKGhhbmRsZXIg KG9yIChmaW5kLWZpbGUtbmFtZS1oYW5kbGVyIGRpcmVjdG9yeSAnY29weS1kaXJlY3RvcnkpCg== --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAk8PUbIACgkQKNF/U1nymZdnCACgjYkycryWF/CSiwzHMvvtacWu h0cAoKqoVLL3rLb0PK3/q0sPigZIU2sy =HLyJ -----END PGP SIGNATURE----- --==-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 02:24:38 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 07:24:38 +0000 Received: from localhost ([127.0.0.1]:55783 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlbV8-00012O-EE for submit@debbugs.gnu.org; Fri, 13 Jan 2012 02:24:38 -0500 Received: from mtaout22.012.net.il ([80.179.55.172]:61350) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlbV5-00012F-NY for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 02:24:37 -0500 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0LXQ0070077IKC00@a-mtaout22.012.net.il> for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 09:23:52 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.124.136.230]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LXQ0065W77RRPC0@a-mtaout22.012.net.il>; Fri, 13 Jan 2012 09:23:52 +0200 (IST) Date: Fri, 13 Jan 2012 09:23:57 +0200 From: Eli Zaretskii Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy In-reply-to: <87sjjkfvwt.fsf@gmail.com> X-012-Sender: halo1@inter.net.il To: Thierry Volpiatto Message-id: <8362ggkquq.fsf@gnu.org> References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) > From: Thierry Volpiatto > Date: Thu, 12 Jan 2012 22:33:38 +0100 > > Hi, here a patch that should fix this. Thanks. > + (when (string= (file-name-as-directory from) > + (file-name-as-directory to)) > + (error "Can't copy to same directory")) > (let ((attrs (file-attributes from))) > (if (and recursive > (eq t (car attrs)) > @@ -1431,7 +1434,10 @@ > (marker-char (dired-file-marker from)) ; slow > (t nil)))) > (when (and (file-directory-p from) > - (file-directory-p to) > + (or (file-directory-p to) > + (string= (file-name-as-directory from) > + (file-name-as-directory > + (file-name-directory to)))) > (eq file-creator 'dired-copy-file)) > (setq to (file-name-directory to))) > (condition-case err > diff --git a/lisp/files.el b/lisp/files.el > --- a/lisp/files.el > +++ b/lisp/files.el > @@ -4928,6 +4928,9 @@ > (format "Copy directory %s to: " dir) > default-directory default-directory nil nil) > current-prefix-arg t nil))) > + (when (string= (file-name-as-directory directory) > + (file-name-as-directory newname)) > + (error "Can't copy to same directory")) > ;; If default-directory is a remote directory, make sure we find its > ;; copy-directory handler. > (let ((handler (or (find-file-name-handler directory 'copy-directory) I don't think this will solves all the use cases. File names are not strings, you cannot compare them as literal strings and hope to plumb all the leaks. Some situations which I think this patch will not handle correctly: . file names with different letter-case on a case-insensitive file system . relative vs absolute file names . file names that are hard links to the same directory (this includes the infamous 8+3 short aliases on Windows) I didn't actually try the patch, so apologies if I missed something which makes these non-issues. Thanks again for working on this. From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 03:39:16 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 08:39:16 +0000 Received: from localhost ([127.0.0.1]:55816 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlcfL-0002kQ-60 for submit@debbugs.gnu.org; Fri, 13 Jan 2012 03:39:15 -0500 Received: from mail-we0-f172.google.com ([74.125.82.172]:48361) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlcfI-0002kI-Hc for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 03:39:14 -0500 Received: by werl4 with SMTP id l4so206310wer.3 for <10489@debbugs.gnu.org>; Fri, 13 Jan 2012 00:38:36 -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=6MKQa0SuOzf+AHgPTFS0quY51peCtBDkxxYLyjMVS3M=; b=EGh6dOlk1TEFdwzq3FzCrdxpFxdNq8UbMM5i4OEXgG3o9cZ2JrjX+u8+pjiqYIn0Cj btP8UEdB87BoO/KVfYefJ5T+NyJUj9eYkNydOY5qyia4NdinU6xcv1qP9sFEUzRwppxi NtiQ9NSn7Jpk7mhIbASaIJgYq0cUnb4tHIqdA= Received: by 10.216.134.162 with SMTP id s34mr573096wei.59.1326443915836; Fri, 13 Jan 2012 00:38:35 -0800 (PST) Received: from thierry-MM061 (121.77.197.77.rev.sfr.net. [77.197.77.121]) by mx.google.com with ESMTPS id o1sm9211114wbh.9.2012.01.13.00.38.32 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 13 Jan 2012 00:38:34 -0800 (PST) From: Thierry Volpiatto To: Eli Zaretskii Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> Date: Fri, 13 Jan 2012 09:38:30 +0100 In-Reply-To: <8362ggkquq.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 13 Jan 2012 09:23:57 +0200") Message-ID: <87pqeoro8p.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Hi Eli, Eli Zaretskii writes: > I don't think this will solves all the use cases. File names are not > strings, you cannot compare them as literal strings and hope to plumb > all the leaks. A test with `equal' is already used in `dired-create-files', (equal from to) Is it the correct way to compare two filenames? > Some situations which I think this patch will not handle correctly: > > . file names with different letter-case on a case-insensitive file > system Can you provide example or better a recipe. > . relative vs absolute file names Same. > . file names that are hard links to the same directory (this includes > the infamous 8+3 short aliases on Windows) Don't know on Windows, (My knowledge of links in windows is very limited) here it is difficult (impossible as User) to Hardlink a directory: --8<---------------cut here---------------start------------->8--- man ln: -d, -F, --directory allow the superuser to attempt to hard link directories (note: will probably fail due to system restrictions, even for the superuser) --8<---------------cut here---------------end--------------->8--- > I didn't actually try the patch, so apologies if I missed something > which makes these non-issues. Didn't try yet on Windows. However, it is working fine for common usage on GNU/Linux, with M-x copy-directory M-: (dired-copy-file/recursive x y) and `C' from dired. Would be great you try it for the use cases you describe above. (Maybe with a version of the patch that use `equal') -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 04:40:04 2012 Received: (at submit) by debbugs.gnu.org; 13 Jan 2012 09:40:04 +0000 Received: from localhost ([127.0.0.1]:55840 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RldcA-0004AD-LC for submit@debbugs.gnu.org; Fri, 13 Jan 2012 04:40:03 -0500 Received: from eggs.gnu.org ([140.186.70.92]:51782) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rldc7-00049k-7p for submit@debbugs.gnu.org; Fri, 13 Jan 2012 04:40:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RldbR-0007Qr-GE for submit@debbugs.gnu.org; Fri, 13 Jan 2012 04:39:23 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([140.186.70.17]:49705) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RldbR-0007Qn-Ep for submit@debbugs.gnu.org; Fri, 13 Jan 2012 04:39:17 -0500 Received: from eggs.gnu.org ([140.186.70.92]:44937) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RldbN-0004lE-CR for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2012 04:39:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RldbM-0007QA-7g for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2012 04:39:13 -0500 Received: from lo.gmane.org ([80.91.229.12]:44955) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RldbL-0007Pg-Sy for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2012 04:39:12 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RldbA-0002zD-2V for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2012 10:39:00 +0100 Received: from 121.77.197.77.rev.sfr.net ([77.197.77.121]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 13 Jan 2012 10:39:00 +0100 Received: from thierry.volpiatto by 121.77.197.77.rev.sfr.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 13 Jan 2012 10:39:00 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Date: Fri, 13 Jan 2012 10:38:45 +0100 Lines: 85 Message-ID: <87lipcrlga.fsf@gmail.com> References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 121.77.197.77.rev.sfr.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) Cancel-Lock: sha1:DWNfxmXFkwFaenc5YdxQCkw26z0= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) --=-=-= Content-Type: text/plain Eli Zaretskii writes: > I don't think this will solves all the use cases. File names are not > strings, you cannot compare them as literal strings and hope to plumb > all the leaks. > > Some situations which I think this patch will not handle correctly: > > . file names with different letter-case on a case-insensitive file > system > > . relative vs absolute file names > > . file names that are hard links to the same directory (this includes > the infamous 8+3 short aliases on Windows) > > I didn't actually try the patch, so apologies if I missed something > which makes these non-issues. > Here a version of the patch that use `equal' and handle also same error on remotes files. i.e (copy-directory "/sudo:host:/home/user/Test" "/home/user/Test") -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=Singlepatch-r118414ToTip.patch ##Merge of all patches applied from revision 118413 ## patch-r118414: Fix error when trying to copy directory on itself (bug#10489). ## patch-r118415: * lisp/dired-aux.el (dired-copy-file-recursive): Handle also remote file/dir. ## diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1264,6 +1264,11 @@ (defun dired-copy-file-recursive (from to ok-flag &optional preserve-time top recursive) + (when (equal (or (file-remote-p (file-name-as-directory from) 'localname) + (file-name-as-directory from)) + (or (file-remote-p (file-name-as-directory to) 'localname) + (file-name-as-directory to))) + (error "Can't copy directory `%s' on itself" from)) (let ((attrs (file-attributes from))) (if (and recursive (eq t (car attrs)) @@ -1431,7 +1436,12 @@ (marker-char (dired-file-marker from)) ; slow (t nil)))) (when (and (file-directory-p from) - (file-directory-p to) + (or (equal (or (file-remote-p (file-name-as-directory from) 'localname) + (file-name-as-directory from)) + (or (file-remote-p (file-name-as-directory to) 'localname) + (file-name-as-directory + (file-name-directory to)))) + (file-directory-p to)) (eq file-creator 'dired-copy-file)) (setq to (file-name-directory to))) (condition-case err diff --git a/lisp/files.el b/lisp/files.el --- a/lisp/files.el +++ b/lisp/files.el @@ -4928,6 +4928,11 @@ (format "Copy directory %s to: " dir) default-directory default-directory nil nil) current-prefix-arg t nil))) + (when (equal (or (file-remote-p (file-name-as-directory directory) 'localname) + (file-name-as-directory directory)) + (or (file-remote-p (file-name-as-directory newname) 'localname) + (file-name-as-directory newname))) + (error "Can't copy directory `%s' on itself" from)) ;; If default-directory is a remote directory, make sure we find its ;; copy-directory handler. (let ((handler (or (find-file-name-handler directory 'copy-directory) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 04:50:08 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 09:50:08 +0000 Received: from localhost ([127.0.0.1]:55844 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rldlw-0004Or-7u for submit@debbugs.gnu.org; Fri, 13 Jan 2012 04:50:08 -0500 Received: from mailout-de.gmx.net ([213.165.64.23]:47774) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1Rldlt-0004Oj-Hq for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 04:50:06 -0500 Received: (qmail invoked by alias); 13 Jan 2012 09:49:27 -0000 Received: from p57BB9670.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.150.112] by mail.gmx.net (mp007) with SMTP; 13 Jan 2012 10:49:27 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX18C8Zsmcn0C5f0YOB9YY3oIFVJ+Pa1QTisTOhtaaf zEo+kKtb5q48bE From: Michael Albinus To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> Date: Fri, 13 Jan 2012 10:49:24 +0100 In-Reply-To: <87lipcrlga.fsf@gmail.com> (Thierry Volpiatto's message of "Fri, 13 Jan 2012 10:38:45 +0100") Message-ID: <87fwfkc4pn.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Thierry Volpiatto writes: > Here a version of the patch that use `equal' and handle also same error > on remotes files. > i.e (copy-directory "/sudo:host:/home/user/Test" "/home/user/Test") Your code seems also to suppress (copy-directory "/sssh:remotehost:/home/user/Test" "/home/user/Test") Why that? Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 05:32:18 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 10:32:18 +0000 Received: from localhost ([127.0.0.1]:55863 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RleQk-0005M1-7c for submit@debbugs.gnu.org; Fri, 13 Jan 2012 05:32:18 -0500 Received: from mtaout22.012.net.il ([80.179.55.172]:49763) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RleQh-0005Lq-Ir for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 05:32:16 -0500 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0LXQ00900FVFXG00@a-mtaout22.012.net.il> for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 12:31:37 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.124.136.230]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LXQ009SNFWON180@a-mtaout22.012.net.il>; Fri, 13 Jan 2012 12:31:37 +0200 (IST) Date: Fri, 13 Jan 2012 12:31:42 +0200 From: Eli Zaretskii Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy In-reply-to: <87pqeoro8p.fsf@gmail.com> X-012-Sender: halo1@inter.net.il To: Thierry Volpiatto Message-id: <83wr8vki5t.fsf@gnu.org> References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87pqeoro8p.fsf@gmail.com> X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) > From: Thierry Volpiatto > Cc: 10489@debbugs.gnu.org > Date: Fri, 13 Jan 2012 09:38:30 +0100 > > > I don't think this will solves all the use cases. File names are not > > strings, you cannot compare them as literal strings and hope to plumb > > all the leaks. > A test with `equal' is already used in `dired-create-files', > (equal from to) > Is it the correct way to compare two filenames? I don't see how `equal' could help, unless someone teaches it to treat strings that are file names specially. I don't see such treatment in the current sources. > > Some situations which I think this patch will not handle correctly: > > > > . file names with different letter-case on a case-insensitive file > > system > Can you provide example or better a recipe. emacs -Q C-x d ~ RET C ~/test RET yes RET > > . relative vs absolute file names > Same. M-: (dired-copy-file-recursive "foo/../Test" "./Test" t) RET > > . file names that are hard links to the same directory (this includes > > the infamous 8+3 short aliases on Windows) > Don't know on Windows, (My knowledge of links in windows is very > limited) > here it is difficult (impossible as User) to Hardlink a directory: > > --8<---------------cut here---------------start------------->8--- > man ln: > -d, -F, --directory > allow the superuser to attempt to hard link directories > (note: will probably fail due to system restrictions, > even for the superuser) > --8<---------------cut here---------------end--------------->8--- We don't disallow superusers from using Emacs, nor restrict Emacs usage only to filesystems where links to directories are impossible, do we? ;-) And what about symlinks? On Windows, you can have "C:/PROGRA~1" be the alias of "C:/Program Files", for example. Bottom line, I think you need: . make both file names absolute by calling expand-file-name on each . resolve links by calling file-truename on each (this will handle the 8+3 alias issue, as well as, AFAIK, the issue with links) . compare case-insensitively on MS-Windows and MS-DOS From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 05:33:18 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 10:33:18 +0000 Received: from localhost ([127.0.0.1]:55867 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RleRh-0005Nf-KM for submit@debbugs.gnu.org; Fri, 13 Jan 2012 05:33:17 -0500 Received: from mtaout22.012.net.il ([80.179.55.172]:49985) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RleRZ-0005NP-BB for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 05:33:17 -0500 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0LXQ00900FP4WH00@a-mtaout22.012.net.il> for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 12:32:32 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.124.136.230]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LXQ00950FY2MT90@a-mtaout22.012.net.il>; Fri, 13 Jan 2012 12:32:27 +0200 (IST) Date: Fri, 13 Jan 2012 12:32:32 +0200 From: Eli Zaretskii Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy In-reply-to: <87lipcrlga.fsf@gmail.com> X-012-Sender: halo1@inter.net.il To: Thierry Volpiatto Message-id: <83vcofki4f.fsf@gnu.org> References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) > From: Thierry Volpiatto > Date: Fri, 13 Jan 2012 10:38:45 +0100 > > Here a version of the patch that use `equal' Thanks, but as I wrote elsewhere, I don't think using `equal' will help. From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 06:02:03 2012 Received: (at submit) by debbugs.gnu.org; 13 Jan 2012 11:02:03 +0000 Received: from localhost ([127.0.0.1]:55885 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RletW-00061c-6M for submit@debbugs.gnu.org; Fri, 13 Jan 2012 06:02:02 -0500 Received: from eggs.gnu.org ([140.186.70.92]:37691) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RletS-00061N-VP for submit@debbugs.gnu.org; Fri, 13 Jan 2012 06:02:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rlesm-0002XR-IT for submit@debbugs.gnu.org; Fri, 13 Jan 2012 06:01:22 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([140.186.70.17]:51817) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rlesm-0002XN-H0 for submit@debbugs.gnu.org; Fri, 13 Jan 2012 06:01:16 -0500 Received: from eggs.gnu.org ([140.186.70.92]:53446) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rlesc-0004qX-UX for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2012 06:01:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RlesS-0002Vb-MD for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2012 06:01:06 -0500 Received: from lo.gmane.org ([80.91.229.12]:49572) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlesS-0002VP-D6 for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2012 06:00:56 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RlesQ-0007NZ-QA for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2012 12:00:54 +0100 Received: from 121.77.197.77.rev.sfr.net ([77.197.77.121]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 13 Jan 2012 12:00:54 +0100 Received: from thierry.volpiatto by 121.77.197.77.rev.sfr.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 13 Jan 2012 12:00:54 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Date: Fri, 13 Jan 2012 12:00:18 +0100 Lines: 177 Message-ID: <87fwfjsw8t.fsf@gmail.com> References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 121.77.197.77.rev.sfr.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) Cancel-Lock: sha1:aK/501LspyIUzF/BwaIcee4UIqw= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi Michael, Michael Albinus writes: > Thierry Volpiatto writes: > >> Here a version of the patch that use `equal' and handle also same error >> on remotes files. >> i.e (copy-directory "/sudo:host:/home/user/Test" "/home/user/Test") > > Your code seems also to suppress > > (copy-directory "/sssh:remotehost:/home/user/Test" "/home/user/Test") > > Why that? Because I forget to handle this case ;-). Here the patch modified that handle this. I want to only suppress the use of: (copy-directory "/sudo:host:/home/user/Test" "/home/user/Test") or (copy-directory "/sudo:host:/home/user/Test" "/sudo:host:/home/user/Test") =2D-=20 Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997=20 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=Singlepatch-r118414ToTip.patch Content-Transfer-Encoding: quoted-printable ##Merge of all patches applied from revision 118413 ## patch-r118414: Fix error when trying to copy directory on itself (bug#10= 489). ## patch-r118415: * lisp/dired-aux.el (dired-copy-file-recursive): Handle a= lso remote file/dir. ## patch-r118416: "New patch" ##=20 diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el =2D-- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1264,6 +1264,13 @@ =20 (defun dired-copy-file-recursive (from to ok-flag &optional preserve-time top recursive) + (when (equal (or (and (equal "sudo" (file-remote-p (file-name-as-directo= ry from) 'method)) + (file-remote-p (file-name-as-directory from) 'loca= lname)) + (file-name-as-directory from)) + (or (and (equal "sudo" (file-remote-p (file-name-as-directo= ry to) 'method)) + (file-remote-p (file-name-as-directory to) 'localn= ame)) + (file-name-as-directory to))) + (error "Can't copy directory `%s' on itself" from)) (let ((attrs (file-attributes from))) (if (and recursive (eq t (car attrs)) @@ -1402,7 +1409,7 @@ newfile's entry, or t to use the current marker character if the old file was marked." (let (dired-create-files-failures failures =2D skipped (success-count 0) (total (length fn-list))) + skipped (success-count 0) (total (leng= th fn-list))) (let (to overwrite-query overwrite-backup-query) ; for dired-handle-overwrite (dolist (from fn-list) @@ -1431,7 +1438,28 @@ (marker-char (dired-file-marker from)) ; slow (t nil)))) (when (and (file-directory-p from) =2D (file-directory-p to) + (or + (equal + ;; Test if 'from' + ;; is a remote file localname with sudo method. + (or (and (equal + "sudo" + (file-remote-p (file-name-as-directory = from) + 'method)) + (file-remote-p (file-name-as-directory f= rom) + 'localname)) + (file-name-as-directory from)) + ;; Test if 'to' + ;; is a remote file localname with sudo method. + (or (and (equal + "sudo" + (file-remote-p (file-name-as-directory = to) + 'method)) + (file-remote-p (file-name-as-directory + (file-name-directory to)) + 'localname)) + (file-name-as-directory (file-name-directory = to)))) + (file-directory-p to)) (eq file-creator 'dired-copy-file)) (setq to (file-name-directory to))) (condition-case err @@ -1456,21 +1484,21 @@ (setq failures (nconc failures dired-create-files-failures)) (dired-log-summary (format "%s failed for %d file%s in %d requests" =2D operation (length failures) =2D (dired-plural-s (length failures)) =2D total) + operation (length failures) + (dired-plural-s (length failures)) + total) failures)) (failures (dired-log-summary (format "%s failed for %d of %d file%s" =2D operation (length failures) =2D total (dired-plural-s total)) + operation (length failures) + total (dired-plural-s total)) failures)) (skipped (dired-log-summary (format "%s: %d of %d file%s skipped" =2D operation (length skipped) total =2D (dired-plural-s total)) + operation (length skipped) total + (dired-plural-s total)) skipped)) (t (message "%s: %s file%s" diff --git a/lisp/files.el b/lisp/files.el =2D-- a/lisp/files.el +++ b/lisp/files.el @@ -4928,6 +4928,13 @@ (format "Copy directory %s to: " dir) default-directory default-directory nil nil) current-prefix-arg t nil))) + (when (equal (or (and (equal "sudo" (file-remote-p (file-name-as-directo= ry directory) 'method)) + (file-remote-p (file-name-as-directory directory) = 'localname)) + (file-name-as-directory directory)) + (or (and (equal "sudo" (file-remote-p (file-name-as-directo= ry newname) 'method)) + (file-remote-p (file-name-as-directory newname) 'l= ocalname)) + (file-name-as-directory newname))) + (error "Can't copy directory `%s' on itself" directory)) ;; If default-directory is a remote directory, make sure we find its ;; copy-directory handler. (let ((handler (or (find-file-name-handler directory 'copy-directory) --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAk8QDsIACgkQKNF/U1nymZc8jgCgn/HfLQFe5VNkLZR1tyCQ1m5X iWQAn3NpW4ClBWER/DZEUgrf2wzkMl/N =v2yZ -----END PGP SIGNATURE----- --==-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 06:20:11 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 11:20:11 +0000 Received: from localhost ([127.0.0.1]:55894 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlfB5-0006Wc-CY for submit@debbugs.gnu.org; Fri, 13 Jan 2012 06:20:11 -0500 Received: from mail-we0-f172.google.com ([74.125.82.172]:43151) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlfAz-0006WQ-4x for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 06:20:09 -0500 Received: by werl4 with SMTP id l4so318494wer.3 for <10489@debbugs.gnu.org>; Fri, 13 Jan 2012 03:19:27 -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=ALDymuTBxz3wnzLnyPnUtgcQEMA19c4eH9FyxeWDfZs=; b=l5Bx9aOm7bzXpVFwAz2cW5PePqeF6cJ8TqizAE6snRxtjbsEWvn2zYUQAqzKfeoGuY vI9KCm/JgjXcCntEZ+9a3FAUlLIHhgLeUjXHHXuKsmCkk4GP5eCIcPVl5viuaZkVo87Y lm4Az9zr4MX3pBfJjaZbsFMdlGWomLrus7qU8= Received: by 10.216.137.195 with SMTP id y45mr1992794wei.45.1326453567856; Fri, 13 Jan 2012 03:19:27 -0800 (PST) Received: from thierry-MM061 (121.77.197.77.rev.sfr.net. [77.197.77.121]) by mx.google.com with ESMTPS id q5sm10660539wbo.8.2012.01.13.03.19.25 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 13 Jan 2012 03:19:26 -0800 (PST) From: Thierry Volpiatto To: Eli Zaretskii Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87pqeoro8p.fsf@gmail.com> <83wr8vki5t.fsf@gnu.org> Date: Fri, 13 Jan 2012 12:19:23 +0100 In-Reply-To: <83wr8vki5t.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 13 Jan 2012 12:31:42 +0200") Message-ID: <878vlbsvd0.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Eli Zaretskii writes: >> From: Thierry Volpiatto >> Cc: 10489@debbugs.gnu.org >> Date: Fri, 13 Jan 2012 09:38:30 +0100 >> >> > I don't think this will solves all the use cases. File names are not >> > strings, you cannot compare them as literal strings and hope to plumb >> > all the leaks. >> A test with `equal' is already used in `dired-create-files', >> (equal from to) >> Is it the correct way to compare two filenames? > > I don't see how `equal' could help, unless someone teaches it to treat > strings that are file names specially. I don't see such treatment in > the current sources. > >> > Some situations which I think this patch will not handle correctly: >> > >> > . file names with different letter-case on a case-insensitive file >> > system >> Can you provide example or better a recipe. > > emacs -Q > C-x d ~ RET > > C ~/test RET > yes RET > >> > . relative vs absolute file names >> Same. > > M-: (dired-copy-file-recursive "foo/../Test" "./Test" t) RET > >> > . file names that are hard links to the same directory (this includes >> > the infamous 8+3 short aliases on Windows) >> Don't know on Windows, (My knowledge of links in windows is very >> limited) >> here it is difficult (impossible as User) to Hardlink a directory: >> >> --8<---------------cut here---------------start------------->8--- >> man ln: >> -d, -F, --directory >> allow the superuser to attempt to hard link directories >> (note: will probably fail due to system restrictions, >> even for the superuser) >> --8<---------------cut here---------------end--------------->8--- > > We don't disallow superusers from using Emacs, nor restrict Emacs > usage only to filesystems where links to directories are impossible, > do we? ;-) I just want to be able to test: cp "a_hardlink_of_/foo" "/foo" > And what about symlinks? > > On Windows, you can have "C:/PROGRA~1" be the alias of > "C:/Program Files", for example. > > Bottom line, I think you need: > > . make both file names absolute by calling expand-file-name on each Ok > . resolve links by calling file-truename on each (this will handle > the 8+3 alias issue, as well as, AFAIK, the issue with links) Ok > . compare case-insensitively on MS-Windows and MS-DOS let binding case-fold-search should be ok. Thanks, I will add these modifications to the patch handling remote files. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 07:03:16 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 12:03:16 +0000 Received: from localhost ([127.0.0.1]:55912 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rlfqi-0007Zt-SO for submit@debbugs.gnu.org; Fri, 13 Jan 2012 07:03:14 -0500 Received: from mail-pz0-f44.google.com ([209.85.210.44]:59475) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rlfqd-0007Zh-So for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 07:03:09 -0500 Received: by dadq14 with SMTP id q14so227692dad.3 for <10489@debbugs.gnu.org>; Fri, 13 Jan 2012 04:02:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=RBMtkm38QwkFaWL+XzlvabZtN4ewXFVXe+18kW/37S0=; b=BHBin4N8V9C2c4U5zpSplpfLON7xReiJMEfhpFpFAvM4UntaF+nSQNIqgba3VlP/fU nk3a+9po8D+wpMfnL+5vRnXh5tbA1y8KAsHHN0vZoWsbKijFdNwNVXJU+96RP9+AKrNA apiOmwy7ppkJi3rfnXLaZYVBx6lZpgJarjQzQ= Received: by 10.68.72.73 with SMTP id b9mr1319245pbv.67.1326456150205; Fri, 13 Jan 2012 04:02:30 -0800 (PST) MIME-Version: 1.0 Received: by 10.142.247.28 with HTTP; Fri, 13 Jan 2012 04:01:49 -0800 (PST) In-Reply-To: <83wr8vki5t.fsf@gnu.org> References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87pqeoro8p.fsf@gmail.com> <83wr8vki5t.fsf@gnu.org> From: Juanma Barranquero Date: Fri, 13 Jan 2012 13:01:49 +0100 Message-ID: Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy To: Eli Zaretskii Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On Fri, Jan 13, 2012 at 11:31, Eli Zaretskii wrote: > Bottom line, I think you need: > > =C2=A0. make both file names absolute by calling expand-file-name on each > > =C2=A0. resolve links by calling file-truename on each (this will handle > =C2=A0 =C2=A0the 8+3 alias issue, as well as, AFAIK, the issue with links= ) > > =C2=A0. compare case-insensitively on MS-Windows and MS-DOS 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=3D n1 n2))) ? =C2=A0 =C2=A0 Juanma From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 07:42:08 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 12:42:08 +0000 Received: from localhost ([127.0.0.1]:55958 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlgSN-0000ny-TT for submit@debbugs.gnu.org; Fri, 13 Jan 2012 07:42:08 -0500 Received: from mtaout20.012.net.il ([80.179.55.166]:59753) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlgSK-0000nn-Gz for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 07:42:06 -0500 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0LXQ00M00LWH1O00@a-mtaout20.012.net.il> for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 14:41:25 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.124.136.230]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LXQ00KOZLX0RZD0@a-mtaout20.012.net.il>; Fri, 13 Jan 2012 14:41:25 +0200 (IST) Date: Fri, 13 Jan 2012 14:41:30 +0200 From: Eli Zaretskii Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy In-reply-to: To: Juanma Barranquero Message-id: <83mx9rkc5h.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-transfer-encoding: QUOTED-PRINTABLE X-012-Sender: halo1@inter.net.il References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87pqeoro8p.fsf@gmail.com> <83wr8vki5t.fsf@gnu.org> X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, thierry.volpiatto@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) > From: Juanma Barranquero > Date: Fri, 13 Jan 2012 13:01:49 +0100 > Cc: Thierry Volpiatto , 10489@debbugs.= gnu.org >=20 > On Fri, Jan 13, 2012 at 11:31, Eli Zaretskii wrote: >=20 > > Bottom line, I think you need: > > > > =C2=A0. make both file names absolute by calling expand-file-name= on each > > > > =C2=A0. resolve links by calling file-truename on each (this will= handle > > =C2=A0 =C2=A0the 8+3 alias issue, as well as, AFAIK, the issue wi= th links) > > > > =C2=A0. compare case-insensitively on MS-Windows and MS-DOS >=20 > As this seems like a common occurrence, how comes that we don't hav= e >=20 > (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=3D n1 n2))) >=20 > ? Because in the past people objected to my saying that file names are not strings. Perhaps they will object now as well. From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 07:49:15 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 12:49:15 +0000 Received: from localhost ([127.0.0.1]:55971 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlgZG-0001ir-Tu for submit@debbugs.gnu.org; Fri, 13 Jan 2012 07:49:15 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:60436) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1RlgZD-0001ii-KR for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 07:49:12 -0500 Received: (qmail invoked by alias); 13 Jan 2012 12:48:33 -0000 Received: from p57BB9670.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.150.112] by mail.gmx.net (mp024) with SMTP; 13 Jan 2012 13:48:33 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX18FCxIKNMMFgxpdoqUANo7kOvQXof6SWFE05zurBT 3Ei0UM/JeeTtVf From: Michael Albinus To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> Date: Fri, 13 Jan 2012 13:48:30 +0100 In-Reply-To: <87fwfjsw8t.fsf@gmail.com> (Thierry Volpiatto's message of "Fri, 13 Jan 2012 12:00:18 +0100") Message-ID: <87aa5rdazl.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Thierry Volpiatto writes: > Hi Michael, Hi Thierry, > I want to only suppress the use of: > (copy-directory "/sudo:host:/home/user/Test" "/home/user/Test") Do you know `tramp-default-proxies-alist'? With that toy, "/sudo:host:" can be another machine but your local one. You really don't know, without going into deep Tramp interna. > (copy-directory "/sudo:host:/home/user/Test" "/sudo:host:/home/user/Test") That would be reasonable to suppress. But you don't need a special remote test for this. Just compare the results of `file-truename', as suggested by Eli. This shall work also for remote files automagically. If somebody wants to apply (copy-directory "/ssh:host:/home/user/Test" "/scp:host:/home/user/Test") you can't suppress. Same for using different hostnames which are aliases for the same machine, etc pp. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 08:01:56 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 13:01:56 +0000 Received: from localhost ([127.0.0.1]:55977 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlglX-00020s-Uq for submit@debbugs.gnu.org; Fri, 13 Jan 2012 08:01:56 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:55979) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1RlglR-00020e-5d for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 08:01:51 -0500 Received: (qmail invoked by alias); 13 Jan 2012 13:01:10 -0000 Received: from p57BB9670.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.150.112] by mail.gmx.net (mp008) with SMTP; 13 Jan 2012 14:01:10 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1/UUn0AbcbUdp5iAw4FsCLIJi5HoHelK0jrs6JSrU N5JfVtof8+2cDo From: Michael Albinus To: Juanma Barranquero Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87pqeoro8p.fsf@gmail.com> <83wr8vki5t.fsf@gnu.org> Date: Fri, 13 Jan 2012 14:01:06 +0100 In-Reply-To: (Juanma Barranquero's message of "Fri, 13 Jan 2012 13:01:49 +0100") Message-ID: <8762gfdael.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: Eli Zaretskii , 10489@debbugs.gnu.org, Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Juanma Barranquero writes: > 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))) 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'. > Juanma Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 08:12:47 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 13:12:48 +0000 Received: from localhost ([127.0.0.1]:55982 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rlgw3-0002Fr-C9 for submit@debbugs.gnu.org; Fri, 13 Jan 2012 08:12:47 -0500 Received: from mail-pw0-f44.google.com ([209.85.160.44]:33621) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rlgw1-0002Fk-3g for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 08:12:45 -0500 Received: by pbbb2 with SMTP id b2so929893pbb.3 for <10489@debbugs.gnu.org>; Fri, 13 Jan 2012 05:12:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=quu1jzVLFLnV6KIADq8e9lNz/JCShB82NJ6gXEkoTWo=; b=HRPtQIoEf+6GQf5+z5J7OAwwjHwHIkqca9nxGxiEWN6j8yLxbm+MervYNWae6WoAx/ O8TpzmZelBleytn8hKbPn/ZAnyVchzE2hK0TafJOXDnfAKLPfo+w+V5XjvvhXG4bOFF4 8awwL1AbOxaunaEWl5W1pr1I9e7WR7BDTK1cw= Received: by 10.68.115.133 with SMTP id jo5mr1761590pbb.50.1326460327233; Fri, 13 Jan 2012 05:12:07 -0800 (PST) MIME-Version: 1.0 Received: by 10.142.247.28 with HTTP; Fri, 13 Jan 2012 05:11:25 -0800 (PST) In-Reply-To: <8762gfdael.fsf@gmx.de> References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87pqeoro8p.fsf@gmail.com> <83wr8vki5t.fsf@gnu.org> <8762gfdael.fsf@gmx.de> From: Juanma Barranquero Date: Fri, 13 Jan 2012 14:11:25 +0100 Message-ID: Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy To: Michael Albinus Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: Eli Zaretskii , 10489@debbugs.gnu.org, Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On Fri, Jan 13, 2012 at 14:01, Michael Albinus wro= te: > 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'. You're right that r-f-n-c-i-c should be used, but as for binding it, that forces you to use a more expensive comparation. Perhaps this is simpler: (defun file-name-compare (name1 name2 &optional dir) "..." (compare-strings (file-truename (expand-file-name name1 dir)) (file-truename (expand-file-name name2 dir)) nil nil read-file-name-completion-ignore-case)) =C2=A0 =C2=A0 Juanma From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 08:14:37 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 13:14:37 +0000 Received: from localhost ([127.0.0.1]:55986 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rlgxp-0002Io-1R for submit@debbugs.gnu.org; Fri, 13 Jan 2012 08:14:37 -0500 Received: from mail-pw0-f44.google.com ([209.85.160.44]:34919) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rlgxn-0002Ih-NK for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 08:14:36 -0500 Received: by pbbb2 with SMTP id b2so930685pbb.3 for <10489@debbugs.gnu.org>; Fri, 13 Jan 2012 05:13:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=I77kHP1LvGT3housZ1rm4cU3HdV5qbtbg7b9jPD5b2U=; b=WjrTmSlVlzEpH1THwgG/gmBrYNjQWU9nYn6urcNKlAtNEkoaTtdd+nnyomK/1PbCvl 0oIzW091br5vcvZA8Qcm1q7wq8hH3S/ZsCSZCkFRWaXbiSEMTpTRBNPJclBrqyoEw/rJ EJlE0+OYQnPwVYbeCLsHFjFp7taA7B9623SXM= Received: by 10.68.73.196 with SMTP id n4mr1831480pbv.33.1326460438265; Fri, 13 Jan 2012 05:13:58 -0800 (PST) MIME-Version: 1.0 Received: by 10.142.247.28 with HTTP; Fri, 13 Jan 2012 05:13:16 -0800 (PST) In-Reply-To: References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87pqeoro8p.fsf@gmail.com> <83wr8vki5t.fsf@gnu.org> <8762gfdael.fsf@gmx.de> From: Juanma Barranquero Date: Fri, 13 Jan 2012 14:13:16 +0100 Message-ID: Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy To: Michael Albinus Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: Eli Zaretskii , 10489@debbugs.gnu.org, Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On Fri, Jan 13, 2012 at 14:11, Juanma Barranquero wrote: > =C2=A0 (compare-strings (file-truename (expand-file-name name1 dir)) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(fil= e-truename (expand-file-name name2 dir)) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0nil = nil > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0read= -file-name-completion-ignore-case)) Sorry, I meant (compare-strings (file-truename (expand-file-name name1 dir)) 0 nil (file-truename (expand-file-name name2 dir)) 0 nil read-file-name-completion-ignore-case)) =C2=A0 =C2=A0 Juanma From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 08:20:25 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 13:20:25 +0000 Received: from localhost ([127.0.0.1]:56005 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rlh3N-0002Rj-0X for submit@debbugs.gnu.org; Fri, 13 Jan 2012 08:20:24 -0500 Received: from mail-pw0-f44.google.com ([209.85.160.44]:48282) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rlh3H-0002RY-Vy for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 08:20:20 -0500 Received: by pbbb2 with SMTP id b2so933216pbb.3 for <10489@debbugs.gnu.org>; Fri, 13 Jan 2012 05:19:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=7Uji+a0xUh2NFt4sAlJwoqoe7rL3O+1vtcY3FacPM6Q=; b=jWRlwRHRrebSMs4xnx+Ql9rWMWxQL0HU63gWlu7tQDsGicG0uB4EVqD3R85WrnV0kL fZ/KuudjrvYuQKndD29GWI5a1RapmvmHQjrVeM8xSJV8DR6oAZVDznrXozef/ACsd5+R py1fdL1EcpMd3X57khaE7zJTEMRTBc5kYKkbU= Received: by 10.68.73.196 with SMTP id n4mr1865353pbv.33.1326460778233; Fri, 13 Jan 2012 05:19:38 -0800 (PST) MIME-Version: 1.0 Received: by 10.142.247.28 with HTTP; Fri, 13 Jan 2012 05:18:57 -0800 (PST) In-Reply-To: References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87pqeoro8p.fsf@gmail.com> <83wr8vki5t.fsf@gnu.org> <8762gfdael.fsf@gmx.de> From: Juanma Barranquero Date: Fri, 13 Jan 2012 14:18:57 +0100 Message-ID: Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy To: Michael Albinus Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: Eli Zaretskii , 10489@debbugs.gnu.org, Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) > =C2=A0(compare-strings (file-truename (expand-file-name name1 dir)) 0 nil > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (file-true= name (expand-file-name name2 dir)) 0 nil > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 read-file-= name-completion-ignore-case)) I think we should push for it to be added to Emacs, if only for the thrill of having a ChangeLog entry 2012-01-13 Michael Albinus Juanma Barranquero Eli Zaretskii * files.el (file-name-compare): New function. i.e., three authors for a three-line function (plus header and comments) ;-= ) =C2=A0 =C2=A0 Juanma From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 08:28:30 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 13:28:30 +0000 Received: from localhost ([127.0.0.1]:56009 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlhBF-0002cg-M9 for submit@debbugs.gnu.org; Fri, 13 Jan 2012 08:28:29 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.183]:65324) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlhBB-0002cW-88 for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 08:28:28 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EAMowEE9FxKkV/2dsb2JhbABCqmWCMoEGgXIBAQQBViMFCws0EhQYDSSIDbcTjB0EiDyaYYRS X-IronPort-AV: E=Sophos;i="4.71,504,1320642000"; d="scan'208";a="156580770" Received: from 69-196-169-21.dsl.teksavvy.com (HELO pastel.home) ([69.196.169.21]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 13 Jan 2012 08:27:47 -0500 Received: by pastel.home (Postfix, from userid 20848) id C8FD159460; Fri, 13 Jan 2012 08:27:46 -0500 (EST) From: Stefan Monnier To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Message-ID: References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87pqeoro8p.fsf@gmail.com> <83wr8vki5t.fsf@gnu.org> <8762gfdael.fsf@gmx.de> Date: Fri, 13 Jan 2012 08:27:46 -0500 In-Reply-To: <8762gfdael.fsf@gmx.de> (Michael Albinus's message of "Fri, 13 Jan 2012 14:01:06 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: Juanma Barranquero , 10489@debbugs.gnu.org, Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) 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 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. Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 08:33:29 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 13:33:30 +0000 Received: from localhost ([127.0.0.1]:56014 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlhG2-0002kL-B7 for submit@debbugs.gnu.org; Fri, 13 Jan 2012 08:33:29 -0500 Received: from mailout-de.gmx.net ([213.165.64.23]:34971) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1RlhFw-0002k0-4K for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 08:33:24 -0500 Received: (qmail invoked by alias); 13 Jan 2012 13:32:36 -0000 Received: from p57BB9670.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.150.112] by mail.gmx.net (mp031) with SMTP; 13 Jan 2012 14:32:36 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX18pCdUv4wMpFY4srzkrKXFf5w0GouNUA6M6dspt7z klz0tiMslGIQ9o From: Michael Albinus To: Juanma Barranquero Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87pqeoro8p.fsf@gmail.com> <83wr8vki5t.fsf@gnu.org> <8762gfdael.fsf@gmx.de> Date: Fri, 13 Jan 2012 14:32:32 +0100 In-Reply-To: (Juanma Barranquero's message of "Fri, 13 Jan 2012 14:18:57 +0100") Message-ID: <871ur3d8y7.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: Eli Zaretskii , 10489@debbugs.gnu.org, Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Juanma Barranquero writes: >> =C2=A0(compare-strings (file-truename (expand-file-name name1 dir)) 0 nil >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (file-tru= ename (expand-file-name name2 dir)) 0 nil >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 read-file= -name-completion-ignore-case)) > > I think we should push for it to be added to Emacs, if only for the > thrill of having a ChangeLog entry > > 2012-01-13 Michael Albinus > Juanma Barranquero > Eli Zaretskii > > * files.el (file-name-compare): New function. > > i.e., three authors for a three-line function (plus header and comments) = ;-) Perfect reasoning, I'm for it :-) Thinking about, `file-truename' would need some massage for the remote case. Currently, it just expands symlinks. But it could also do some normalization for the user and host name. For example: (file-truename "/ssh:127.0.0.1:/path/to/symlink") =3D> "/ssh:albinus@localhost:/extend/path/to/file" But that's for Emacs 24.2, of course. > Juanma Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 08:56:34 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 13:56:34 +0000 Received: from localhost ([127.0.0.1]:56069 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlhcM-0003Ic-Tb for submit@debbugs.gnu.org; Fri, 13 Jan 2012 08:56:34 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:38402) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlhcG-0003IQ-FP for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 08:56:29 -0500 Received: by wibhj6 with SMTP id hj6so430073wib.3 for <10489@debbugs.gnu.org>; Fri, 13 Jan 2012 05:55:46 -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=RSyB1O8F6Eizp0KBatAkXP8kkhrp1ZI4g5d2pkc796U=; b=DM+z4qYiLg6qZng5TYOUhAe83YBWbuf+JtFHifdj08EfXwQcf+OfnKT/zz39rRDl7Y yB0zgp2CvGxs+lsvAfOJvXPcT/r/O24KjVnXCIMeMlMimPkBrKILv090MIZ9ot/Rp1cD 4VKefZvzbWdTHnLMypCzFaRD3LlRpExGeDxaU= Received: by 10.180.95.199 with SMTP id dm7mr2074480wib.9.1326462946581; Fri, 13 Jan 2012 05:55:46 -0800 (PST) Received: from thierry-MM061 (121.77.197.77.rev.sfr.net. [77.197.77.121]) by mx.google.com with ESMTPS id hv1sm4075996wib.1.2012.01.13.05.55.44 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 13 Jan 2012 05:55:45 -0800 (PST) From: Thierry Volpiatto To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> Date: Fri, 13 Jan 2012 14:55:42 +0100 In-Reply-To: <87aa5rdazl.fsf@gmx.de> (Michael Albinus's message of "Fri, 13 Jan 2012 13:48:30 +0100") Message-ID: <87d3anogf5.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Hi Michael, Michael Albinus writes: > Thierry Volpiatto writes: > >> Hi Michael, > > Hi Thierry, > >> I want to only suppress the use of: >> (copy-directory "/sudo:host:/home/user/Test" "/home/user/Test") > > Do you know `tramp-default-proxies-alist'? With that toy, "/sudo:host:" > can be another machine but your local one. You really don't know, > without going into deep Tramp interna. No I didn't know, I did differently, see below. >> (copy-directory "/sudo:host:/home/user/Test" "/sudo:host:/home/user/Test") > > That would be reasonable to suppress. We must suppress this as it cause infinite creation of subdir in ~/Test. > But you don't need a special remote test for this. Just compare the > results of `file-truename', as suggested by Eli. This shall work also > for remote files automagically. Ok good, but I did differently in last patch: --8<---------------cut here---------------start------------->8--- (when (equal (or (and (equal "sudo" (file-remote-p (file-name-as-directory from) 'method)) (file-remote-p (file-name-as-directory from) 'localname)) (file-name-as-directory from)) (or (and (equal "sudo" (file-remote-p (file-name-as-directory to) 'method)) (file-remote-p (file-name-as-directory to) 'localname)) (file-name-as-directory to))) (error "Can't copy directory `%s' on itself" from)) --8<---------------cut here---------------end--------------->8--- Which fail for the example below. > If somebody wants to apply > > (copy-directory "/ssh:host:/home/user/Test" "/scp:host:/home/user/Test") > > you can't suppress. Same for using different hostnames which are aliases > for the same machine, etc pp. Yes right. BTW, working on this, I found another bug for (copy-directory "/ssh:host:/home/user/Test" "/home/user/Test") This seem to overwrite "/home/user/Test". Doing the same operation from Dired create "/home/user/Test/Test". But I think it's easy to fix, just need to move the tramp block lower in copy-directory, have a look. So I will finish writing this patch with the compare file function suggested by Juanma. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 09:06:59 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 14:06:59 +0000 Received: from localhost ([127.0.0.1]:56077 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlhmR-0003Xj-Qz for submit@debbugs.gnu.org; Fri, 13 Jan 2012 09:06:59 -0500 Received: from mail-ww0-f46.google.com ([74.125.82.46]:56221) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlhmM-0003XX-CK for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 09:06:54 -0500 Received: by wgbdy1 with SMTP id dy1so174160wgb.15 for <10489@debbugs.gnu.org>; Fri, 13 Jan 2012 06:06:12 -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=s3+FXabJPUif2cP4jn6W9o+PcXMQKfB0bDKPZNUxb28=; b=LUOdSwoLltaVp1tJCUdY9ptjqio14PXOKkiH3scdC4/QkdglwuEEqJmvLlj7IQl3BJ H6S3dMcxgjzzQDpmT1BGdiUtcAW5zjwuDvT1rVe1WQn7fba0sOOOUL6x6+epgN09iRQm qJyEbWZiNgWyZ0/inDu/bdEJUqX3PxcKZ/EA0= Received: by 10.180.91.42 with SMTP id cb10mr30580wib.15.1326463572565; Fri, 13 Jan 2012 06:06:12 -0800 (PST) Received: from thierry-MM061 (121.77.197.77.rev.sfr.net. [77.197.77.121]) by mx.google.com with ESMTPS id eu3sm16009151wib.6.2012.01.13.06.06.09 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 13 Jan 2012 06:06:11 -0800 (PST) From: Thierry Volpiatto To: Stefan Monnier Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87pqeoro8p.fsf@gmail.com> <83wr8vki5t.fsf@gnu.org> <8762gfdael.fsf@gmx.de> Date: Fri, 13 Jan 2012 15:06:08 +0100 In-Reply-To: (Stefan Monnier's message of "Fri, 13 Jan 2012 08:27:46 -0500") Message-ID: <878vlbofxr.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: Juanma Barranquero , 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Stefan Monnier 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 From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 09:14:49 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 14:14:49 +0000 Received: from localhost ([127.0.0.1]:56084 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rlhu4-0003il-9N for submit@debbugs.gnu.org; Fri, 13 Jan 2012 09:14:49 -0500 Received: from rcsinet15.oracle.com ([148.87.113.117]:29054) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rlhu1-0003id-Hq for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 09:14:46 -0500 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by rcsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id q0DEE6A0029112 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 13 Jan 2012 14:14:07 GMT Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q0DEE5ZL007815 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 13 Jan 2012 14:14:06 GMT Received: from abhmt101.oracle.com (abhmt101.oracle.com [141.146.116.53]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q0DEE57v019462; Fri, 13 Jan 2012 08:14:05 -0600 Received: from dradamslap1 (/10.159.36.36) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 13 Jan 2012 06:14:04 -0800 From: "Drew Adams" To: "'Michael Albinus'" References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com><8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com><87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com><87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> Subject: RE: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Date: Fri, 13 Jan 2012 06:14:01 -0800 Message-ID: <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <87d3anogf5.fsf@gmail.com> Thread-Index: AczR+y5Cq7UY6rv+R1Cwgzta/EvHawAAacRg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090202.4F103C2F.00C2,ss=1,re=0.000,fgs=0 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) FWIW, this is what Bookmark+ uses, based on some input from Michael: (defun bmkp-same-file-p (file1 file2) "Return non-nil if FILE1 and FILE2 name the same file. If either name is not absolute, then it is expanded relative to `default-directory' for the test." (and (equal (file-remote-p file1) (file-remote-p file2)) (string= (file-truename (expand-file-name file1)) (file-truename (expand-file-name file2))))) From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 09:45:35 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 14:45:35 +0000 Received: from localhost ([127.0.0.1]:56092 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RliNm-0004Oz-Cy for submit@debbugs.gnu.org; Fri, 13 Jan 2012 09:45:34 -0500 Received: from mailout-de.gmx.net ([213.165.64.23]:60501) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1RliNe-0004Oj-4o for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 09:45:26 -0500 Received: (qmail invoked by alias); 13 Jan 2012 14:44:43 -0000 Received: from p57BB9670.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.150.112] by mail.gmx.net (mp031) with SMTP; 13 Jan 2012 15:44:43 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX19pik4dNptp4kUo1UgXAJ0lQTZA5UqJWynKLoPhVz 3K0tK+K/No5sSY From: Michael Albinus To: Stefan Monnier Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87pqeoro8p.fsf@gmail.com> <83wr8vki5t.fsf@gnu.org> <8762gfdael.fsf@gmx.de> Date: Fri, 13 Jan 2012 15:44:39 +0100 In-Reply-To: (Stefan Monnier's message of "Fri, 13 Jan 2012 08:27:46 -0500") Message-ID: <87hazzll0o.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: Juanma Barranquero , 10489@debbugs.gnu.org, Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Stefan Monnier writes: > 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. (eval (car (get 'read-file-name-completion-ignore-case 'standard-value))) would do, but that's too hackish ?? > Stefan Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 10:08:02 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 15:08:02 +0000 Received: from localhost ([127.0.0.1]:56575 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlijZ-00050p-LQ for submit@debbugs.gnu.org; Fri, 13 Jan 2012 10:08:01 -0500 Received: from mail-pw0-f44.google.com ([209.85.160.44]:40124) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlijX-00050e-GX for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 10:08:00 -0500 Received: by pbbb2 with SMTP id b2so989711pbb.3 for <10489@debbugs.gnu.org>; Fri, 13 Jan 2012 07:07:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=By/QllkaailD7dLeqKCyyU0nYhlHgW6pVg5Ju0cWs3o=; b=evbAPzPP8oDgIBprzTpPrKRBCv8QfykuEs8TvN/FtUG1BteJJn+X3En0z6EQKMLDPw /q0aQfBB7P/ANMJb4pNfG6vFOwb3of7m0Us4A6Qd6d/ZbgexUBa2EqSZDLMBCLEI2qb5 TO6uic+dI5JIxpxPvGwQc2jZs25W2RgQeiKQA= Received: by 10.68.73.234 with SMTP id o10mr2370798pbv.90.1326467241333; Fri, 13 Jan 2012 07:07:21 -0800 (PST) MIME-Version: 1.0 Received: by 10.142.247.28 with HTTP; Fri, 13 Jan 2012 07:06:40 -0800 (PST) In-Reply-To: <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> From: Juanma Barranquero Date: Fri, 13 Jan 2012 16:06:40 +0100 Message-ID: Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy To: Drew Adams Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On Fri, Jan 13, 2012 at 15:14, Drew Adams wrote: > =C2=A0(and (equal (file-remote-p file1) (file-remote-p file2)) Why is the file-remote-p needed? =C2=A0 =C2=A0 Juanma From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 10:13:57 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 15:13:57 +0000 Received: from localhost ([127.0.0.1]:56579 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlipJ-00058r-FW for submit@debbugs.gnu.org; Fri, 13 Jan 2012 10:13:57 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.183]:36133) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlipI-00058l-Dx for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 10:13:56 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EAGpJEE9FxKkV/2dsb2JhbABCqmWCM4EGgXIBAQQBViMQCzQSFBgNJIgNtzCMHQSIPJphhFI X-IronPort-AV: E=Sophos;i="4.71,504,1320642000"; d="scan'208";a="156595858" Received: from 69-196-169-21.dsl.teksavvy.com (HELO pastel.home) ([69.196.169.21]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 13 Jan 2012 10:13:18 -0500 Received: by pastel.home (Postfix, from userid 20848) id CCE5959460; Fri, 13 Jan 2012 10:13:17 -0500 (EST) From: Stefan Monnier To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Message-ID: References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87pqeoro8p.fsf@gmail.com> <83wr8vki5t.fsf@gnu.org> <8762gfdael.fsf@gmx.de> <87hazzll0o.fsf@gmx.de> Date: Fri, 13 Jan 2012 10:13:17 -0500 In-Reply-To: <87hazzll0o.fsf@gmx.de> (Michael Albinus's message of "Fri, 13 Jan 2012 15:44:39 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: Juanma Barranquero , 10489@debbugs.gnu.org, Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >> 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. > (eval (car (get 'read-file-name-completion-ignore-case 'standard-value))) > would do, but that's too hackish ?? Yuck. I'd much rather introduce a new defconst which is then used to provide the default value of read-file-name-completion-ignore-case. BTW, a reliable test of file name equality is far from obvious. E.g. "/ssh:toto:/titi" is equal to "/ssh:TOTO:/titi" but whether "/ssh:toto:/titi" is not equal to "/ssh:toto:/TITI" if titi is a typical GNU/Linux machine. Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 10:15:02 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 15:15:02 +0000 Received: from localhost ([127.0.0.1]:56583 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RliqL-0005An-Qb for submit@debbugs.gnu.org; Fri, 13 Jan 2012 10:15:02 -0500 Received: from mailout-de.gmx.net ([213.165.64.23]:38099) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1RliqJ-0005AY-Ox for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 10:15:00 -0500 Received: (qmail invoked by alias); 13 Jan 2012 15:14:20 -0000 Received: from p57BB9670.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.150.112] by mail.gmx.net (mp065) with SMTP; 13 Jan 2012 16:14:20 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX180U6k1m380y6WLik2coMrOTPouGib28ZumeYWKNu 3qsaraENSSFlT5 From: Michael Albinus To: Juanma Barranquero Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> Date: Fri, 13 Jan 2012 16:14:15 +0100 In-Reply-To: (Juanma Barranquero's message of "Fri, 13 Jan 2012 16:06:40 +0100") Message-ID: <878vlbljnc.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Drew Adams X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Juanma Barranquero writes: > On Fri, Jan 13, 2012 at 15:14, Drew Adams wrote: > >> =C2=A0(and (equal (file-remote-p file1) (file-remote-p file2)) > > Why is the file-remote-p needed? For some simple cases, `file-remote-p' does the correct expansion. (file-remote-p "/sudo::") =3D> "/sudo:root@host:" With this expansion, "/sudo::/path/file" and "/sudo:host:/path/file" would be equal. > Juanma Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 10:19:08 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 15:19:08 +0000 Received: from localhost ([127.0.0.1]:56589 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RliuJ-0005Gv-NR for submit@debbugs.gnu.org; Fri, 13 Jan 2012 10:19:08 -0500 Received: from mail-pw0-f44.google.com ([209.85.160.44]:50894) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RliuH-0005Gn-B8 for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 10:19:06 -0500 Received: by pbbb2 with SMTP id b2so995567pbb.3 for <10489@debbugs.gnu.org>; Fri, 13 Jan 2012 07:18:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=oESlzWqtJDv1kC1CJor0SOiGiZ0sb7KDU2ETQjcOf+M=; b=mlT+DhNXFYM161hRAyPRqyZvfxGAL4r1HNl/8iy3+8Tksh9x29UcQZSZtUdfIBzgMh yASKk7TFkuXSFkU2UFZA33aWXyuQm85vIVBYr0hlvmkWunI4O6ctWgfq2V4S7e5yqEUb LvpEk7bZJrLDELpMpfSdT+ZgQ6UHMEJpA2iTo= Received: by 10.68.116.234 with SMTP id jz10mr2424297pbb.84.1326467907166; Fri, 13 Jan 2012 07:18:27 -0800 (PST) MIME-Version: 1.0 Received: by 10.142.247.28 with HTTP; Fri, 13 Jan 2012 07:17:46 -0800 (PST) In-Reply-To: References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87pqeoro8p.fsf@gmail.com> <83wr8vki5t.fsf@gnu.org> <8762gfdael.fsf@gmx.de> <87hazzll0o.fsf@gmx.de> From: Juanma Barranquero Date: Fri, 13 Jan 2012 16:17:46 +0100 Message-ID: Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy To: Stefan Monnier Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus , Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On Fri, Jan 13, 2012 at 16:13, Stefan Monnier wr= ote: > BTW, a reliable test of file name equality is far from obvious. That is true, but it's also likely true* that simple, and file-name comparisons are used in the Emacs sources. So perhaps we should limit file-name-equal-p to local files, and assume that there's no reliable way to compare them if the files are remote. [* I haven't checked, but I would be surprised it they were none.] =C2=A0 =C2=A0 Juanma From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 10:30:14 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 15:30:14 +0000 Received: from localhost ([127.0.0.1]:56595 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rlj54-0005Wi-6Y for submit@debbugs.gnu.org; Fri, 13 Jan 2012 10:30:14 -0500 Received: from mailout-de.gmx.net ([213.165.64.23]:42306) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1Rlj51-0005Wa-O3 for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 10:30:13 -0500 Received: (qmail invoked by alias); 13 Jan 2012 15:29:32 -0000 Received: from p57BB9670.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.150.112] by mail.gmx.net (mp011) with SMTP; 13 Jan 2012 16:29:32 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX18kayZda8QkiydlzCPQMPPQ61AzcH3KKPwuKw1+Yq xjIcqJsam5t7MW From: Michael Albinus To: Juanma Barranquero Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87pqeoro8p.fsf@gmail.com> <83wr8vki5t.fsf@gnu.org> <8762gfdael.fsf@gmx.de> <87hazzll0o.fsf@gmx.de> Date: Fri, 13 Jan 2012 16:29:28 +0100 In-Reply-To: (Juanma Barranquero's message of "Fri, 13 Jan 2012 16:17:46 +0100") Message-ID: <874nvzlixz.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Stefan Monnier , Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Juanma Barranquero writes: > That is true, but it's also likely true* that simple, and file-name > comparisons are used in the Emacs sources. So perhaps we should limit > file-name-equal-p to local files, and assume that there's no reliable > way to compare them if the files are remote. Simple cases would be possible, therefore I'm for a file name handler implemented in Tramp. It could expand default method, user names and host names. It could massage the hostname (downcase all hostnames, canonicalize them if possible (for example "127.0.0.1" and "::1" and "localhost" could all be mapped to (system-name))). It could fiddle with file name case sensitvity (it might be different on your local Windows machine and your remote GNU/Linux machine). It could know which methods are equal when it comes to file name comparison. ("ssh" and "scp" are equal in this way). And so on. There will still be cases Tramp returns "not equal", but we would catch the majority of use cases, I believe. > Juanma Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 10:32:24 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 15:32:24 +0000 Received: from localhost ([127.0.0.1]:56600 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rlj79-0005Zm-TR for submit@debbugs.gnu.org; Fri, 13 Jan 2012 10:32:24 -0500 Received: from acsinet15.oracle.com ([141.146.126.227]:33375) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rlj77-0005Ze-Rn for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 10:32:22 -0500 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by acsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id q0DFVgRI020354 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 13 Jan 2012 15:31:43 GMT Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q0DFVfp2012879 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 13 Jan 2012 15:31:42 GMT Received: from abhmt107.oracle.com (abhmt107.oracle.com [141.146.116.59]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q0DFVeIt013268; Fri, 13 Jan 2012 09:31:41 -0600 Received: from dradamslap1 (/10.159.36.36) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 13 Jan 2012 07:31:40 -0800 From: "Drew Adams" To: "'Juanma Barranquero'" References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> Subject: RE: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Date: Fri, 13 Jan 2012 07:31:37 -0800 Message-ID: <67AD6F10AC4941C796C7A59524B708E6@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: AczSBRGrfnPi6GXgRvihcoVGQl0ZGQAAqPaw X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Source-IP: ucsinet22.oracle.com [156.151.31.94] X-CT-RefId: str=0001.0A090202.4F104E5F.016B,ss=1,re=0.000,fgs=0 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, 'Michael Albinus' X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) > > =A0(and (equal (file-remote-p file1) (file-remote-p file2)) >=20 > Why is the file-remote-p needed? If that test fails then (because either at least one of the files is not = remote or their access methods/hosts are different) we save a trip to remote = machines to determine truenames. If that test succeeds then either both are local or both are remote, and = in the latter case they have the same host etc. IOW, the idea is to try to do as much as possible based only on the = strings (names), and to fail if possible that way without accessing anything = remotely. From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 10:42:19 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 15:42:19 +0000 Received: from localhost ([127.0.0.1]:56604 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RljGl-0005pd-6g for submit@debbugs.gnu.org; Fri, 13 Jan 2012 10:42:19 -0500 Received: from mtaout20.012.net.il ([80.179.55.166]:45986) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RljGh-0005pN-AI for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 10:42:17 -0500 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0LXQ00000U6DTK00@a-mtaout20.012.net.il> for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 17:41:16 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.124.136.230]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LXQ00MN8U8RUCF0@a-mtaout20.012.net.il>; Fri, 13 Jan 2012 17:41:16 +0200 (IST) Date: Fri, 13 Jan 2012 17:41:21 +0200 From: Eli Zaretskii Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy In-reply-to: <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> X-012-Sender: halo1@inter.net.il To: Drew Adams Message-id: <83k44vk3tq.fsf@gnu.org> References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, michael.albinus@gmx.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) > From: "Drew Adams" > Date: Fri, 13 Jan 2012 06:14:01 -0800 > Cc: 10489@debbugs.gnu.org > > FWIW, this is what Bookmark+ uses, based on some input from Michael: > > (defun bmkp-same-file-p (file1 file2) > "Return non-nil if FILE1 and FILE2 name the same file. > If either name is not absolute, then it is expanded relative to > `default-directory' for the test." > (and (equal (file-remote-p file1) (file-remote-p file2)) > (string= (file-truename (expand-file-name file1)) > (file-truename (expand-file-name file2))))) Which is obviously wrong on case-insensitive filesystems. From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 11:57:41 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 16:57:42 +0000 Received: from localhost ([127.0.0.1]:56639 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlkRh-0007Wz-Cp for submit@debbugs.gnu.org; Fri, 13 Jan 2012 11:57:41 -0500 Received: from acsinet15.oracle.com ([141.146.126.227]:32428) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlkRZ-0007Wm-8L for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 11:57:40 -0500 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by acsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id q0DGurJj010055 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 13 Jan 2012 16:56:54 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q0DGuqQj026971 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 13 Jan 2012 16:56:53 GMT Received: from abhmt114.oracle.com (abhmt114.oracle.com [141.146.116.66]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q0DGuqcm017695; Fri, 13 Jan 2012 10:56:52 -0600 Received: from dradamslap1 (/10.159.36.36) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 13 Jan 2012 08:56:52 -0800 From: "Drew Adams" To: "'Eli Zaretskii'" References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <83k44vk3tq.fsf@gnu.org> Subject: RE: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Date: Fri, 13 Jan 2012 08:56:48 -0800 Message-ID: <0CF5A24D684E48CEBE38E6597474ECAD@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <83k44vk3tq.fsf@gnu.org> Thread-Index: AczSCdgoYGKq3hqRQoyxH2L+XdPs4QAA12Ow X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090206.4F106256.008F,ss=1,re=0.000,fgs=0 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, michael.albinus@gmx.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) > > FWIW, this is what Bookmark+ uses, based on some input from Michael: > > > > (defun bmkp-same-file-p (file1 file2) > > "Return non-nil if FILE1 and FILE2 name the same file. > > If either name is not absolute, then it is expanded relative to > > `default-directory' for the test." > > (and (equal (file-remote-p file1) (file-remote-p file2)) > > (string= (file-truename (expand-file-name file1)) > > (file-truename (expand-file-name file2))))) > > Which is obviously wrong on case-insensitive filesystems. Yes. If both files are local then we can check whether to ignore case using what Michael or Stefan suggested (the standard value of `read-file-name-completion-ignore-case' or, better, some to-be-created constant for this purpose). But if both files are remote then the remote system setting(s) would need to be checked. Here is a modified version of the above code, which I expect (untested) DTRT for local files and just punts for remote file names (assumes that they are case-sensitive). Perhaps Michael has a good suggestion wrt treating that case. (defun bmkp-same-file-p (file1 file2) "Return non-nil if FILE1 and FILE2 name the same file. If either name is not absolute, then it is expanded relative to `default-directory' for the test." (let* ((remote1 (bmkp-file-remote-p file1)) (remote2 (bmkp-file-remote-p file2)) (ignore-case-p (and (not remote1) (not remote2) (eval (car (get 'read-file-name-completion-ignore-case 'standard-value)))))) (and (equal remote1 remote2) (compare-strings (file-truename (expand-file-name file1)) (file-truename (expand-file-name file2)) ignore-case-p)))) ---- BTW, I notice in `abbreviate-file-name' this code: ;; To fix this right, we need a `file-name-case-sensitive-p' ;; function, but we don't have that yet, so just guess. (let ((case-fold-search (memq system-type '(ms-dos windows-nt darwin cygwin)))) That same value is used to define the standard value of `read-file-name-completion-ignore-case'. Presumably it would be better for code to check that standard value (or some TBD constant, as Stefan suggested) than to rely on an explicit list of systems here and there in the code. IOW, define/maintain the value in a single place. There are other places in the code where we try to determine case-sensitivity of file names based on `system-type'. And we don't always use the same system list for this. E.g., in `files.el' alone: We use this in `set-auto-mode': (memq system-type '(windows-nt cygwin)) And this in `dir-locals-find-file', `make-backup-file-name-1', `make-auto-save-file-name', `file-relative-name', `shell-quote-wildcard-pattern', and `file-name-invalid-regexp': (memq system-type '(windows-nt cygwin ms-dos)) And this in `insert-directory': (memq system-type '(ms-dos windows-nt)) And this in `buffer-file-numbers-unique': (memq system-type '(windows-nt)) And again, in `abbreviate-file-name' we use: (memq system-type '(ms-dos windows-nt darwin cygwin)) Now maybe some of those tests are not for case-sensitivity (I didn't take the time to look closely). Or maybe, even when they are, there are good reasons for such differences. But perhaps one or more of them should in fact have the same value as `read-file-name-completion-ignore-case' (or said TBD constant), and would benefit from being replaced by that? From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 11:59:55 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 16:59:55 +0000 Received: from localhost ([127.0.0.1]:56643 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlkTr-0007a6-2I for submit@debbugs.gnu.org; Fri, 13 Jan 2012 11:59:55 -0500 Received: from acsinet15.oracle.com ([141.146.126.227]:57687) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlkTo-0007Zz-Sh for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 11:59:53 -0500 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by acsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id q0DGxDf4013295 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 13 Jan 2012 16:59:14 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q0DGxC4Y000535 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 13 Jan 2012 16:59:13 GMT Received: from abhmt102.oracle.com (abhmt102.oracle.com [141.146.116.54]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q0DGxCpu001530; Fri, 13 Jan 2012 10:59:12 -0600 Received: from dradamslap1 (/10.159.36.36) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 13 Jan 2012 08:59:12 -0800 From: "Drew Adams" To: "'Stefan Monnier'" , "'Michael Albinus'" References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com><8362ggkquq.fsf@gnu.org> <87pqeoro8p.fsf@gmail.com><83wr8vki5t.fsf@gnu.org><8762gfdael.fsf@gmx.de> <87hazzll0o.fsf@gmx.de> Subject: RE: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Date: Fri, 13 Jan 2012 08:59:08 -0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: AczSBe40kdYgsxlIQVKKuSjo4DfCIQABtgAw X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090209.4F1062E2.005E,ss=1,re=0.000,fgs=0 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 10489 Cc: 'Juanma Barranquero' , 10489@debbugs.gnu.org, 'Thierry Volpiatto' X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) > >> 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. > > > > (eval (car (get 'read-file-name-completion-ignore-case > > 'standard-value))) > > > > would do, but that's too hackish ?? > > Yuck. I'd much rather introduce a new defconst which is then used to > provide the default value of read-file-name-completion-ignore-case. > > BTW, a reliable test of file name equality is far from obvious. E.g. > "/ssh:toto:/titi" is equal to "/ssh:TOTO:/titi" but whether > "/ssh:toto:/titi" is not equal to "/ssh:toto:/TITI" if titi > is a typical GNU/Linux machine. And if you try to rely on some system setting (e.g. the constant you mentioned), then that needs to be checked separately for each file name argument, in the case where a remote specifier is part of the file name. From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 13:44:54 2012 Received: (at submit) by debbugs.gnu.org; 13 Jan 2012 18:44:54 +0000 Received: from localhost ([127.0.0.1]:56662 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rlm7Q-0001cp-9R for submit@debbugs.gnu.org; Fri, 13 Jan 2012 13:44:53 -0500 Received: from eggs.gnu.org ([140.186.70.92]:53614) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rlm7N-0001ch-1z for submit@debbugs.gnu.org; Fri, 13 Jan 2012 13:44:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rlm6j-0002HR-I8 for submit@debbugs.gnu.org; Fri, 13 Jan 2012 13:44:10 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([140.186.70.17]:59640) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rlm6j-0002HI-GM for submit@debbugs.gnu.org; Fri, 13 Jan 2012 13:44:09 -0500 Received: from eggs.gnu.org ([140.186.70.92]:55013) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rlm6i-0002mv-7I for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2012 13:44:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rlm6g-0002Fr-V5 for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2012 13:44:08 -0500 Received: from lo.gmane.org ([80.91.229.12]:35533) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rlm6g-0002FL-LG for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2012 13:44:06 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Rlm6e-0004jl-SQ for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2012 19:44:04 +0100 Received: from 121.77.197.77.rev.sfr.net ([77.197.77.121]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 13 Jan 2012 19:44:04 +0100 Received: from thierry.volpiatto by 121.77.197.77.rev.sfr.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 13 Jan 2012 19:44:04 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Date: Fri, 13 Jan 2012 19:43:50 +0100 Lines: 55 Message-ID: <8739bj8mu1.fsf@gmail.com> References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 121.77.197.77.rev.sfr.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) Cancel-Lock: sha1:nFBBHEooa82KCWwJfbh/EZe/blI= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) Michael Albinus writes: > Juanma Barranquero writes: > >> On Fri, Jan 13, 2012 at 15:14, Drew Adams wrote: >> >>>  (and (equal (file-remote-p file1) (file-remote-p file2)) >> >> Why is the file-remote-p needed? > > For some simple cases, `file-remote-p' does the correct expansion. > > (file-remote-p "/sudo::") => "/sudo:root@host:" > > With this expansion, "/sudo::/path/file" and "/sudo:host:/path/file" > would be equal. What about this? (defun file-name-equal-p (name1 name2 &optional dir) (let* ((n1 (file-truename (expand-file-name name1 dir))) (n2 (file-truename (expand-file-name name2 dir))) (rhost1 (file-remote-p n1 'host)) (rhost2 (file-remote-p n2 'host)) (lname1 (file-remote-p n1 'localname)) (lname2 (file-remote-p n2 'localname)) (rem-n1 (if rhost1 (list (cons rhost1 lname1)) (list (cons (system-name) n1)))) (rem-n2 (if rhost2 (list (cons rhost2 lname2)) (list (cons (system-name) n2))))) (loop for (x1 . y1) in rem-n1 for (x2 . y2) in rem-n2 thereis (and (equal x1 x2) (equal y1 y2))))) (file-name-equal-p "/home/thierry/Test" "~/Test") ;=>t (file-name-equal-p "/home/thierry/Test" "/home/thierry/tmp/Test") ;=>nil (file-name-equal-p "/ssh:thievol:/home/thierry/Test" "/scpc:thievol:/home/thierry/Test") ;=>t (file-name-equal-p "/sudo::/home/thierry/Test" "/sudo::~/Test") ;=>nil (file-name-equal-p "/sudo::/home/thierry/Test" "~/Test") ;=>t (file-name-equal-p "/home/thierry/tmp" "/tmp") ;=>nil -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 13:58:22 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 18:58:22 +0000 Received: from localhost ([127.0.0.1]:56700 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlmKT-0001xg-N9 for submit@debbugs.gnu.org; Fri, 13 Jan 2012 13:58:21 -0500 Received: from acsinet15.oracle.com ([141.146.126.227]:63639) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlmKR-0001xY-54 for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 13:58:20 -0500 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by acsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id q0DIvcG2030957 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 13 Jan 2012 18:57:39 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q0DIvbra017966 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 13 Jan 2012 18:57:38 GMT Received: from abhmt118.oracle.com (abhmt118.oracle.com [141.146.116.70]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q0DIvbx8007924; Fri, 13 Jan 2012 12:57:37 -0600 Received: from dradamslap1 (/10.159.36.36) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 13 Jan 2012 10:57:37 -0800 From: "Drew Adams" To: "'Thierry Volpiatto'" , <10489@debbugs.gnu.org> References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com><8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com><87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com><87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com><011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com><878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> Subject: RE: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Date: Fri, 13 Jan 2012 10:57:34 -0800 Message-ID: <02043028DF764049AB57ED4D7C715992@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <8739bj8mu1.fsf@gmail.com> Thread-Index: AczSI2Zd1L0y/CtmQP2htQoyi12i+AAAYWUA X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090208.4F107EA3.0103,ss=1,re=0.000,fgs=0 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 10489 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) For one thing, you are accessing a remote file before testing whether it is remote according to its name, which systematically costs you a remote access (login etc.), perhaps uselessly. > What about this? > > (defun file-name-equal-p (name1 name2 &optional dir) > (let* ((n1 (file-truename (expand-file-name name1 dir))) > (n2 (file-truename (expand-file-name name2 dir))) From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 14:01:04 2012 Received: (at submit) by debbugs.gnu.org; 13 Jan 2012 19:01:04 +0000 Received: from localhost ([127.0.0.1]:56704 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlmN5-00022L-Hp for submit@debbugs.gnu.org; Fri, 13 Jan 2012 14:01:03 -0500 Received: from eggs.gnu.org ([140.186.70.92]:49919) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlmN1-00021w-L9 for submit@debbugs.gnu.org; Fri, 13 Jan 2012 14:01:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RlmMJ-0005ix-KZ for submit@debbugs.gnu.org; Fri, 13 Jan 2012 14:00:21 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([140.186.70.17]:53160) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlmMJ-0005in-GP for submit@debbugs.gnu.org; Fri, 13 Jan 2012 14:00:15 -0500 Received: from eggs.gnu.org ([140.186.70.92]:46176) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlmMF-0001h9-Da for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2012 14:00:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RlmMA-0005hR-BZ for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2012 14:00:11 -0500 Received: from lo.gmane.org ([80.91.229.12]:51360) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlmMA-0005gP-0I for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2012 14:00:06 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RlmM7-0003yn-99 for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2012 20:00:03 +0100 Received: from 121.77.197.77.rev.sfr.net ([77.197.77.121]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 13 Jan 2012 20:00:03 +0100 Received: from thierry.volpiatto by 121.77.197.77.rev.sfr.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 13 Jan 2012 20:00:03 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Date: Fri, 13 Jan 2012 19:59:51 +0100 Lines: 82 Message-ID: <87y5tb77iw.fsf@gmail.com> References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 121.77.197.77.rev.sfr.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) Cancel-Lock: sha1:+/FlM4Im5Xmh+lJS+ftKeQFHF+o= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) Thierry Volpiatto writes: > Michael Albinus writes: > >> Juanma Barranquero writes: >> >>> On Fri, Jan 13, 2012 at 15:14, Drew Adams wrote: >>> >>>>  (and (equal (file-remote-p file1) (file-remote-p file2)) >>> >>> Why is the file-remote-p needed? >> >> For some simple cases, `file-remote-p' does the correct expansion. >> >> (file-remote-p "/sudo::") => "/sudo:root@host:" >> >> With this expansion, "/sudo::/path/file" and "/sudo:host:/path/file" >> would be equal. > > What about this? > > (defun file-name-equal-p (name1 name2 &optional dir) > (let* ((n1 (file-truename (expand-file-name name1 dir))) > (n2 (file-truename (expand-file-name name2 dir))) > (rhost1 (file-remote-p n1 'host)) > (rhost2 (file-remote-p n2 'host)) > (lname1 (file-remote-p n1 'localname)) > (lname2 (file-remote-p n2 'localname)) > (rem-n1 (if rhost1 > (list (cons rhost1 lname1)) > (list (cons (system-name) n1)))) > (rem-n2 (if rhost2 > (list (cons rhost2 lname2)) > (list (cons (system-name) n2))))) > (loop for (x1 . y1) in rem-n1 > for (x2 . y2) in rem-n2 > thereis (and (equal x1 x2) > (equal y1 y2))))) > > (file-name-equal-p "/home/thierry/Test" "~/Test") > ;=>t > (file-name-equal-p "/home/thierry/Test" "/home/thierry/tmp/Test") > ;=>nil > (file-name-equal-p "/ssh:thievol:/home/thierry/Test" "/scpc:thievol:/home/thierry/Test") > ;=>t > (file-name-equal-p "/sudo::/home/thierry/Test" "/sudo::~/Test") > ;=>nil > (file-name-equal-p "/sudo::/home/thierry/Test" "~/Test") > ;=>t > (file-name-equal-p "/home/thierry/tmp" "/tmp") > ;=>nil We need also to use file-name-as-directory for this use case: (file-name-equal-p "/home/thierry/Test" "~/Test/") ;=>t --8<---------------cut here---------------start------------->8--- (defun file-name-equal-p (name1 name2 &optional dir) (let* ((n1 (file-name-as-directory (file-truename (expand-file-name name1 dir)))) (n2 (file-name-as-directory (file-truename (expand-file-name name2 dir)))) (rhost1 (file-remote-p n1 'host)) (rhost2 (file-remote-p n2 'host)) (lname1 (file-remote-p n1 'localname)) (lname2 (file-remote-p n2 'localname)) (rem-n1 (if rhost1 (list (cons rhost1 lname1)) (list (cons (system-name) n1)))) (rem-n2 (if rhost2 (list (cons rhost2 lname2)) (list (cons (system-name) n2))))) (loop for (x1 . y1) in rem-n1 for (x2 . y2) in rem-n2 thereis (and (equal x1 x2) (equal y1 y2))))) --8<---------------cut here---------------end--------------->8--- -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 14:05:24 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 19:05:24 +0000 Received: from localhost ([127.0.0.1]:56709 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlmRI-00028G-EQ for submit@debbugs.gnu.org; Fri, 13 Jan 2012 14:05:24 -0500 Received: from mailout-de.gmx.net ([213.165.64.23]:41407) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1RlmRG-000288-87 for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 14:05:23 -0500 Received: (qmail invoked by alias); 13 Jan 2012 19:04:40 -0000 Received: from p57BB9670.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.150.112] by mail.gmx.net (mp033) with SMTP; 13 Jan 2012 20:04:40 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX18Lc8EMx7oLT7HV6uzG2fPIgMfcdNNnKu7o8k4Nz7 7BDHasazYy8gYF From: Michael Albinus To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> Date: Fri, 13 Jan 2012 20:04:35 +0100 In-Reply-To: <8739bj8mu1.fsf@gmail.com> (Thierry Volpiatto's message of "Fri, 13 Jan 2012 19:43:50 +0100") Message-ID: <87fwfjo24c.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Thierry Volpiatto writes: > What about this? > > (defun file-name-equal-p (name1 name2 &optional dir) > (let* ((n1 (file-truename (expand-file-name name1 dir))) > (n2 (file-truename (expand-file-name name2 dir))) > (rhost1 (file-remote-p n1 'host)) > (rhost2 (file-remote-p n2 'host)) > (lname1 (file-remote-p n1 'localname)) > (lname2 (file-remote-p n2 'localname)) > (rem-n1 (if rhost1 > (list (cons rhost1 lname1)) > (list (cons (system-name) n1)))) > (rem-n2 (if rhost2 > (list (cons rhost2 lname2)) > (list (cons (system-name) n2))))) > (loop for (x1 . y1) in rem-n1 > for (x2 . y2) in rem-n2 > thereis (and (equal x1 x2) > (equal y1 y2))))) Nope. User name and method also matter. "/ftp:host:/file" <> "/ssh:@host:/file" "/ftp:user1@host:/file" <> "/ftp:user1@host:/file" You shouldn't mess with remote files, really :-) That's what file name handlers are good for. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 14:13:01 2012 Received: (at submit) by debbugs.gnu.org; 13 Jan 2012 19:13:01 +0000 Received: from localhost ([127.0.0.1]:56714 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlmYe-0002IU-7G for submit@debbugs.gnu.org; Fri, 13 Jan 2012 14:13:01 -0500 Received: from eggs.gnu.org ([140.186.70.92]:56818) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlmYb-0002IM-48 for submit@debbugs.gnu.org; Fri, 13 Jan 2012 14:12:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RlmXx-0007Cv-JZ for submit@debbugs.gnu.org; Fri, 13 Jan 2012 14:12:18 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([140.186.70.17]:57673) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlmXx-0007Cr-I7 for submit@debbugs.gnu.org; Fri, 13 Jan 2012 14:12:17 -0500 Received: from eggs.gnu.org ([140.186.70.92]:44396) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlmXw-0008Ol-Ez for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2012 14:12:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RlmXv-0007Cg-Hd for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2012 14:12:16 -0500 Received: from lo.gmane.org ([80.91.229.12]:42765) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlmXv-0007Ca-Aj for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2012 14:12:15 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RlmXu-0000bF-OA for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2012 20:12:14 +0100 Received: from 121.77.197.77.rev.sfr.net ([77.197.77.121]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 13 Jan 2012 20:12:14 +0100 Received: from thierry.volpiatto by 121.77.197.77.rev.sfr.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 13 Jan 2012 20:12:14 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Date: Fri, 13 Jan 2012 20:11:59 +0100 Lines: 24 Message-ID: <87ty3z76yo.fsf@gmail.com> References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <02043028DF764049AB57ED4D7C715992@us.oracle.com> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 121.77.197.77.rev.sfr.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) Cancel-Lock: sha1:njvGu5V2q7Yq9i5Sf0UiXYnsmZg= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) "Drew Adams" writes: > For one thing, you are accessing a remote file before testing whether it is > remote according to its name, which systematically costs you a remote access > (login etc.), perhaps uselessly. Agree, but for this use case the connection is already open so there is not really a cost with remote access. But anyway as Michael point we need to test also user, method.. to much! So this method is not suitable anyway. >> What about this? >> >> (defun file-name-equal-p (name1 name2 &optional dir) >> (let* ((n1 (file-truename (expand-file-name name1 dir))) >> (n2 (file-truename (expand-file-name name2 dir))) > > > > > -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 14:18:39 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 19:18:39 +0000 Received: from localhost ([127.0.0.1]:56719 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rlme6-0002Qz-Rt for submit@debbugs.gnu.org; Fri, 13 Jan 2012 14:18:39 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:37786) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rlme4-0002Qs-6T for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 14:18:37 -0500 Received: by wibhj6 with SMTP id hj6so702811wib.3 for <10489@debbugs.gnu.org>; Fri, 13 Jan 2012 11:17:57 -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=YSZH4xipgfqbBIZZJc/C6XTnykNX2iSqv+wLcS0nf34=; b=GpHahL6RwsG4c8hRgb3SPKTc0NjnvLg8D8h+jxNg7Vawl15wFhhDBFnbaW/00u8k0a 4SX8ZNFAS3IjRBTn919aa003yTLKRWySUeRgPvx/q+fQWnby2r3j2IUI0iuyE/WEYv+7 NtT7vE+X6TKMzvVBWobhinafvGM67KijsDOV0= Received: by 10.180.100.234 with SMTP id fb10mr2316388wib.5.1326482277033; Fri, 13 Jan 2012 11:17:57 -0800 (PST) Received: from thierry-MM061 (121.77.197.77.rev.sfr.net. [77.197.77.121]) by mx.google.com with ESMTPS id ga4sm12222753wbb.4.2012.01.13.11.17.51 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 13 Jan 2012 11:17:54 -0800 (PST) From: Thierry Volpiatto To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <87fwfjo24c.fsf@gmx.de> Date: Fri, 13 Jan 2012 20:17:43 +0100 In-Reply-To: <87fwfjo24c.fsf@gmx.de> (Michael Albinus's message of "Fri, 13 Jan 2012 20:04:35 +0100") Message-ID: <87pqen76p4.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Michael Albinus writes: > Thierry Volpiatto writes: > >> What about this? >> >> (defun file-name-equal-p (name1 name2 &optional dir) >> (let* ((n1 (file-truename (expand-file-name name1 dir))) >> (n2 (file-truename (expand-file-name name2 dir))) >> (rhost1 (file-remote-p n1 'host)) >> (rhost2 (file-remote-p n2 'host)) >> (lname1 (file-remote-p n1 'localname)) >> (lname2 (file-remote-p n2 'localname)) >> (rem-n1 (if rhost1 >> (list (cons rhost1 lname1)) >> (list (cons (system-name) n1)))) >> (rem-n2 (if rhost2 >> (list (cons rhost2 lname2)) >> (list (cons (system-name) n2))))) >> (loop for (x1 . y1) in rem-n1 >> for (x2 . y2) in rem-n2 >> thereis (and (equal x1 x2) >> (equal y1 y2))))) > > Nope. User name and method also matter. > > "/ftp:host:/file" <> "/ssh:@host:/file" > > "/ftp:user1@host:/file" <> "/ftp:user1@host:/file" I see. > You shouldn't mess with remote files, really :-) Indeed yes! > That's what file name handlers are good for. > > Best regards, Michael. I post here the last version of the patch I wrote today, waiting something better to compare files. it works and fix this bug in most use cases. =20 =2D-=20 Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997=20 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=Singlepatch-r118414ToTip.patch Content-Transfer-Encoding: quoted-printable ##Merge of all patches applied from revision 118413 ## patch-r118414: Fix error when trying to copy directory on itself (bug#10= 489). ## patch-r118415: * lisp/dired-aux.el (dired-copy-file-recursive): Handle a= lso remote file/dir. ## patch-r118416: Handle only remote files with sudo method when copying di= rectories. ## patch-r118417: * lisp/dired-aux.el (dired-copy-file-recursive): Use file= -truename. ##=20 diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el =2D-- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1264,24 +1264,34 @@ =20 (defun dired-copy-file-recursive (from to ok-flag &optional preserve-time top recursive) =2D (let ((attrs (file-attributes from))) + (let* ((case-fold-search t) + (fromname (file-name-as-directory (file-truename from))) + (destname (file-name-as-directory (file-truename to))) + (rem-dirname (and (equal "sudo" (file-remote-p fromname 'method)) + (file-remote-p fromname 'localname))) + (rem-newname (and (equal "sudo" (file-remote-p destname 'method)) + (file-remote-p destname 'localname))) + (attrs (file-attributes from))) + (when (equal (or rem-dirname fromname) + (or rem-newname destname)) + (error "Can't copy directory `%s' on itself" from)) (if (and recursive =2D (eq t (car attrs)) =2D (or (eq recursive 'always) =2D (yes-or-no-p (format "Recursive copies of %s? " from)))) =2D ;; This is a directory. =2D (copy-directory from to preserve-time) + (eq t (car attrs)) + (or (eq recursive 'always) + (yes-or-no-p (format "Recursive copies of %s? " from)))) + ;; This is a directory. + (copy-directory from to preserve-time) ;; Not a directory. (or top (dired-handle-overwrite to)) (condition-case err =2D (if (stringp (car attrs)) =2D ;; It is a symlink =2D (make-symbolic-link (car attrs) to ok-flag) =2D (copy-file from to ok-flag preserve-time)) =2D (file-date-error =2D (push (dired-make-relative from) =2D dired-create-files-failures) =2D (dired-log "Can't set date on %s:\n%s\n" from err)))))) + (if (stringp (car attrs)) + ;; It is a symlink + (make-symbolic-link (car attrs) to ok-flag) + (copy-file from to ok-flag preserve-time)) + (file-date-error + (push (dired-make-relative from) + dired-create-files-failures) + (dired-log "Can't set date on %s:\n%s\n" from err)))))) =20 ;;;###autoload (defun dired-rename-file (file newname ok-if-already-exists) @@ -1402,7 +1412,7 @@ newfile's entry, or t to use the current marker character if the old file was marked." (let (dired-create-files-failures failures =2D skipped (success-count 0) (total (length fn-list))) + skipped (success-count 0) (total (leng= th fn-list))) (let (to overwrite-query overwrite-backup-query) ; for dired-handle-overwrite (dolist (from fn-list) @@ -1430,10 +1440,40 @@ (cond ((integerp marker-char) marker-char) (marker-char (dired-file-marker from)) ; slow (t nil)))) =2D (when (and (file-directory-p from) =2D (file-directory-p to) =2D (eq file-creator 'dired-copy-file)) =2D (setq to (file-name-directory to))) + ;; Handle the `dired-copy-file' file-creator specially + ;; When copying a directory to another directory or + ;; possibly to itself. + ;; (e.g "~/foo" =3D> "~/test" or "~/foo" =3D>"~/foo") + ;; In this case the 'name-constructor' have set the destination + ;; 'to' to "~/test/foo" because the old + ;; emacs23 behavior of `copy-directory' + ;; was no not create the subdir and copy instead the contents = only. + ;; With it's new behavior (similar to cp shell command) we don= 't + ;; need such a construction, so modify the destination 'to' to + ;; "~/test/" instead of "~/test/foo/". + ;; If from and to are the same directory do the same, + ;; the error will be handled by `dired-copy-file-recursive'. + (let* ((case-fold-search t) + (fromname (file-name-as-directory (file-truename fr= om))) + (destname (file-name-as-directory (file-name-direct= ory + (file-truename t= o)))) + (rem-fromname (and (equal "sudo" (file-remote-p fromname + 'method= )) + (file-remote-p fromname 'localname))) + (rem-newname (and (equal "sudo" (file-remote-p destname + 'method= )) + (file-remote-p destname 'localname))= )) + (when (and (file-directory-p from) + (or (equal (or + ;; Maybe a remote file with sudo meth= od + ;; converted to its localname. + rem-fromname + ;; Otherwise compare with local name. + fromname) + (or rem-newname destname)) + (file-directory-p to)) + (eq file-creator 'dired-copy-file)) + (setq to (file-name-directory to)))) (condition-case err (progn (funcall file-creator from to dired-overwrite-confirmed) @@ -1456,21 +1496,21 @@ (setq failures (nconc failures dired-create-files-failures)) (dired-log-summary (format "%s failed for %d file%s in %d requests" =2D operation (length failures) =2D (dired-plural-s (length failures)) =2D total) + operation (length failures) + (dired-plural-s (length failures)) + total) failures)) (failures (dired-log-summary (format "%s failed for %d of %d file%s" =2D operation (length failures) =2D total (dired-plural-s total)) + operation (length failures) + total (dired-plural-s total)) failures)) (skipped (dired-log-summary (format "%s: %d of %d file%s skipped" =2D operation (length skipped) total =2D (dired-plural-s total)) + operation (length skipped) total + (dired-plural-s total)) skipped)) (t (message "%s: %s file%s" diff --git a/lisp/files.el b/lisp/files.el =2D-- a/lisp/files.el +++ b/lisp/files.el @@ -4928,10 +4928,20 @@ (format "Copy directory %s to: " dir) default-directory default-directory nil nil) current-prefix-arg t nil))) =2D ;; If default-directory is a remote directory, make sure we find its =2D ;; copy-directory handler. =2D (let ((handler (or (find-file-name-handler directory 'copy-directory) =2D (find-file-name-handler newname 'copy-directory)))) + (let* ((case-fold-search t) + (fromname (file-name-as-directory (file-truename directory))) + (destname (file-name-as-directory (file-truename newname))) + (rem-dirname (and (equal "sudo" (file-remote-p fromname 'method)) + (file-remote-p fromname 'localname))) + (rem-newname (and (equal "sudo" (file-remote-p destname 'method)) + (file-remote-p destname 'localname))) + ;; If default-directory is a remote directory, make sure we find = its + ;; copy-directory handler. + (handler (or (find-file-name-handler directory 'copy-directory) + (find-file-name-handler newname 'copy-directory)))) + (when (equal (or rem-dirname fromname) + (or rem-newname destname)) + (error "Can't copy directory `%s' on itself" directory)) (if handler (funcall handler 'copy-directory directory newname keep-time parents) =20 --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAk8Qg1gACgkQKNF/U1nymZf6ZwCgkn18f1RlmFBq0GysQmGBXJBS KfUAoLqtmZ/zvAh4IMsKqQ3TFkWC6qr6 =X4m/ -----END PGP SIGNATURE----- --==-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 14:21:52 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 19:21:52 +0000 Received: from localhost ([127.0.0.1]:56723 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlmhD-0002VS-SY for submit@debbugs.gnu.org; Fri, 13 Jan 2012 14:21:52 -0500 Received: from acsinet15.oracle.com ([141.146.126.227]:29094) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlmhC-0002VL-0c for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 14:21:50 -0500 Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by acsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id q0DJL9jZ025408 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 13 Jan 2012 19:21:10 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q0DJL8lR003064 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 13 Jan 2012 19:21:09 GMT Received: from abhmt118.oracle.com (abhmt118.oracle.com [141.146.116.70]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q0DJL88t005938; Fri, 13 Jan 2012 13:21:08 -0600 Received: from dradamslap1 (/10.159.36.36) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 13 Jan 2012 11:21:08 -0800 From: "Drew Adams" To: "'Thierry Volpiatto'" , <10489@debbugs.gnu.org> References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com><8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com><87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com><87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com><011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com><878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com><02043028DF764049AB57ED4D7C715992@us.oracle.com> <87ty3z76yo.fsf@gmail.com> Subject: RE: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Date: Fri, 13 Jan 2012 11:21:04 -0800 Message-ID: <2788B42CD0814BF8950162EEA03FEE1E@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <87ty3z76yo.fsf@gmail.com> Thread-Index: AczSJ03v0an9K6GgRMSIWHqoMcDdoAAALYHg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Source-IP: ucsinet21.oracle.com [156.151.31.93] X-CT-RefId: str=0001.0A090204.4F108426.00DB,ss=1,re=0.000,fgs=0 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 10489 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) > > For one thing, you are accessing a remote file before > > testing whether it is remote according to its name, > > which systematically costs you a remote access > > (login etc.), perhaps uselessly. > > Agree, but for this use case the connection is already open > so there is not really a cost with remote access. What use case? I thought the discussion was about coming up with a general function to compare file names to determine whether their files are the same. > But anyway as Michael point we need to test also user, method.. > to much! I believe that is all taken care of by the code I sent, which uses `file-remote-p'. IOW, I think `file-remote-p' does that. But I'm no expert on this stuff. From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 14:36:34 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 19:36:34 +0000 Received: from localhost ([127.0.0.1]:56756 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlmvS-0002qh-0A for submit@debbugs.gnu.org; Fri, 13 Jan 2012 14:36:34 -0500 Received: from mailout-de.gmx.net ([213.165.64.23]:48594) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1RlmvP-0002qZ-FI for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 14:36:32 -0500 Received: (qmail invoked by alias); 13 Jan 2012 19:35:51 -0000 Received: from p57BB9670.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.150.112] by mail.gmx.net (mp031) with SMTP; 13 Jan 2012 20:35:51 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX18BCjsSoukBZqTPVkLJkwOU3p+rd2DKBpqC5Z9q0s s43mXfwWyCbbGV From: Michael Albinus To: "Drew Adams" Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <02043028DF764049AB57ED4D7C715992@us.oracle.com> <87ty3z76yo.fsf@gmail.com> <2788B42CD0814BF8950162EEA03FEE1E@us.oracle.com> Date: Fri, 13 Jan 2012 20:35:46 +0100 In-Reply-To: <2788B42CD0814BF8950162EEA03FEE1E@us.oracle.com> (Drew Adams's message of "Fri, 13 Jan 2012 11:21:04 -0800") Message-ID: <87boq7o0od.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, 'Thierry Volpiatto' X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) "Drew Adams" writes: > I believe that is all taken care of by the code I sent, which uses > `file-remote-p'. IOW, I think `file-remote-p' does that. But I'm no > expert on this stuff. As I've pointed out, a specialized Tramp function could do better than Tramp's version of `file-remote-p', for example knowing that the methods "ssh" and "scp" are equal when it is about `file-name-equal-p'. That's why I'm in favor of `file-name-equal-p' AND its file name handler for remote files. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 14:44:28 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 19:44:28 +0000 Received: from localhost ([127.0.0.1]:56760 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rln36-00033H-6y for submit@debbugs.gnu.org; Fri, 13 Jan 2012 14:44:28 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:4539) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rln31-000337-5E for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 14:44:26 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EAL6IEE9FxKkV/2dsb2JhbABCqnmCM4EGgXIBAQQBViMFCws0EhQYDSSIDbZ+jB0EiDyaYYRS X-IronPort-AV: E=Sophos;i="4.71,506,1320642000"; d="scan'208";a="156639782" Received: from 69-196-169-21.dsl.teksavvy.com (HELO pastel.home) ([69.196.169.21]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 13 Jan 2012 14:43:43 -0500 Received: by pastel.home (Postfix, from userid 20848) id 3E7DF59439; Fri, 13 Jan 2012 14:43:43 -0500 (EST) From: Stefan Monnier To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Message-ID: References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> Date: Fri, 13 Jan 2012 14:43:43 -0500 In-Reply-To: <8739bj8mu1.fsf@gmail.com> (Thierry Volpiatto's message of "Fri, 13 Jan 2012 19:43:50 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > What about this? > (defun file-name-equal-p (name1 name2 &optional dir) > (let* ((n1 (file-truename (expand-file-name name1 dir))) There's a crucial line missing between the above two. It should clearly document what this function is expected to do. E.g. it should make it clear if (and if so, to what extent) the function is allowed to refer to the actual file system(s) as opposed to only relying on the provided strings. Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 15:57:26 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 20:57:26 +0000 Received: from localhost ([127.0.0.1]:56825 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RloBh-0004g7-IN for submit@debbugs.gnu.org; Fri, 13 Jan 2012 15:57:26 -0500 Received: from rcsinet15.oracle.com ([148.87.113.117]:32085) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RloBf-0004fz-2t for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 15:57:24 -0500 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by rcsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id q0DKugXi012354 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 13 Jan 2012 20:56:42 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q0DKufMi022560 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 13 Jan 2012 20:56:41 GMT Received: from abhmt114.oracle.com (abhmt114.oracle.com [141.146.116.66]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q0DKufuh019054; Fri, 13 Jan 2012 14:56:41 -0600 Received: from dradamslap1 (/10.159.36.36) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 13 Jan 2012 12:56:41 -0800 From: "Drew Adams" To: "'Michael Albinus'" References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com><8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com><87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com><87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com><011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com><878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com><02043028DF764049AB57ED4D7C715992@us.oracle.com><87ty3z76yo.fsf@gmail.com><2788B42CD0814BF8950162EEA03FEE1E@us.oracle.com> <87boq7o0od.fsf@gmx.de> Subject: RE: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Date: Fri, 13 Jan 2012 12:56:37 -0800 Message-ID: <322B030D58CD47C4995AB6FF17205454@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <87boq7o0od.fsf@gmx.de> Thread-Index: AczSKpD/78gjkdKkRoOUdhou7bBeXwACwS+A X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090201.4F109A8B.00F7,ss=1,re=0.000,fgs=0 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, 'Thierry Volpiatto' X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) > > I believe that is all taken care of by the code I sent, which uses > > `file-remote-p'. IOW, I think `file-remote-p' does that. > > But I'm no expert on this stuff. > > As I've pointed out, a specialized Tramp function could do better than > Tramp's version of `file-remote-p', for example knowing that > the methods "ssh" and "scp" are equal when it is about `file-name-equal-p'. > > That's why I'm in favor of `file-name-equal-p' AND its file > name handler for remote files. Sounds good to me. From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 17:52:43 2012 Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 22:52:43 +0000 Received: from localhost ([127.0.0.1]:56892 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlpzH-0007Gu-3s for submit@debbugs.gnu.org; Fri, 13 Jan 2012 17:52:43 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:52686) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1RlpzD-0007Gk-T7 for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 17:52:41 -0500 Received: (qmail invoked by alias); 13 Jan 2012 22:51:58 -0000 Received: from p57BB9670.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.150.112] by mail.gmx.net (mp026) with SMTP; 13 Jan 2012 23:51:58 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX19+JSs0Rc1+eVOhLJFok1YFmiOVJH3M/Q7czAunaO 8maBtN6xiVDKtH From: Michael Albinus To: Stefan Monnier Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> Date: Fri, 13 Jan 2012 23:51:52 +0100 In-Reply-To: (Stefan Monnier's message of "Fri, 13 Jan 2012 14:43:43 -0500") Message-ID: <8762gfnrlj.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Stefan Monnier writes: >> What about this? >> (defun file-name-equal-p (name1 name2 &optional dir) >> (let* ((n1 (file-truename (expand-file-name name1 dir))) > > There's a crucial line missing between the above two. It should clearly > document what this function is expected to do. E.g. it should make it > clear if (and if so, to what extent) the function is allowed to refer to > the actual file system(s) as opposed to only relying on the > provided strings. If the file name strings are not obviously equal, `file-truename' will refer to the underlying file system(s). There will be some checks to avoid this for remote files, for example due to different host names used in both file names, but this are implementation details. This is the difference to `file-remote-p', which works only with the given file name strings. Something like (defun file-equal-p (name1 name2 &optional dir) "Return non-nil if NAME1 and NAME2 refer to the same file in the file system. If either name is not absolute, then it is expanded relative to DIR (if given) or `default-directory' for the test." (let ((fn1 (expand-file-name name1 dir)) (fn2 (expand-file-name name2 dir))) (cond ((string-equal fn1 fn2)) ((and (file-remote-p fn1) (file-remote-p fn2)) (let ((handler (or (find-file-name-handler fn1 'file-equal-p) (find-file-name-handler fn2 'file-equal-p)))) (if handler (funcall handler 'file-equal-p name1 name2 dir)))) ((or (file-remote-p fn1) (file-remote-p fn2)) nil) (t (if the-var-which-tells-us-case-insensitivity (string-equal (downcase (file-truename fn1)) (downcase (file-truename fn1))) (string-equal (file-truename fn1) (file-truename fn1)))))) > Stefan Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 20:56:07 2012 Received: (at 10489) by debbugs.gnu.org; 14 Jan 2012 01:56:07 +0000 Received: from localhost ([127.0.0.1]:56925 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rlsql-0002zp-LA for submit@debbugs.gnu.org; Fri, 13 Jan 2012 20:56:07 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:21092) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rlsqj-0002zh-GQ for 10489@debbugs.gnu.org; Fri, 13 Jan 2012 20:56:06 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EAGrfEE9FxKkV/2dsb2JhbABDqwKCM4EGgXIBAQQBViMQCzQSFBgNJIgNtxGMFwSIO5phhFI X-IronPort-AV: E=Sophos;i="4.71,508,1320642000"; d="scan'208";a="156717350" Received: from 69-196-169-21.dsl.teksavvy.com (HELO ceviche.home) ([69.196.169.21]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 13 Jan 2012 20:55:24 -0500 Received: by ceviche.home (Postfix, from userid 20848) id F27E16610D; Fri, 13 Jan 2012 20:55:23 -0500 (EST) From: Stefan Monnier To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Message-ID: References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <8762gfnrlj.fsf@gmx.de> Date: Fri, 13 Jan 2012 20:55:23 -0500 In-Reply-To: <8762gfnrlj.fsf@gmx.de> (Michael Albinus's message of "Fri, 13 Jan 2012 23:51:52 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >> There's a crucial line missing between the above two. It should clearly >> document what this function is expected to do. E.g. it should make it >> clear if (and if so, to what extent) the function is allowed to refer to >> the actual file system(s) as opposed to only relying on the >> provided strings. > If the file name strings are not obviously equal, `file-truename' will I don't mean "document what the code currently does" but "document what the code should do". > "Return non-nil if NAME1 and NAME2 refer to the same file in the file system. > If either name is not absolute, then it is expanded relative to > DIR (if given) or `default-directory' for the test." That description is too vague: an implementation based on comparing file-attributes would seem to fit, whereas it's clearly not the semantic we want to provide. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 14 02:28:40 2012 Received: (at control) by debbugs.gnu.org; 14 Jan 2012 07:28:40 +0000 Received: from localhost ([127.0.0.1]:57041 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rly2Z-0002qX-Fv for submit@debbugs.gnu.org; Sat, 14 Jan 2012 02:28:39 -0500 Received: from fencepost.gnu.org ([140.186.70.10]:54981) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rly2X-0002qQ-OS for control@debbugs.gnu.org; Sat, 14 Jan 2012 02:28:38 -0500 Received: from [155.69.16.204] (port=36243 helo=furball) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1Rly1r-0005ym-GJ for control@debbugs.gnu.org; Sat, 14 Jan 2012 02:27:56 -0500 From: Chong Yidong To: control@debbugs.gnu.org Subject: severity 10489 important Date: Sat, 14 Jan 2012 15:27:49 +0800 Message-ID: <87aa5qg2ve.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) severity 10489 important thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 14 03:01:53 2012 Received: (at 10489) by debbugs.gnu.org; 14 Jan 2012 08:01:53 +0000 Received: from localhost ([127.0.0.1]:57047 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlyYj-0004NH-Dl for submit@debbugs.gnu.org; Sat, 14 Jan 2012 03:01:53 -0500 Received: from mtaout22.012.net.il ([80.179.55.172]:47765) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlyYg-0004N8-8C for 10489@debbugs.gnu.org; Sat, 14 Jan 2012 03:01:51 -0500 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0LXS00N0038Z4H00@a-mtaout22.012.net.il> for 10489@debbugs.gnu.org; Sat, 14 Jan 2012 10:00:19 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.124.136.230]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LXS00MUE3KIDPC0@a-mtaout22.012.net.il>; Sat, 14 Jan 2012 10:00:19 +0200 (IST) Date: Sat, 14 Jan 2012 10:00:25 +0200 From: Eli Zaretskii Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy In-reply-to: <87pqen76p4.fsf@gmail.com> X-012-Sender: halo1@inter.net.il To: Thierry Volpiatto Message-id: <83fwfik92e.fsf@gnu.org> References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <87fwfjo24c.fsf@gmx.de> <87pqen76p4.fsf@gmail.com> X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, michael.albinus@gmx.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) > From: Thierry Volpiatto > Date: Fri, 13 Jan 2012 20:17:43 +0100 > Cc: 10489@debbugs.gnu.org > > (defun dired-copy-file-recursive (from to ok-flag &optional > preserve-time top recursive) > - (let ((attrs (file-attributes from))) > + (let* ((case-fold-search t) > + (fromname (file-name-as-directory (file-truename from))) > + (destname (file-name-as-directory (file-truename to))) > + (rem-dirname (and (equal "sudo" (file-remote-p fromname 'method)) > + (file-remote-p fromname 'localname))) > + (rem-newname (and (equal "sudo" (file-remote-p destname 'method)) > + (file-remote-p destname 'localname))) > + (attrs (file-attributes from))) > + (when (equal (or rem-dirname fromname) > + (or rem-newname destname)) > + (error "Can't copy directory `%s' on itself" from)) Why is case-fold-search being unconditionally bound to t? I don't think this is TRT on case-sensitive filesystems. Am I missing something? From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 14 04:00:13 2012 Received: (at 10489) by debbugs.gnu.org; 14 Jan 2012 09:00:13 +0000 Received: from localhost ([127.0.0.1]:57061 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlzTB-0005fc-2x for submit@debbugs.gnu.org; Sat, 14 Jan 2012 04:00:13 -0500 Received: from mtaout20.012.net.il ([80.179.55.166]:35409) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlzT8-0005fS-8h for 10489@debbugs.gnu.org; Sat, 14 Jan 2012 04:00:11 -0500 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0LXS0090069DGU00@a-mtaout20.012.net.il> for 10489@debbugs.gnu.org; Sat, 14 Jan 2012 10:58:57 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.124.136.230]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LXS009HU6A8GC00@a-mtaout20.012.net.il>; Sat, 14 Jan 2012 10:58:57 +0200 (IST) Date: Sat, 14 Jan 2012 10:59:03 +0200 From: Eli Zaretskii Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy In-reply-to: X-012-Sender: halo1@inter.net.il To: Stefan Monnier Message-id: <83aa5qk6co.fsf@gnu.org> References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <8762gfnrlj.fsf@gmx.de> X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, michael.albinus@gmx.de, thierry.volpiatto@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) > From: Stefan Monnier > Date: Fri, 13 Jan 2012 20:55:23 -0500 > Cc: 10489@debbugs.gnu.org, Thierry Volpiatto > > >> There's a crucial line missing between the above two. It should clearly > >> document what this function is expected to do. E.g. it should make it > >> clear if (and if so, to what extent) the function is allowed to refer to > >> the actual file system(s) as opposed to only relying on the > >> provided strings. > > If the file name strings are not obviously equal, `file-truename' will > > I don't mean "document what the code currently does" but "document > what the code should do". Same thing in this case. If we want to resolve the various cases of equivalent file names, we have no alternative but hitting the disk. > > "Return non-nil if NAME1 and NAME2 refer to the same file in the file system. > > If either name is not absolute, then it is expanded relative to > > DIR (if given) or `default-directory' for the test." > > That description is too vague: an implementation based on comparing > file-attributes would seem to fit, whereas it's clearly not the semantic > we want to provide. Sorry, I'm not following. Why does a possibly different implementation make the doc string "too vague"? IOW, the doc string _should_ be sufficiently "vague" to allow a change in the implementation without breaking the API or the semantics, right? From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 14 05:26:19 2012 Received: (at 10489) by debbugs.gnu.org; 14 Jan 2012 10:26:19 +0000 Received: from localhost ([127.0.0.1]:57121 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rm0oU-0007cE-MD for submit@debbugs.gnu.org; Sat, 14 Jan 2012 05:26:19 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:43378) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rm0oN-0007c0-4M for 10489@debbugs.gnu.org; Sat, 14 Jan 2012 05:26:15 -0500 Received: by wibhj6 with SMTP id hj6so1062989wib.3 for <10489@debbugs.gnu.org>; Sat, 14 Jan 2012 02:25:28 -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=gIWpL3oApx7VoF7uzDTels9PejCy2hluMBgTfjE/IPo=; b=c1Uz4eFZeNKsqJJKbylq9WtksSN+tJh2QJKrHEy5H3zGFx6o/lSO0/F/niPoTYbfm4 yrNSxBHY0Q0JTVVQWS/9AW7Yjdhv62tIdifWpcW0fmPDZd0Zxh1zxXXzTSH5/VFd1+rS aLeVJsQAd3ZooDb6PNDmoDajToodk5gDTYt94= Received: by 10.180.24.105 with SMTP id t9mr7572716wif.19.1326536728363; Sat, 14 Jan 2012 02:25:28 -0800 (PST) Received: from thierry-MM061 (197.78.88.79.rev.sfr.net. [79.88.78.197]) by mx.google.com with ESMTPS id bj10sm6280431wib.9.2012.01.14.02.25.24 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 14 Jan 2012 02:25:26 -0800 (PST) From: Thierry Volpiatto To: Eli Zaretskii Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <87fwfjo24c.fsf@gmx.de> <87pqen76p4.fsf@gmail.com> <83fwfik92e.fsf@gnu.org> Date: Sat, 14 Jan 2012 11:25:16 +0100 In-Reply-To: <83fwfik92e.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 14 Jan 2012 10:00:25 +0200") Message-ID: <87mx9q1sz7.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, michael.albinus@gmx.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Eli Zaretskii writes: >> From: Thierry Volpiatto >> Date: Fri, 13 Jan 2012 20:17:43 +0100 >> Cc: 10489@debbugs.gnu.org >>=20 >> (defun dired-copy-file-recursive (from to ok-flag &optional >> preserve-time top recursive) >> - (let ((attrs (file-attributes from))) >> + (let* ((case-fold-search t) >> + (fromname (file-name-as-directory (file-truename from))) >> + (destname (file-name-as-directory (file-truename to))) >> + (rem-dirname (and (equal "sudo" (file-remote-p fromname 'metho= d)) >> + (file-remote-p fromname 'localname))) >> + (rem-newname (and (equal "sudo" (file-remote-p destname 'metho= d)) >> + (file-remote-p destname 'localname))) >> + (attrs (file-attributes from))) >> + (when (equal (or rem-dirname fromname) >> + (or rem-newname destname)) >> + (error "Can't copy directory `%s' on itself" from)) > > Why is case-fold-search being unconditionally bound to t? I don't > think this is TRT on case-sensitive filesystems. Am I missing > something? Ignore, it have no effect, I have changed that. The last patch use this instead, which avoid duplication of code and is more readable. =2D-8<---------------cut here---------------start------------->8--- (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 dest= name 'host)) (file-remote-p destname 'localname)))) (not (equal (or rem-fromname fromname) (or rem-newname destname))))) =2D-8<---------------cut here---------------end--------------->8--- This work in these cases: =2D usage on local filesystem. =2D Copying from a remote filesystem on local filesystem. =2D Copying from local filesystem to remote filesystem. =2D Copying on a remote filesystem to same remote filesystem with same method. This may not work in these cases: =2D copying from a remote filesystem to this same remote filesystem with a different method. (Why one would do that?) e.g /ssh:host:/foo =3D> /scpc:host:/foo =2D Others - please complete (Windows, other tramp use cases, etc...) =2D-=20 Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997=20 --=-=-= Content-Type: application/octet-stream Content-Disposition: attachment; filename=patch-r118414 Content-Transfer-Encoding: base64 IyBIRyBjaGFuZ2VzZXQgcGF0Y2gKIyBVc2VyIFRoaWVycnkgVm9scGlhdHRvIDx0aGllcnJ5LnZv bHBpYXR0b0BnbWFpbC5jb20+CiMgRGF0ZSAxMzI2NTM2NjgwIC0zNjAwCiMgTm9kZSBJRCBiNDMz MGZiZjFjMzU4YTk2NDQ1ZDg3ODBmZDllY2E3ZWIxOTVkMDU3CiMgUGFyZW50ICAyMDY1YjViODg3 YzNiYjk0NmFmNmVlZmRjMTM0NzU5ZDA0NTk4NzZlCkJ1Z2ZpeCBidWcjMTA0ODksIGRpcmVkLWRv LWNvcHkgbWF5IGNyZWF0ZSBpbmZpbml0ZSBkaXJlY3RvcnkgaGllcmFyY2h5LgoqIGxpc3AvZGly ZWQtYXV4LmVsCiogbGlzcC9maWxlcy5lbAoKZGlmZiAtLWdpdCBhL2xpc3AvZGlyZWQtYXV4LmVs IGIvbGlzcC9kaXJlZC1hdXguZWwKLS0tIGEvbGlzcC9kaXJlZC1hdXguZWwKKysrIGIvbGlzcC9k aXJlZC1hdXguZWwKQEAgLTEyNjQsMjQgKzEyNjQsMjYgQEAKIAogKGRlZnVuIGRpcmVkLWNvcHkt ZmlsZS1yZWN1cnNpdmUgKGZyb20gdG8gb2stZmxhZyAmb3B0aW9uYWwKIAkJCQkgICAgICAgcHJl c2VydmUtdGltZSB0b3AgcmVjdXJzaXZlKQorICAodW5sZXNzIChmaWxlcy1jb3B5YWJsZS1wIGZy b20gdG8pCisgICAgKGVycm9yICJDYW4ndCBjb3B5IGRpcmVjdG9yeSBgJXMnIG9uIGl0c2VsZiIg ZnJvbSkpCiAgIChsZXQgKChhdHRycyAoZmlsZS1hdHRyaWJ1dGVzIGZyb20pKSkKICAgICAoaWYg KGFuZCByZWN1cnNpdmUKLQkgICAgIChlcSB0IChjYXIgYXR0cnMpKQotCSAgICAgKG9yIChlcSBy ZWN1cnNpdmUgJ2Fsd2F5cykKLQkJICh5ZXMtb3Itbm8tcCAoZm9ybWF0ICJSZWN1cnNpdmUgY29w aWVzIG9mICVzPyAiIGZyb20pKSkpCi0JOzsgVGhpcyBpcyBhIGRpcmVjdG9yeS4KLQkoY29weS1k aXJlY3RvcnkgZnJvbSB0byBwcmVzZXJ2ZS10aW1lKQorICAgICAgICAgICAgIChlcSB0IChjYXIg YXR0cnMpKQorICAgICAgICAgICAgIChvciAoZXEgcmVjdXJzaXZlICdhbHdheXMpCisgICAgICAg ICAgICAgICAgICh5ZXMtb3Itbm8tcCAoZm9ybWF0ICJSZWN1cnNpdmUgY29waWVzIG9mICVzPyAi IGZyb20pKSkpCisgICAgICAgIDs7IFRoaXMgaXMgYSBkaXJlY3RvcnkuCisgICAgICAgIChjb3B5 LWRpcmVjdG9yeSBmcm9tIHRvIHByZXNlcnZlLXRpbWUpCiAgICAgICA7OyBOb3QgYSBkaXJlY3Rv cnkuCiAgICAgICAob3IgdG9wIChkaXJlZC1oYW5kbGUtb3ZlcndyaXRlIHRvKSkKICAgICAgIChj b25kaXRpb24tY2FzZSBlcnIKLQkgIChpZiAoc3RyaW5ncCAoY2FyIGF0dHJzKSkKLQkgICAgICA7 OyBJdCBpcyBhIHN5bWxpbmsKLQkgICAgICAobWFrZS1zeW1ib2xpYy1saW5rIChjYXIgYXR0cnMp IHRvIG9rLWZsYWcpCi0JICAgIChjb3B5LWZpbGUgZnJvbSB0byBvay1mbGFnIHByZXNlcnZlLXRp bWUpKQotCShmaWxlLWRhdGUtZXJyb3IKLQkgKHB1c2ggKGRpcmVkLW1ha2UtcmVsYXRpdmUgZnJv bSkKLQkgICAgICAgZGlyZWQtY3JlYXRlLWZpbGVzLWZhaWx1cmVzKQotCSAoZGlyZWQtbG9nICJD YW4ndCBzZXQgZGF0ZSBvbiAlczpcbiVzXG4iIGZyb20gZXJyKSkpKSkpCisgICAgICAgICAgKGlm IChzdHJpbmdwIChjYXIgYXR0cnMpKQorICAgICAgICAgICAgICA7OyBJdCBpcyBhIHN5bWxpbmsK KyAgICAgICAgICAgICAgKG1ha2Utc3ltYm9saWMtbGluayAoY2FyIGF0dHJzKSB0byBvay1mbGFn KQorICAgICAgICAgICAgKGNvcHktZmlsZSBmcm9tIHRvIG9rLWZsYWcgcHJlc2VydmUtdGltZSkp CisgICAgICAgIChmaWxlLWRhdGUtZXJyb3IKKyAgICAgICAgIChwdXNoIChkaXJlZC1tYWtlLXJl bGF0aXZlIGZyb20pCisgICAgICAgICAgICAgICBkaXJlZC1jcmVhdGUtZmlsZXMtZmFpbHVyZXMp CisgICAgICAgICAoZGlyZWQtbG9nICJDYW4ndCBzZXQgZGF0ZSBvbiAlczpcbiVzXG4iIGZyb20g ZXJyKSkpKSkpCiAKIDs7OyMjI2F1dG9sb2FkCiAoZGVmdW4gZGlyZWQtcmVuYW1lLWZpbGUgKGZp bGUgbmV3bmFtZSBvay1pZi1hbHJlYWR5LWV4aXN0cykKQEAgLTE0MDIsNyArMTQwNCw3IEBACiBu ZXdmaWxlJ3MgZW50cnksIG9yIHQgdG8gdXNlIHRoZSBjdXJyZW50IG1hcmtlciBjaGFyYWN0ZXIg aWYgdGhlCiBvbGQgZmlsZSB3YXMgbWFya2VkLiIKICAgKGxldCAoZGlyZWQtY3JlYXRlLWZpbGVz LWZhaWx1cmVzIGZhaWx1cmVzCi0Jc2tpcHBlZCAoc3VjY2Vzcy1jb3VudCAwKSAodG90YWwgKGxl bmd0aCBmbi1saXN0KSkpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBza2lw cGVkIChzdWNjZXNzLWNvdW50IDApICh0b3RhbCAobGVuZ3RoIGZuLWxpc3QpKSkKICAgICAobGV0 ICh0byBvdmVyd3JpdGUtcXVlcnkKIAkgICAgIG92ZXJ3cml0ZS1iYWNrdXAtcXVlcnkpCTsgZm9y IGRpcmVkLWhhbmRsZS1vdmVyd3JpdGUKICAgICAgIChkb2xpc3QgKGZyb20gZm4tbGlzdCkKQEAg LTE0MzAsMTAgKzE0MzIsMjUgQEAKICAgICAgICAgICAgICAgICAgIChjb25kICAoKGludGVnZXJw IG1hcmtlci1jaGFyKSBtYXJrZXItY2hhcikKICAgICAgICAgICAgICAgICAgICAgICAgICAobWFy a2VyLWNoYXIgKGRpcmVkLWZpbGUtbWFya2VyIGZyb20pKSA7IHNsb3cKICAgICAgICAgICAgICAg ICAgICAgICAgICAodCBuaWwpKSkpCi0JICAgICh3aGVuIChhbmQgKGZpbGUtZGlyZWN0b3J5LXAg ZnJvbSkKLQkJICAgICAgIChmaWxlLWRpcmVjdG9yeS1wIHRvKQotCQkgICAgICAgKGVxIGZpbGUt Y3JlYXRvciAnZGlyZWQtY29weS1maWxlKSkKLQkgICAgICAoc2V0cSB0byAoZmlsZS1uYW1lLWRp cmVjdG9yeSB0bykpKQorICAgICAgICAgICAgOzsgSGFuZGxlIHRoZSBgZGlyZWQtY29weS1maWxl JyBmaWxlLWNyZWF0b3Igc3BlY2lhbGx5CisgICAgICAgICAgICA7OyBXaGVuIGNvcHlpbmcgYSBk aXJlY3RvcnkgdG8gYW5vdGhlciBkaXJlY3Rvcnkgb3IKKyAgICAgICAgICAgIDs7IHBvc3NpYmx5 IHRvIGl0c2VsZi4KKyAgICAgICAgICAgIDs7IChlLmcgIn4vZm9vIiA9PiAifi90ZXN0IiBvciAi fi9mb28iID0+In4vZm9vIikKKyAgICAgICAgICAgIDs7IEluIHRoaXMgY2FzZSB0aGUgJ25hbWUt Y29uc3RydWN0b3InIGhhdmUgc2V0IHRoZSBkZXN0aW5hdGlvbgorICAgICAgICAgICAgOzsgJ3Rv JyB0byAifi90ZXN0L2ZvbyIgYmVjYXVzZSB0aGUgb2xkCisgICAgICAgICAgICA7OyBlbWFjczIz IGJlaGF2aW9yIG9mIGBjb3B5LWRpcmVjdG9yeScKKyAgICAgICAgICAgIDs7IHdhcyBubyBub3Qg Y3JlYXRlIHRoZSBzdWJkaXIgYW5kIGNvcHkgaW5zdGVhZCB0aGUgY29udGVudHMgb25seS4KKyAg ICAgICAgICAgIDs7IFdpdGggaXQncyBuZXcgYmVoYXZpb3IgKHNpbWlsYXIgdG8gY3Agc2hlbGwg Y29tbWFuZCkgd2UgZG9uJ3QKKyAgICAgICAgICAgIDs7IG5lZWQgc3VjaCBhIGNvbnN0cnVjdGlv biwgc28gbW9kaWZ5IHRoZSBkZXN0aW5hdGlvbiAndG8nIHRvCisgICAgICAgICAgICA7OyAifi90 ZXN0LyIgaW5zdGVhZCBvZiAifi90ZXN0L2Zvby8iLgorICAgICAgICAgICAgOzsgSWYgZnJvbSBh bmQgdG8gYXJlIHRoZSBzYW1lIGRpcmVjdG9yeSBkbyB0aGUgc2FtZSwKKyAgICAgICAgICAgIDs7 IHRoZSBlcnJvciB3aWxsIGJlIGhhbmRsZWQgYnkgYGRpcmVkLWNvcHktZmlsZS1yZWN1cnNpdmUn LgorICAgICAgICAgICAgKGxldCAoKGRlc3RuYW1lIChmaWxlLW5hbWUtZGlyZWN0b3J5IHRvKSkp CisgICAgICAgICAgICAgICh3aGVuIChhbmQgKGZpbGUtZGlyZWN0b3J5LXAgZnJvbSkKKyAgICAg ICAgICAgICAgICAgICAgICAgICAob3IgKG5vdCAoZmlsZXMtY29weWFibGUtcCBmcm9tIGRlc3Ru YW1lKSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGZpbGUtZGlyZWN0b3J5LXAgdG8p KQorICAgICAgICAgICAgICAgICAgICAgICAgIChlcSBmaWxlLWNyZWF0b3IgJ2RpcmVkLWNvcHkt ZmlsZSkpCisgICAgICAgICAgICAgICAgKHNldHEgdG8gKGZpbGUtbmFtZS1kaXJlY3RvcnkgdG8p KSkpCiAgICAgICAgICAgICAoY29uZGl0aW9uLWNhc2UgZXJyCiAgICAgICAgICAgICAgICAgKHBy b2duCiAgICAgICAgICAgICAgICAgICAoZnVuY2FsbCBmaWxlLWNyZWF0b3IgZnJvbSB0byBkaXJl ZC1vdmVyd3JpdGUtY29uZmlybWVkKQpAQCAtMTQ1NiwyMSArMTQ3MywyMSBAQAogICAgICAgKHNl dHEgZmFpbHVyZXMgKG5jb25jIGZhaWx1cmVzIGRpcmVkLWNyZWF0ZS1maWxlcy1mYWlsdXJlcykp CiAgICAgICAoZGlyZWQtbG9nLXN1bW1hcnkKICAgICAgICAoZm9ybWF0ICIlcyBmYWlsZWQgZm9y ICVkIGZpbGUlcyBpbiAlZCByZXF1ZXN0cyIKLQkJb3BlcmF0aW9uIChsZW5ndGggZmFpbHVyZXMp Ci0JCShkaXJlZC1wbHVyYWwtcyAobGVuZ3RoIGZhaWx1cmVzKSkKLQkJdG90YWwpCisgICAgICAg ICAgICAgICBvcGVyYXRpb24gKGxlbmd0aCBmYWlsdXJlcykKKyAgICAgICAgICAgICAgIChkaXJl ZC1wbHVyYWwtcyAobGVuZ3RoIGZhaWx1cmVzKSkKKyAgICAgICAgICAgICAgIHRvdGFsKQogICAg ICAgIGZhaWx1cmVzKSkKICAgICAgKGZhaWx1cmVzCiAgICAgICAoZGlyZWQtbG9nLXN1bW1hcnkK ICAgICAgICAoZm9ybWF0ICIlcyBmYWlsZWQgZm9yICVkIG9mICVkIGZpbGUlcyIKLQkJb3BlcmF0 aW9uIChsZW5ndGggZmFpbHVyZXMpCi0JCXRvdGFsIChkaXJlZC1wbHVyYWwtcyB0b3RhbCkpCisg ICAgICAgICAgICAgICBvcGVyYXRpb24gKGxlbmd0aCBmYWlsdXJlcykKKyAgICAgICAgICAgICAg IHRvdGFsIChkaXJlZC1wbHVyYWwtcyB0b3RhbCkpCiAgICAgICAgZmFpbHVyZXMpKQogICAgICAo c2tpcHBlZAogICAgICAgKGRpcmVkLWxvZy1zdW1tYXJ5CiAgICAgICAgKGZvcm1hdCAiJXM6ICVk IG9mICVkIGZpbGUlcyBza2lwcGVkIgotCQlvcGVyYXRpb24gKGxlbmd0aCBza2lwcGVkKSB0b3Rh bAotCQkoZGlyZWQtcGx1cmFsLXMgdG90YWwpKQorICAgICAgICAgICAgICAgb3BlcmF0aW9uIChs ZW5ndGggc2tpcHBlZCkgdG90YWwKKyAgICAgICAgICAgICAgIChkaXJlZC1wbHVyYWwtcyB0b3Rh bCkpCiAgICAgICAgc2tpcHBlZCkpCiAgICAgICh0CiAgICAgICAobWVzc2FnZSAiJXM6ICVzIGZp bGUlcyIKZGlmZiAtLWdpdCBhL2xpc3AvZmlsZXMuZWwgYi9saXNwL2ZpbGVzLmVsCi0tLSBhL2xp c3AvZmlsZXMuZWwKKysrIGIvbGlzcC9maWxlcy5lbApAQCAtNDkwMiw2ICs0OTAyLDIxIEBACiAJ CSBkaXJlY3RvcnkgJ2Z1bGwgZGlyZWN0b3J5LWZpbGVzLW5vLWRvdC1maWxlcy1yZWdleHApKSkK ICAgICAgIChkZWxldGUtZGlyZWN0b3J5LWludGVybmFsIGRpcmVjdG9yeSkpKSkpCiAKKyhkZWZ1 biBmaWxlcy1jb3B5YWJsZS1wIChmcm9tIHRvKQorICAiVmVyaWZ5IGlmIGZpbGUgRlJPTSBpcyBu b3QgdGhlIHNhbWUgdGhhbiBUTyBvbiB0aGlzIHN5c3RlbS4iCisgIChsZXQqICgoZnJvbW5hbWUg ICAgIChmaWxlLW5hbWUtYXMtZGlyZWN0b3J5IChmaWxlLXRydWVuYW1lIGZyb20pKSkKKyAgICAg ICAgIChkZXN0bmFtZSAgICAgKGZpbGUtbmFtZS1hcy1kaXJlY3RvcnkgKGZpbGUtdHJ1ZW5hbWUg dG8pKSkKKyAgICAgICAgIChyZW0tZnJvbW5hbWUgKGFuZCAoZXF1YWwgInN1ZG8iIChmaWxlLXJl bW90ZS1wIGZyb21uYW1lICdtZXRob2QpKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIChz dHJpbmctbWF0Y2ggKHN5c3RlbS1uYW1lKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgKGZpbGUtcmVtb3RlLXAgZnJvbW5hbWUgJ2hvc3QpKQorICAgICAgICAgICAg ICAgICAgICAgICAgICAgIChmaWxlLXJlbW90ZS1wIGZyb21uYW1lICdsb2NhbG5hbWUpKSkKKyAg ICAgICAgIChyZW0tbmV3bmFtZSAgKGFuZCAoZXF1YWwgInN1ZG8iIChmaWxlLXJlbW90ZS1wIGRl c3RuYW1lICdtZXRob2QpKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIChzdHJpbmctbWF0 Y2ggKHN5c3RlbS1uYW1lKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgKGZpbGUtcmVtb3RlLXAgZGVzdG5hbWUgJ2hvc3QpKQorICAgICAgICAgICAgICAgICAgICAg ICAgICAgIChmaWxlLXJlbW90ZS1wIGRlc3RuYW1lICdsb2NhbG5hbWUpKSkpCisgICAgKG5vdCAo ZXF1YWwgKG9yIHJlbS1mcm9tbmFtZSBmcm9tbmFtZSkKKyAgICAgICAgICAgICAgICAob3IgcmVt LW5ld25hbWUgZGVzdG5hbWUpKSkpKQorCiAoZGVmdW4gY29weS1kaXJlY3RvcnkgKGRpcmVjdG9y eSBuZXduYW1lICZvcHRpb25hbCBrZWVwLXRpbWUgcGFyZW50cyBjb3B5LWNvbnRlbnRzKQogICAi Q29weSBESVJFQ1RPUlkgdG8gTkVXTkFNRS4gIEJvdGggYXJncyBtdXN0IGJlIHN0cmluZ3MuCiBU aGlzIGZ1bmN0aW9uIGFsd2F5cyBzZXRzIHRoZSBmaWxlIG1vZGVzIG9mIHRoZSBvdXRwdXQgZmls ZXMgdG8gbWF0Y2gKQEAgLTQ5MjgsMTAgKzQ5NDMsMTIgQEAKIAkgICAgKGZvcm1hdCAiQ29weSBk aXJlY3RvcnkgJXMgdG86ICIgZGlyKQogCSAgICBkZWZhdWx0LWRpcmVjdG9yeSBkZWZhdWx0LWRp cmVjdG9yeSBuaWwgbmlsKQogCSAgIGN1cnJlbnQtcHJlZml4LWFyZyB0IG5pbCkpKQorICAodW5s ZXNzIChmaWxlcy1jb3B5YWJsZS1wIGRpcmVjdG9yeSBuZXduYW1lKQorICAgIChlcnJvciAiQ2Fu J3QgY29weSBkaXJlY3RvcnkgYCVzJyBvbiBpdHNlbGYiIGRpcmVjdG9yeSkpCiAgIDs7IElmIGRl ZmF1bHQtZGlyZWN0b3J5IGlzIGEgcmVtb3RlIGRpcmVjdG9yeSwgbWFrZSBzdXJlIHdlIGZpbmQg aXRzCiAgIDs7IGNvcHktZGlyZWN0b3J5IGhhbmRsZXIuCiAgIChsZXQgKChoYW5kbGVyIChvciAo ZmluZC1maWxlLW5hbWUtaGFuZGxlciBkaXJlY3RvcnkgJ2NvcHktZGlyZWN0b3J5KQotCQkgICAg IChmaW5kLWZpbGUtbmFtZS1oYW5kbGVyIG5ld25hbWUgJ2NvcHktZGlyZWN0b3J5KSkpKQorICAg ICAgICAgICAgICAgICAgICAgIChmaW5kLWZpbGUtbmFtZS1oYW5kbGVyIG5ld25hbWUgJ2NvcHkt ZGlyZWN0b3J5KSkpKQogICAgIChpZiBoYW5kbGVyCiAJKGZ1bmNhbGwgaGFuZGxlciAnY29weS1k aXJlY3RvcnkgZGlyZWN0b3J5IG5ld25hbWUga2VlcC10aW1lIHBhcmVudHMpCiAK --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAk8RWAwACgkQKNF/U1nymZcC6QCeKrI0sQPMJWD53lizksmeFytD s2IAn3llk9/FVK46Qvka4J45xCjtYrl6 =h8VY -----END PGP SIGNATURE----- --==-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 14 09:20:47 2012 Received: (at 10489) by debbugs.gnu.org; 14 Jan 2012 14:20:48 +0000 Received: from localhost ([127.0.0.1]:57173 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rm4TO-0005I3-Tt for submit@debbugs.gnu.org; Sat, 14 Jan 2012 09:20:47 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.183]:42338) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rm4TI-0005Hl-7l for 10489@debbugs.gnu.org; Sat, 14 Jan 2012 09:20:44 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EAIKNEU9FxKkV/2dsb2JhbABDqwKCMoEGgXIBAQQBViMFCws0EhQYDSSIDbYojBcEiDuaY4RS X-IronPort-AV: E=Sophos;i="4.71,509,1320642000"; d="scan'208";a="156750079" Received: from 69-196-169-21.dsl.teksavvy.com (HELO pastel.home) ([69.196.169.21]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 14 Jan 2012 09:19:51 -0500 Received: by pastel.home (Postfix, from userid 20848) id 40B0D59439; Sat, 14 Jan 2012 09:19:51 -0500 (EST) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Message-ID: References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <8762gfnrlj.fsf@gmx.de> <83aa5qk6co.fsf@gnu.org> Date: Sat, 14 Jan 2012 09:19:51 -0500 In-Reply-To: <83aa5qk6co.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 14 Jan 2012 10:59:03 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, michael.albinus@gmx.de, thierry.volpiatto@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > > I don't mean "document what the code currently does" but "document > > what the code should do". > Same thing in this case. I was just pointing out that basing the docstring on a sample implementation is not the right way to do it. > If we want to resolve the various cases of equivalent file names, we > have no alternative but hitting the disk. IIRC that's indeed the case if we want to consider equal the VFAT file systems monste~1. And that's exactly the kind of thing I want us to decide by writing the docstring. For POSIX the same question comes up with symlinks. >> > "Return non-nil if NAME1 and NAME2 refer to the same file in the >> > file system. If either name is not absolute, then it is expanded >> > relative to DIR (if given) or `default-directory' for the test." >> That description is too vague: an implementation based on comparing >> file-attributes would seem to fit, whereas it's clearly not the semantic >> we want to provide. > Sorry, I'm not following. Why does a possibly different > implementation make the doc string "too vague"? IOW, the doc string > _should_ be sufficiently "vague" to allow a change in the > implementation without breaking the API or the semantics, right? To me "the same name" is something quite different from "the same file". I think file-name-equal-p should make it clear that it means "same name" and not "same file" because we may want to use it without knowing if the file exists and without opening a remote connection. IIUC the original problem in dired-do-copy needs to test "same file" rather than "same name", so it should not use file-name-equal-p but file-equal-p (which would rely on file-attributes, presumably). Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 14 10:56:30 2012 Received: (at 10489) by debbugs.gnu.org; 14 Jan 2012 15:56:31 +0000 Received: from localhost ([127.0.0.1]:57488 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rm5y2-0008HJ-IY for submit@debbugs.gnu.org; Sat, 14 Jan 2012 10:56:30 -0500 Received: from mtaout20.012.net.il ([80.179.55.166]:42528) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rm5xz-0008HA-9p for 10489@debbugs.gnu.org; Sat, 14 Jan 2012 10:56:28 -0500 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0LXS00D00PEC8T00@a-mtaout20.012.net.il> for 10489@debbugs.gnu.org; Sat, 14 Jan 2012 17:55:42 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.124.136.230]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LXS00CBNPKRXJ40@a-mtaout20.012.net.il>; Sat, 14 Jan 2012 17:55:40 +0200 (IST) Date: Sat, 14 Jan 2012 17:55:46 +0200 From: Eli Zaretskii Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy In-reply-to: X-012-Sender: halo1@inter.net.il To: Stefan Monnier Message-id: <8339bijn25.fsf@gnu.org> References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <8762gfnrlj.fsf@gmx.de> <83aa5qk6co.fsf@gnu.org> X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, michael.albinus@gmx.de, thierry.volpiatto@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) > From: Stefan Monnier > Cc: michael.albinus@gmx.de, 10489@debbugs.gnu.org, thierry.volpiatto@gmail.com > Date: Sat, 14 Jan 2012 09:19:51 -0500 > > To me "the same name" is something quite different from "the same file". > I think file-name-equal-p should make it clear that it means "same name" > and not "same file" because we may want to use it without knowing if the > file exists and without opening a remote connection. "Same file name" would only do case-insensitive comparison on DOS/Windows and exact comparison otherwise. That doesn't need to hit the disk. > IIUC the original problem in dired-do-copy needs to test "same file" > rather than "same name", so it should not use file-name-equal-p but > file-equal-p (which would rely on file-attributes, presumably). I agree; this thread discusses file-equal-p. From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 15 01:00:45 2012 Received: (at 10489) by debbugs.gnu.org; 15 Jan 2012 06:00:45 +0000 Received: from localhost ([127.0.0.1]:57826 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RmJ92-0002v6-CA for submit@debbugs.gnu.org; Sun, 15 Jan 2012 01:00:44 -0500 Received: from mail-we0-f172.google.com ([74.125.82.172]:43752) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RmJ8z-0002uy-QB for 10489@debbugs.gnu.org; Sun, 15 Jan 2012 01:00:43 -0500 Received: by wera1 with SMTP id a1so537939wer.3 for <10489@debbugs.gnu.org>; Sat, 14 Jan 2012 21:59:54 -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=JsIvsp2jlGdf9e9x1P91Pmd8G8beGMgkCPc7S491Jvo=; b=NQuLMPZ7YXfG6yHxxsDOnR7YVRCcpuAuAGFL4U2O2JiA0XEuKgmDl5rxitEocR25bY 34Ga6O30IjgWT2EPujnKelq85uEOegt7/dgVgHihrIie4piNgdVu0mCCoqdp4xrFSNZg EPrLxHlBruaKVD1EE4oyvlu6aKYWgGo56fDfU= Received: by 10.216.131.234 with SMTP id m84mr3042927wei.11.1326607194316; Sat, 14 Jan 2012 21:59:54 -0800 (PST) Received: from thierry-MM061 (192.211.85.79.rev.sfr.net. [79.85.211.192]) by mx.google.com with ESMTPS id k33sm17305203wbo.5.2012.01.14.21.59.47 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 14 Jan 2012 21:59:51 -0800 (PST) From: Thierry Volpiatto To: Stefan Monnier Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <8762gfnrlj.fsf@gmx.de> <83aa5qk6co.fsf@gnu.org> Date: Sun, 15 Jan 2012 06:59:44 +0100 In-Reply-To: (Stefan Monnier's message of "Sat, 14 Jan 2012 09:19:51 -0500") Message-ID: <87y5t9ijzj.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: Eli Zaretskii , 10489@debbugs.gnu.org, michael.albinus@gmx.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Stefan Monnier writes: > > IIUC the original problem in dired-do-copy In dired-create-files. > needs to test "same file" rather than "same name", so it should not > use file-name-equal-p but file-equal-p (which would rely on > file-attributes, presumably). How do you compare two files with file-attributes? Locally, equal is ok, but when using /sudo::.. the gid-change, inode and device-num are differents: /home/thierry/Test: --8<---------------cut here---------------start------------->8--- (:type t :links 2 :uid "thierry" :gid "thierry" :access-time (20241 21214) :modif-time (20241 20731) :status (20241 20731) :size 4096 :mode "drwxrwxr-x" :gid-change nil :inode 4598437 :device-num 2049) --8<---------------cut here---------------end--------------->8--- /sudo::/home/thierry/Test --8<---------------cut here---------------start------------->8--- (:type t :links 2 :uid "thierry" :gid "thierry" :access-time (20241 21214) :modif-time (20241 20731) :status (20241 20731) :size 4096 :mode "drwxrwxr-x" :gid-change t :inode (70 . 10917) :device-num (-1 . 0)) --8<---------------cut here---------------end--------------->8--- On info we have: `(5888 2 . 43978)' has an inode number of 6473924464520138. `(15479 . 46724)' is on the file-system device whose number is 1014478468. How do you get such results? Thanks. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 15 07:41:29 2012 Received: (at 10489) by debbugs.gnu.org; 15 Jan 2012 12:41:29 +0000 Received: from localhost ([127.0.0.1]:57971 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RmPOq-0004Vg-PC for submit@debbugs.gnu.org; Sun, 15 Jan 2012 07:41:29 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:55528) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1RmPOn-0004VQ-Of for 10489@debbugs.gnu.org; Sun, 15 Jan 2012 07:41:27 -0500 Received: (qmail invoked by alias); 15 Jan 2012 12:40:35 -0000 Received: from p57BB9257.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.146.87] by mail.gmx.net (mp006) with SMTP; 15 Jan 2012 13:40:35 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1/QIEgSPqjQIClDbqyT9V05Ve5J+2izj/iq2OdyIY WQoBuBcefERMhj From: Michael Albinus To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <8762gfnrlj.fsf@gmx.de> <83aa5qk6co.fsf@gnu.org> <87y5t9ijzj.fsf@gmail.com> Date: Sun, 15 Jan 2012 13:40:30 +0100 In-Reply-To: <87y5t9ijzj.fsf@gmail.com> (Thierry Volpiatto's message of "Sun, 15 Jan 2012 06:59:44 +0100") Message-ID: <87zkdpm94x.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Thierry Volpiatto writes: > How do you compare two files with file-attributes? > Locally, equal is ok, but when using /sudo::.. the gid-change, inode > and device-num are differents: This must be implemented by respective file name handlers, like `tramp-handle-file-equal-p', `ange-ftp-file-equal-p', `url-file-equal-p' ... > /sudo::/home/thierry/Test > > (:type t :links 2 :uid "thierry" :gid "thierry" :access-time > (20241 21214) > :modif-time > (20241 20731) > :status > (20241 20731) > :size 4096 :mode "drwxrwxr-x" :gid-change t > :inode (70 . 10917) > :device-num (-1 . 0)) `tramp-*-handle-file-attributes' create virtual inodes and device numbers. They cannot be used directly for comparison. Same for `ange-ftp-file-attributes'. > Thanks. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 15 07:51:44 2012 Received: (at 10489) by debbugs.gnu.org; 15 Jan 2012 12:51:44 +0000 Received: from localhost ([127.0.0.1]:57976 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RmPYm-0004kw-1r for submit@debbugs.gnu.org; Sun, 15 Jan 2012 07:51:44 -0500 Received: from mailout-de.gmx.net ([213.165.64.23]:39209) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1RmPYk-0004kp-Bf for 10489@debbugs.gnu.org; Sun, 15 Jan 2012 07:51:43 -0500 Received: (qmail invoked by alias); 15 Jan 2012 12:50:52 -0000 Received: from p57BB9257.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.146.87] by mail.gmx.net (mp019) with SMTP; 15 Jan 2012 13:50:52 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1/cv38Be3jcz7Pwh82xtswHGkPA1ya+ilo7Q8Le4X IQrJ6OW1IlsByA From: Michael Albinus To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <87fwfjo24c.fsf@gmx.de> <87pqen76p4.fsf@gmail.com> <83fwfik92e.fsf@gnu.org> <87mx9q1sz7.fsf@gmail.com> Date: Sun, 15 Jan 2012 13:50:47 +0100 In-Reply-To: <87mx9q1sz7.fsf@gmail.com> (Thierry Volpiatto's message of "Sat, 14 Jan 2012 11:25:16 +0100") Message-ID: <87vcodm8ns.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: Eli Zaretskii , 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Thierry Volpiatto 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. From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 15 12:21:39 2012 Received: (at 10489) by debbugs.gnu.org; 15 Jan 2012 17:21:39 +0000 Received: from localhost ([127.0.0.1]:58819 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RmTly-00034g-IV for submit@debbugs.gnu.org; Sun, 15 Jan 2012 12:21:39 -0500 Received: from mail-we0-f172.google.com ([74.125.82.172]:57459) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RmTlv-00034Y-J3 for 10489@debbugs.gnu.org; Sun, 15 Jan 2012 12:21:37 -0500 Received: by wera1 with SMTP id a1so767528wer.3 for <10489@debbugs.gnu.org>; Sun, 15 Jan 2012 09:20:45 -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=Rr+I7JRV8srD+3gJuq4oYmi12ogkkhP9BFNb6t4al8Y=; b=vK3bKzIWp0s0MN3uFX0BluOvOp2qFistoasg5DnwuJ41rnL8xZq9+qvJKuGufPevO4 avpQXn42XrjW3YHiFrS0M/kKX8jAaolQ0l+JSfthyh3JMrejNO5vxzn+Cv9hv2a6BnRS 2AGwNk7d4kHidvOMY/LoMtLcxHMglr1vLdQco= Received: by 10.216.29.7 with SMTP id h7mr2265271wea.29.1326648045346; Sun, 15 Jan 2012 09:20:45 -0800 (PST) Received: from thierry-MM061 (86.78.88.79.rev.sfr.net. [79.88.78.86]) by mx.google.com with ESMTPS id v13sm19037257wbm.14.2012.01.15.09.20.41 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 15 Jan 2012 09:20:43 -0800 (PST) From: Thierry Volpiatto To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <87fwfjo24c.fsf@gmx.de> <87pqen76p4.fsf@gmail.com> <83fwfik92e.fsf@gnu.org> <87mx9q1sz7.fsf@gmail.com> <87vcodm8ns.fsf@gmx.de> Date: Sun, 15 Jan 2012 18:20:30 +0100 In-Reply-To: <87vcodm8ns.fsf@gmx.de> (Michael Albinus's message of "Sun, 15 Jan 2012 13:50:47 +0100") Message-ID: <87pqekopb5.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: Eli Zaretskii , 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Michael Albinus writes: > Thierry Volpiatto 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 'metho= d)) >> (string-match (system-name) >> (file-remote-p fromname 'host)) >> (file-remote-p fromname 'localname))) >> (rem-newname (and (equal "sudo" (file-remote-p destname 'metho= d)) >> (string-match (system-name) (file-remote-p d= estname '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. Ok > 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. Ok=20 > 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. Many examples given here, so if everybody is ok with The function given by Drew, we could commit the attached patch to fix this bug: =2D-=20 Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997=20 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=Singlepatch-r118414ToTip.patch Content-Transfer-Encoding: quoted-printable ##Merge of all patches applied from revision 118409 ## patch-r118414: Bugfix bug#10489, dired-do-copy may create infinite direc= tory hierarchy. ## patch-r118411: * lisp/dired-aux.el (dired-copy-file-recursive): Use file= -equal-p. ##=20 diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el =2D-- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1264,24 +1264,26 @@ =20 (defun dired-copy-file-recursive (from to ok-flag &optional preserve-time top recursive) + (when (file-equal-p from to) + (error "Can't copy directory `%s' on itself" from)) (let ((attrs (file-attributes from))) (if (and recursive =2D (eq t (car attrs)) =2D (or (eq recursive 'always) =2D (yes-or-no-p (format "Recursive copies of %s? " from)))) =2D ;; This is a directory. =2D (copy-directory from to preserve-time) + (eq t (car attrs)) + (or (eq recursive 'always) + (yes-or-no-p (format "Recursive copies of %s? " from)))) + ;; This is a directory. + (copy-directory from to preserve-time) ;; Not a directory. (or top (dired-handle-overwrite to)) (condition-case err =2D (if (stringp (car attrs)) =2D ;; It is a symlink =2D (make-symbolic-link (car attrs) to ok-flag) =2D (copy-file from to ok-flag preserve-time)) =2D (file-date-error =2D (push (dired-make-relative from) =2D dired-create-files-failures) =2D (dired-log "Can't set date on %s:\n%s\n" from err)))))) + (if (stringp (car attrs)) + ;; It is a symlink + (make-symbolic-link (car attrs) to ok-flag) + (copy-file from to ok-flag preserve-time)) + (file-date-error + (push (dired-make-relative from) + dired-create-files-failures) + (dired-log "Can't set date on %s:\n%s\n" from err)))))) =20 ;;;###autoload (defun dired-rename-file (file newname ok-if-already-exists) @@ -1378,7 +1380,7 @@ =20 ;; The basic function for half a dozen variations on cp/mv/ln/ln -s. (defun dired-create-files (file-creator operation fn-list name-constructor =2D &optional marker-char) + &optional marker-char) "Create one or more new files from a list of existing files FN-LIST. This function also handles querying the user, updating Dired buffers, and displaying a success or failure message. @@ -1402,9 +1404,9 @@ newfile's entry, or t to use the current marker character if the old file was marked." (let (dired-create-files-failures failures =2D skipped (success-count 0) (total (length fn-list))) + skipped (success-count 0) (total (leng= th fn-list))) (let (to overwrite-query =2D overwrite-backup-query) ; for dired-handle-overwrite + overwrite-backup-query) ; for dired-handle-overwrite (dolist (from fn-list) (setq to (funcall name-constructor from)) (if (equal to from) @@ -1430,10 +1432,25 @@ (cond ((integerp marker-char) marker-char) (marker-char (dired-file-marker from)) ; slow (t nil)))) =2D (when (and (file-directory-p from) =2D (file-directory-p to) =2D (eq file-creator 'dired-copy-file)) =2D (setq to (file-name-directory to))) + ;; Handle the `dired-copy-file' file-creator specially + ;; When copying a directory to another directory or + ;; possibly to itself. + ;; (e.g "~/foo" =3D> "~/test" or "~/foo" =3D>"~/foo") + ;; In this case the 'name-constructor' have set the destination + ;; 'to' to "~/test/foo" because the old + ;; emacs23 behavior of `copy-directory' + ;; was no not create the subdir and copy instead the contents = only. + ;; With it's new behavior (similar to cp shell command) we don= 't + ;; need such a construction, so modify the destination 'to' to + ;; "~/test/" instead of "~/test/foo/". + ;; If from and to are the same directory do the same, + ;; the error will be handled by `dired-copy-file-recursive'. + (let ((destname (file-name-directory to))) + (when (and (file-directory-p from) + (or (file-equal-p from destname) + (file-directory-p to)) + (eq file-creator 'dired-copy-file)) + (setq to destname))) (condition-case err (progn (funcall file-creator from to dired-overwrite-confirmed) @@ -1456,25 +1473,25 @@ (setq failures (nconc failures dired-create-files-failures)) (dired-log-summary (format "%s failed for %d file%s in %d requests" =2D operation (length failures) =2D (dired-plural-s (length failures)) =2D total) + operation (length failures) + (dired-plural-s (length failures)) + total) failures)) (failures (dired-log-summary (format "%s failed for %d of %d file%s" =2D operation (length failures) =2D total (dired-plural-s total)) + operation (length failures) + total (dired-plural-s total)) failures)) (skipped (dired-log-summary (format "%s: %d of %d file%s skipped" =2D operation (length skipped) total =2D (dired-plural-s total)) + operation (length skipped) total + (dired-plural-s total)) skipped)) (t (message "%s: %s file%s" =2D operation success-count (dired-plural-s success-count))))) + operation success-count (dired-plural-s success-count))))) (dired-move-to-filename)) (defun dired-do-create-files (op-symbol file-creator operation arg diff --git a/lisp/files.el b/lisp/files.el =2D-- a/lisp/files.el +++ b/lisp/files.el @@ -4902,6 +4902,12 @@ directory 'full directory-files-no-dot-files-regexp))) (delete-directory-internal directory))))) =20 +(defun file-equal-p (file1 file2) + "Return non-nil if FILE1 and FILE2 name the same file." + (and (equal (file-remote-p file1) (file-remote-p file2)) + (string=3D (file-truename (expand-file-name file1)) + (file-truename (expand-file-name file2))))) + (defun copy-directory (directory newname &optional keep-time parents copy-= contents) "Copy DIRECTORY to NEWNAME. Both args must be strings. This function always sets the file modes of the output files to match @@ -4928,10 +4934,12 @@ (format "Copy directory %s to: " dir) default-directory default-directory nil nil) current-prefix-arg t nil))) + (when (file-equal-p directory newname) + (error "Can't copy directory `%s' on itself" directory)) ;; If default-directory is a remote directory, make sure we find its ;; copy-directory handler. (let ((handler (or (find-file-name-handler directory 'copy-directory) =2D (find-file-name-handler newname 'copy-directory)))) + (find-file-name-handler newname 'copy-directory)))) (if handler (funcall handler 'copy-directory directory newname keep-time parents) =20 --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAk8TCt8ACgkQKNF/U1nymZffrQCg71Bt8G07cgdA2V8I+UMfYTuI m1MAoNFSXpSLlcLNdJURvrdtM7+V4SGb =/6uT -----END PGP SIGNATURE----- --==-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 15 12:29:06 2012 Received: (at 10489) by debbugs.gnu.org; 15 Jan 2012 17:29:06 +0000 Received: from localhost ([127.0.0.1]:58834 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RmTtB-0003Fs-Hc for submit@debbugs.gnu.org; Sun, 15 Jan 2012 12:29:06 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:62342) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RmTt8-0003FW-L6 for 10489@debbugs.gnu.org; Sun, 15 Jan 2012 12:29:03 -0500 Received: by wics10 with SMTP id s10so607433wic.3 for <10489@debbugs.gnu.org>; Sun, 15 Jan 2012 09:28:12 -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=mI0x/EuUEahuoAuLwh5WxTgFIW6I05QlIh4aFv5qmk4=; b=aLwX1ubkS6RZ2Z2kcbG6qynQJyKQZrLuk9bgPnDEXinKX14BfdiYFl2GbtQZnYYoQj toILuzZI0Rl6235jWEzJavrDVR0mUOCe0RpSc/4TlhhCgc3O9bf8wlsk+9R/iEk2P80t 9DYElec13hm2KXwiEfgJ2WeIBpKZnoO/yporI= Received: by 10.180.94.97 with SMTP id db1mr14403689wib.16.1326648492572; Sun, 15 Jan 2012 09:28:12 -0800 (PST) Received: from thierry-MM061 (86.78.88.79.rev.sfr.net. [79.88.78.86]) by mx.google.com with ESMTPS id q34sm19057184wbm.15.2012.01.15.09.28.10 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 15 Jan 2012 09:28:11 -0800 (PST) From: Thierry Volpiatto To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <8762gfnrlj.fsf@gmx.de> <83aa5qk6co.fsf@gnu.org> <87y5t9ijzj.fsf@gmail.com> <87zkdpm94x.fsf@gmx.de> Date: Sun, 15 Jan 2012 18:28:08 +0100 In-Reply-To: <87zkdpm94x.fsf@gmx.de> (Michael Albinus's message of "Sun, 15 Jan 2012 13:40:30 +0100") Message-ID: <87lip8ooyf.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Thanks Michael for explanation. Michael Albinus writes: > Thierry Volpiatto writes: > >> How do you compare two files with file-attributes? >> Locally, equal is ok, but when using /sudo::.. the gid-change, inode >> and device-num are differents: > > This must be implemented by respective file name handlers, like > `tramp-handle-file-equal-p', `ange-ftp-file-equal-p', `url-file-equal-p' ... > >> /sudo::/home/thierry/Test >> >> (:type t :links 2 :uid "thierry" :gid "thierry" :access-time >> (20241 21214) >> :modif-time >> (20241 20731) >> :status >> (20241 20731) >> :size 4096 :mode "drwxrwxr-x" :gid-change t >> :inode (70 . 10917) >> :device-num (-1 . 0)) > > `tramp-*-handle-file-attributes' create virtual inodes and device > numbers. They cannot be used directly for comparison. > > Same for `ange-ftp-file-attributes'. > >> Thanks. > > Best regards, Michael. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 15 12:32:56 2012 Received: (at submit) by debbugs.gnu.org; 15 Jan 2012 17:32:56 +0000 Received: from localhost ([127.0.0.1]:58838 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RmTwt-0003M9-Jo for submit@debbugs.gnu.org; Sun, 15 Jan 2012 12:32:56 -0500 Received: from eggs.gnu.org ([140.186.70.92]:45817) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RmTwr-0003M2-7G for submit@debbugs.gnu.org; Sun, 15 Jan 2012 12:32:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RmTw2-0006aD-Rh for submit@debbugs.gnu.org; Sun, 15 Jan 2012 12:32:03 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([140.186.70.17]:38861) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RmTw2-0006a9-QE for submit@debbugs.gnu.org; Sun, 15 Jan 2012 12:32:02 -0500 Received: from eggs.gnu.org ([140.186.70.92]:44433) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RmTw1-0001xs-ME for bug-gnu-emacs@gnu.org; Sun, 15 Jan 2012 12:32:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RmTvu-0006Zc-SC for bug-gnu-emacs@gnu.org; Sun, 15 Jan 2012 12:32:01 -0500 Received: from lo.gmane.org ([80.91.229.12]:59966) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RmTvu-0006ZH-Fv for bug-gnu-emacs@gnu.org; Sun, 15 Jan 2012 12:31:54 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RmTvr-0004XZ-Pu for bug-gnu-emacs@gnu.org; Sun, 15 Jan 2012 18:31:51 +0100 Received: from 86.78.88.79.rev.sfr.net ([79.88.78.86]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 15 Jan 2012 18:31:51 +0100 Received: from thierry.volpiatto by 86.78.88.79.rev.sfr.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 15 Jan 2012 18:31:51 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Date: Sun, 15 Jan 2012 18:31:30 +0100 Lines: 27 Message-ID: <87hazwoost.fsf@gmail.com> References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <87fwfjo24c.fsf@gmx.de> <87pqen76p4.fsf@gmail.com> <83fwfik92e.fsf@gnu.org> <87mx9q1sz7.fsf@gmail.com> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 86.78.88.79.rev.sfr.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) Cancel-Lock: sha1:l1k0rjJF2NL5qeAkGvLFrC72bQc= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Thierry Volpiatto writes: > Many examples given here, so if everybody is ok with The function given > by Drew, we could commit the attached patch to fix this bug: Note also that the bug is still here with this code=20 when copying on same system "/sudo::/foo" to "/foo" =2D-=20 Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997=20 --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAk8TDXMACgkQKNF/U1nymZc8MQCg3l7OyPejE2614m28HsbDvbFc hIUAoOPvUMl/68nUamxrldR6bhD+fbA7 =0tJZ -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 15 13:25:41 2012 Received: (at 10489) by debbugs.gnu.org; 15 Jan 2012 18:25:41 +0000 Received: from localhost ([127.0.0.1]:58868 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RmUlv-0004e7-S6 for submit@debbugs.gnu.org; Sun, 15 Jan 2012 13:25:41 -0500 Received: from mailout-de.gmx.net ([213.165.64.23]:39945) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1RmUlt-0004dy-Ik for 10489@debbugs.gnu.org; Sun, 15 Jan 2012 13:25:38 -0500 Received: (qmail invoked by alias); 15 Jan 2012 18:24:45 -0000 Received: from p57BB9257.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.146.87] by mail.gmx.net (mp067) with SMTP; 15 Jan 2012 19:24:45 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX19IE2l1cIhIv0t/vULddaT5TRv0aIi+QuCG43kYYP 8Tf+qgUEXay5T7 From: Michael Albinus To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <87fwfjo24c.fsf@gmx.de> <87pqen76p4.fsf@gmail.com> <83fwfik92e.fsf@gnu.org> <87mx9q1sz7.fsf@gmail.com> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> Date: Sun, 15 Jan 2012 19:24:42 +0100 In-Reply-To: <87hazwoost.fsf@gmail.com> (Thierry Volpiatto's message of "Sun, 15 Jan 2012 18:31:30 +0100") Message-ID: <87ty3w9639.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Thierry Volpiatto writes: > Thierry Volpiatto writes: > >> Many examples given here, so if everybody is ok with The function given >> by Drew, we could commit the attached patch to fix this bug: > Note also that the bug is still here with this code > when copying on same system "/sudo::/foo" to "/foo" One could also add it to Tramp for Emacs 24.1. But this sounds like a new feature to me, and I would like to postpone it to Emacs 24.2. There must be robust testing, if we start to handle such use cases. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 15 13:43:51 2012 Received: (at 10489) by debbugs.gnu.org; 15 Jan 2012 18:43:51 +0000 Received: from localhost ([127.0.0.1]:58874 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RmV3X-00058L-4p for submit@debbugs.gnu.org; Sun, 15 Jan 2012 13:43:51 -0500 Received: from acsinet15.oracle.com ([141.146.126.227]:57099) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RmV3U-00058A-Ae for 10489@debbugs.gnu.org; Sun, 15 Jan 2012 13:43:49 -0500 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by acsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id q0FIguS2023492 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 15 Jan 2012 18:42:57 GMT Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q0FIgtE7022913 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 15 Jan 2012 18:42:56 GMT Received: from abhmt105.oracle.com (abhmt105.oracle.com [141.146.116.57]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q0FIgsbq029452; Sun, 15 Jan 2012 12:42:55 -0600 Received: from dradamslap1 (/10.159.36.131) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 15 Jan 2012 10:42:54 -0800 From: "Drew Adams" To: References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com><8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com><87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com><87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com><011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com><83k44vk3tq.fsf@gnu.org> <0CF5A24D684E48CEBE38E6597474ECAD@us.oracle.com> Subject: RE: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Date: Sun, 15 Jan 2012 10:42:45 -0800 Message-ID: <75FAB0050F9C42F79DA624806EE1914A@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-reply-to: <0CF5A24D684E48CEBE38E6597474ECAD@us.oracle.com> Thread-Index: AczSCdgoYGKq3hqRQoyxH2L+XdPs4QAA12OwAGnwx2A= X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Source-IP: ucsinet22.oracle.com [156.151.31.94] X-CT-RefId: str=0001.0A090201.4F131E31.009E,ss=1,re=0.000,fgs=0 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) > (defun bmkp-same-file-p (file1 file2) > "Return non-nil if FILE1 and FILE2 name the same file. > If either name is not absolute, then it is expanded relative to > `default-directory' for the test." > (let* ((remote1 (bmkp-file-remote-p file1)) > (remote2 (bmkp-file-remote-p file2)) > (ignore-case-p > (and (not remote1) (not remote2) > (eval (car (get 'read-file-name-completion-ignore-case > 'standard-value)))))) > (and (equal remote1 remote2) > (compare-strings (file-truename (expand-file-name file1)) > (file-truename (expand-file-name file2)) > ignore-case-p)))) Sorry, that `compare-strings' sexp is obviously not right. The last 3 lines should be this: (and (equal remote1 remote2) (let ((ft1 (file-truename (expand-file-name file1))) (ft2 (file-truename (expand-file-name file2)))) (compare-strings ft1 0 (length ft1) ft2 0 (length ft2) ignore-case-p))))) From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 15 14:10:06 2012 Received: (at 10489) by debbugs.gnu.org; 15 Jan 2012 19:10:06 +0000 Received: from localhost ([127.0.0.1]:58891 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RmVSv-0005oL-Ue for submit@debbugs.gnu.org; Sun, 15 Jan 2012 14:10:06 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:35220) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RmVSs-0005nx-0l for 10489@debbugs.gnu.org; Sun, 15 Jan 2012 14:10:03 -0500 Received: by wics10 with SMTP id s10so649198wic.3 for <10489@debbugs.gnu.org>; Sun, 15 Jan 2012 11:09:11 -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=KivFnjZ/sKtuPjKu0HLzgGb3UxQdyB1lRstK+pk6HmU=; b=fpr50RXnAkFolOPfza3FEXADg/Bs+3iC1OFtlfZxudpxEuap5XMjPSepzVDv3FdJ5l 4ZOVh/31CBO4QLq5/5eFTPO5aJAyy6mXKiIyG38sKueM+VAG7jxCQlwlVeqcRVPXliDv VOl7kr8iEu6LxfHFwaD9yHSVeKmAEBud+YLHA= Received: by 10.180.85.4 with SMTP id d4mr14607516wiz.0.1326654551446; Sun, 15 Jan 2012 11:09:11 -0800 (PST) Received: from thierry-MM061 (86.78.88.79.rev.sfr.net. [79.88.78.86]) by mx.google.com with ESMTPS id fc6sm14933842wbb.16.2012.01.15.11.09.08 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 15 Jan 2012 11:09:10 -0800 (PST) From: Thierry Volpiatto To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <87fwfjo24c.fsf@gmx.de> <87pqen76p4.fsf@gmail.com> <83fwfik92e.fsf@gnu.org> <87mx9q1sz7.fsf@gmail.com> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> Date: Sun, 15 Jan 2012 20:09:06 +0100 In-Reply-To: <87ty3w9639.fsf@gmx.de> (Michael Albinus's message of "Sun, 15 Jan 2012 19:24:42 +0100") Message-ID: <8762gckckt.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Michael Albinus writes: > Thierry Volpiatto writes: > >> Thierry Volpiatto writes: >> >>> Many examples given here, so if everybody is ok with The function given >>> by Drew, we could commit the attached patch to fix this bug: >> Note also that the bug is still here with this code >> when copying on same system "/sudo::/foo" to "/foo" > > One could also add it to Tramp for Emacs 24.1. But this sounds like a > new feature to me, and I would like to postpone it to Emacs 24.2. There > must be robust testing, if we start to handle such use cases. IMHO we should fix this bug for most use cases with a compare function maybe not perfect in many points but ok for most basic usages. The function shown by Drew and I put in last patch as you said isn't sufficient and fail in many cases even on local filesystem: (defun bmkp-same-file-p (file1 file2) "Return non-nil if FILE1 and FILE2 name the same file. If either name is not absolute, then it is expanded relative to `default-directory' for the test." (and (equal (file-remote-p file1) (file-remote-p file2)) (string= (file-truename (expand-file-name file1)) (file-truename (expand-file-name file2))))) (bmkp-same-file-p "~/Test" "/home/thierry/Test/") => nil That would be for Emacs24.1, and we could work on the real thing in tramp for 24.2 Here is my last work on this based on precedent example i sent and your last advices; it doesn't cover many use cases as you point before, test user, method etc... but works for all the use cases below: #+BEGIN_SRC emacs-lisp (defun file-equal-p (name1 name2) (if (or (file-remote-p name1) (file-remote-p name2)) (let* ((n1 (file-name-as-directory (expand-file-name name1))) (n2 (file-name-as-directory (expand-file-name name2))) (rhost1 (file-remote-p n1 'host)) (rhost2 (file-remote-p n2 'host)) (lname1 (file-remote-p n1 'localname)) (lname2 (file-remote-p n2 'localname)) rem-n1 rem-n2) (cond ((and rhost1 (not rhost2)) (setq rem-n1 (list (cons rhost1 (file-truename lname1)))) (setq rem-n2 (list (cons (system-name) (file-truename n2))))) ((and (not rhost1) rhost2) (setq rem-n1 (list (cons (system-name) (file-truename n1)))) (setq rem-n2 (list (cons rhost2 (file-truename lname2))))) ((and rhost1 rhost2) (setq rem-n1 (list (cons rhost1 (file-truename lname1)))) (setq rem-n2 (list (cons rhost2 (file-truename lname2)))))) (loop for (x1 . y1) in rem-n1 for (x2 . y2) in rem-n2 always (and (equal x1 x2) (equal y1 y2)))) (string= (file-name-as-directory (file-truename (expand-file-name name1))) (file-name-as-directory (file-truename (expand-file-name name2)))))) #+END_SRC --8<---------------cut here---------------start------------->8--- (dont-compile (when (fboundp 'expectations) (expectations (desc "Local file name comparison: Symlink<=>truefile") (expect t (file-equal-p "~/.emacs.el" "~/.emacs.d/emacs-config-laptop/.emacs.el")) (desc "Local file name comparison") (expect t (file-equal-p "/home/thierry/Test" "~/Test")) (expect t (file-equal-p "/home/thierry/Test" "~/Test/")) (expect nil (file-equal-p "/home/thierry/Test" "/home/thierry/tmp/Test")) (expect t (file-equal-p "./save-scratch.el" "~/labo/tmp/save-scratch.el")) (expect nil (file-equal-p "/home/thierry/tmp" "/tmp")) (expect nil (file-equal-p "/home/thierry/test" "/home/thierry/Test")) (desc "Sudo file against local") (expect nil (file-equal-p "/sudo::/home/thierry/Test" "/sudo::~/Test")) (expect t (file-equal-p "/sudo::/home/thierry/Test" "~/Test")) (desc "Remote file name comparison with different methods") (expect t (file-equal-p "/ssh:thievol:/home/thierry/Test" "/scpc:thievol:/home/thierry/Test")) (desc "Remote file name with localfile") (expect nil (file-equal-p "/ssh:thievol:/home/thierry/Test" "/home/thierry/Test")) (desc "Remote file name comparison with same methods same files") (expect t (file-equal-p "/scpc:thievol:/home/thierry/Test" "/scpc:thievol:/home/thierry/Test"))))) --8<---------------cut here---------------end--------------->8--- 22 expectations, 0 failures, 0 errors Expectations finished at Sun Jan 15 20:04:10 2012 -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 15 14:50:17 2012 Received: (at 10489) by debbugs.gnu.org; 15 Jan 2012 19:50:17 +0000 Received: from localhost ([127.0.0.1]:58908 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RmW5o-0006kD-NS for submit@debbugs.gnu.org; Sun, 15 Jan 2012 14:50:17 -0500 Received: from mailout-de.gmx.net ([213.165.64.23]:38523) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1RmW5l-0006k4-9r for 10489@debbugs.gnu.org; Sun, 15 Jan 2012 14:50:14 -0500 Received: (qmail invoked by alias); 15 Jan 2012 19:49:21 -0000 Received: from p57BB9257.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.146.87] by mail.gmx.net (mp015) with SMTP; 15 Jan 2012 20:49:21 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX19qhBl2VD1qfCjrkpCSbxI2UoB0O8u9/iEAvZpFhv lS54Q0DHugpqOW From: Michael Albinus To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87sjjkfvwt.fsf@gmail.com> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <87fwfjo24c.fsf@gmx.de> <87pqen76p4.fsf@gmail.com> <83fwfik92e.fsf@gnu.org> <87mx9q1sz7.fsf@gmail.com> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> Date: Sun, 15 Jan 2012 20:49:18 +0100 In-Reply-To: <8762gckckt.fsf@gmail.com> (Thierry Volpiatto's message of "Sun, 15 Jan 2012 20:09:06 +0100") Message-ID: <87pqek9269.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Thierry Volpiatto writes: > IMHO we should fix this bug for most use cases with a compare function > maybe not perfect in many points but ok for most basic usages. > The function shown by Drew and I put in last patch as you said isn't > sufficient and fail in many cases even on local filesystem: > > (defun bmkp-same-file-p (file1 file2) > "Return non-nil if FILE1 and FILE2 name the same file. > If either name is not absolute, then it is expanded relative to > `default-directory' for the test." > (and (equal (file-remote-p file1) (file-remote-p file2)) > (string= (file-truename (expand-file-name file1)) > (file-truename (expand-file-name file2))))) > > (bmkp-same-file-p "~/Test" "/home/thierry/Test/") => nil So it must be (string= (directory-file-name (file-truename (expand-file-name file1))) (directory-file-name (file-truename (expand-file-name file2)))))) Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 15 16:02:59 2012 Received: (at submit) by debbugs.gnu.org; 15 Jan 2012 21:03:00 +0000 Received: from localhost ([127.0.0.1]:58931 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RmXEB-0008Mu-Km for submit@debbugs.gnu.org; Sun, 15 Jan 2012 16:02:59 -0500 Received: from eggs.gnu.org ([140.186.70.92]:46902) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RmXE8-0008Mn-Q6 for submit@debbugs.gnu.org; Sun, 15 Jan 2012 16:02:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RmXDJ-0006a0-Ff for submit@debbugs.gnu.org; Sun, 15 Jan 2012 16:02:06 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([140.186.70.17]:49648) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RmXDJ-0006Zw-E1 for submit@debbugs.gnu.org; Sun, 15 Jan 2012 16:02:05 -0500 Received: from eggs.gnu.org ([140.186.70.92]:58891) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RmXDG-0001w8-Qh for bug-gnu-emacs@gnu.org; Sun, 15 Jan 2012 16:02:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RmXDF-0006ZC-TS for bug-gnu-emacs@gnu.org; Sun, 15 Jan 2012 16:02:02 -0500 Received: from lo.gmane.org ([80.91.229.12]:56716) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RmXDF-0006Z4-Gg for bug-gnu-emacs@gnu.org; Sun, 15 Jan 2012 16:02:01 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RmXDD-00008b-Mu for bug-gnu-emacs@gnu.org; Sun, 15 Jan 2012 22:01:59 +0100 Received: from 5.78.88.79.rev.sfr.net ([79.88.78.5]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 15 Jan 2012 22:01:59 +0100 Received: from thierry.volpiatto by 5.78.88.79.rev.sfr.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 15 Jan 2012 22:01:59 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Date: Sun, 15 Jan 2012 22:01:45 +0100 Lines: 30 Message-ID: <87zkdoissm.fsf@gmail.com> References: <87mx9su32g.fsf@web.de> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <87fwfjo24c.fsf@gmx.de> <87pqen76p4.fsf@gmail.com> <83fwfik92e.fsf@gnu.org> <87mx9q1sz7.fsf@gmail.com> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 5.78.88.79.rev.sfr.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) Cancel-Lock: sha1:ZmqhUUinwCafbeNnrV9haPNt8Ko= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) Michael Albinus writes: > Thierry Volpiatto writes: > >> IMHO we should fix this bug for most use cases with a compare function >> maybe not perfect in many points but ok for most basic usages. >> The function shown by Drew and I put in last patch as you said isn't >> sufficient and fail in many cases even on local filesystem: >> >> (defun bmkp-same-file-p (file1 file2) >> "Return non-nil if FILE1 and FILE2 name the same file. >> If either name is not absolute, then it is expanded relative to >> `default-directory' for the test." >> (and (equal (file-remote-p file1) (file-remote-p file2)) >> (string= (file-truename (expand-file-name file1)) >> (file-truename (expand-file-name file2))))) >> >> (bmkp-same-file-p "~/Test" "/home/thierry/Test/") => nil > > So it must be > > (string= (directory-file-name (file-truename (expand-file-name file1))) > (directory-file-name (file-truename (expand-file-name file2)))))) Of course, thanks. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 16 03:59:13 2012 Received: (at 10489) by debbugs.gnu.org; 16 Jan 2012 08:59:13 +0000 Received: from localhost ([127.0.0.1]:59143 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RmiPI-00082r-Nj for submit@debbugs.gnu.org; Mon, 16 Jan 2012 03:59:12 -0500 Received: from mail-ww0-f46.google.com ([74.125.82.46]:47274) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RmiPG-00082j-6n for 10489@debbugs.gnu.org; Mon, 16 Jan 2012 03:59:11 -0500 Received: by wgbdt14 with SMTP id dt14so1107455wgb.15 for <10489@debbugs.gnu.org>; Mon, 16 Jan 2012 00:58:16 -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=xPDIkPRFI9tK31TEN1teWJPzIxQxhVCiZnYfycEqBKE=; b=bAvrfajfo39BH/U05h0mBiLgkAIZJ+fifXo0dnb0xVrrcb24usVq4eTKsSg471zUc2 lwurh3PDGoJwKGQU7Muj+f6ORVTvqQDomdUrK9CGBs5fLi9+d1cOjhqar5dM6B7XQjgR 0nQANmp8z/xFkM66KfKuYPWX4jI6EQY2LDboI= Received: by 10.180.81.72 with SMTP id y8mr18043471wix.14.1326704296425; Mon, 16 Jan 2012 00:58:16 -0800 (PST) Received: from thierry-MM061 (3.211.85.79.rev.sfr.net. [79.85.211.3]) by mx.google.com with ESMTPS id ga4sm21417505wbb.4.2012.01.16.00.58.13 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 16 Jan 2012 00:58:14 -0800 (PST) From: Thierry Volpiatto To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <8362ggkquq.fsf@gnu.org> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <87fwfjo24c.fsf@gmx.de> <87pqen76p4.fsf@gmail.com> <83fwfik92e.fsf@gnu.org> <87mx9q1sz7.fsf@gmail.com> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> Date: Mon, 16 Jan 2012 09:58:10 +0100 In-Reply-To: <87pqek9269.fsf@gmx.de> (Michael Albinus's message of "Sun, 15 Jan 2012 20:49:18 +0100") Message-ID: <87r4z0yqfx.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Michael Albinus writes: > Thierry Volpiatto writes: > >> IMHO we should fix this bug for most use cases with a compare function >> maybe not perfect in many points but ok for most basic usages. >> The function shown by Drew and I put in last patch as you said isn't >> sufficient and fail in many cases even on local filesystem: >> >> (defun bmkp-same-file-p (file1 file2) >> "Return non-nil if FILE1 and FILE2 name the same file. >> If either name is not absolute, then it is expanded relative to >> `default-directory' for the test." >> (and (equal (file-remote-p file1) (file-remote-p file2)) >> (string= (file-truename (expand-file-name file1)) >> (file-truename (expand-file-name file2))))) >> >> (bmkp-same-file-p "~/Test" "/home/thierry/Test/") => nil > > So it must be > > (string= (directory-file-name (file-truename (expand-file-name file1))) > (directory-file-name (file-truename (expand-file-name file2)))))) So, any objections to apply my patch to trunk with these changes? -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 16 08:57:53 2012 Received: (at 10489) by debbugs.gnu.org; 16 Jan 2012 13:57:53 +0000 Received: from localhost ([127.0.0.1]:59857 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rmn4K-0007Q3-NY for submit@debbugs.gnu.org; Mon, 16 Jan 2012 08:57:53 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.183]:30495) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rmn4I-0007Px-Vq for 10489@debbugs.gnu.org; Mon, 16 Jan 2012 08:57:51 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EADQsFE9FxKkV/2dsb2JhbABCqweBJYEKgQaBcgEBBAFWIwULCzQSFBgNJIgNtUyJXQIBAQgCDBEDCQEBBgEFHgoEAQIBAQIBAgECAQEBAQKCeAEGAgMHAQQBAQEBhA0EiDuaY4RS X-IronPort-AV: E=Sophos;i="4.71,518,1320642000"; d="scan'208";a="156986520" Received: from 69-196-169-21.dsl.teksavvy.com (HELO ceviche.home) ([69.196.169.21]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 16 Jan 2012 08:56:55 -0500 Received: by ceviche.home (Postfix, from userid 20848) id 74C266610B; Mon, 16 Jan 2012 08:56:55 -0500 (EST) From: Stefan Monnier To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Message-ID: References: <87mx9su32g.fsf@web.de> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <87fwfjo24c.fsf@gmx.de> <87pqen76p4.fsf@gmail.com> <83fwfik92e.fsf@gnu.org> <87mx9q1sz7.fsf@gmail.com> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> Date: Mon, 16 Jan 2012 08:56:55 -0500 In-Reply-To: <87r4z0yqfx.fsf@gmail.com> (Thierry Volpiatto's message of "Mon, 16 Jan 2012 09:58:10 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >> (string= (directory-file-name (file-truename (expand-file-name file1))) >> (directory-file-name (file-truename (expand-file-name file2)))))) > So, any objections to apply my patch to trunk with these changes? Couldn't we use something closer to what we want to ideally use? E.g. (equal (file-attributes file1) (file-attributes file2))? Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 16 09:10:47 2012 Received: (at 10489) by debbugs.gnu.org; 16 Jan 2012 14:10:47 +0000 Received: from localhost ([127.0.0.1]:59871 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RmnGo-0007iz-8f for submit@debbugs.gnu.org; Mon, 16 Jan 2012 09:10:47 -0500 Received: from mail-out.m-online.net ([212.18.0.10]:55409) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RmnGm-0007ir-7h for 10489@debbugs.gnu.org; Mon, 16 Jan 2012 09:10:45 -0500 Received: from frontend1.mail.m-online.net (frontend1.mail.intern.m-online.net [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id B7F231800158; Mon, 16 Jan 2012 15:09:48 +0100 (CET) X-Auth-Info: oULVVgKupZckrwgfv8+wSqy+pX91ICJrYSyq5YPP6Lw= Received: from igel.home (ppp-93-104-158-219.dynamic.mnet-online.de [93.104.158.219]) by mail.mnet-online.de (Postfix) with ESMTPA id 9F3161C00148; Mon, 16 Jan 2012 15:09:48 +0100 (CET) Received: by igel.home (Postfix, from userid 501) id 58B1DCA299; Mon, 16 Jan 2012 15:09:48 +0100 (CET) From: Andreas Schwab To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87lipcrlga.fsf@gmail.com> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <87fwfjo24c.fsf@gmx.de> <87pqen76p4.fsf@gmail.com> <83fwfik92e.fsf@gnu.org> <87mx9q1sz7.fsf@gmail.com> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> X-Yow: Imagine--a WORLD without POODLES... Date: Mon, 16 Jan 2012 15:09:48 +0100 In-Reply-To: <87r4z0yqfx.fsf@gmail.com> (Thierry Volpiatto's message of "Mon, 16 Jan 2012 09:58:10 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Thierry Volpiatto writes: > Michael Albinus writes: > >> Thierry Volpiatto writes: >> >>> IMHO we should fix this bug for most use cases with a compare function >>> maybe not perfect in many points but ok for most basic usages. >>> The function shown by Drew and I put in last patch as you said isn't >>> sufficient and fail in many cases even on local filesystem: >>> >>> (defun bmkp-same-file-p (file1 file2) >>> "Return non-nil if FILE1 and FILE2 name the same file. >>> If either name is not absolute, then it is expanded relative to >>> `default-directory' for the test." >>> (and (equal (file-remote-p file1) (file-remote-p file2)) >>> (string= (file-truename (expand-file-name file1)) >>> (file-truename (expand-file-name file2))))) >>> >>> (bmkp-same-file-p "~/Test" "/home/thierry/Test/") => nil >> >> So it must be >> >> (string= (directory-file-name (file-truename (expand-file-name file1))) >> (directory-file-name (file-truename (expand-file-name file2)))))) > > So, any objections to apply my patch to trunk with these changes? You also need to check whether the target is a subdirectory of the source. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 16 09:14:13 2012 Received: (at 10489) by debbugs.gnu.org; 16 Jan 2012 14:14:14 +0000 Received: from localhost ([127.0.0.1]:59880 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RmnK9-0007og-JV for submit@debbugs.gnu.org; Mon, 16 Jan 2012 09:14:13 -0500 Received: from mailout-de.gmx.net ([213.165.64.23]:35738) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1RmnK7-0007oU-5h for 10489@debbugs.gnu.org; Mon, 16 Jan 2012 09:14:12 -0500 Received: (qmail invoked by alias); 16 Jan 2012 14:13:15 -0000 Received: from p57BB9718.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.151.24] by mail.gmx.net (mp033) with SMTP; 16 Jan 2012 15:13:15 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1/zjwBI1sLzjwJlDs86czK0/pzf6jYnBy5Ezg1OTZ h5o1jFVmvJl+G1 From: Michael Albinus To: Stefan Monnier Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <87fwfjo24c.fsf@gmx.de> <87pqen76p4.fsf@gmail.com> <83fwfik92e.fsf@gnu.org> <87mx9q1sz7.fsf@gmail.com> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> Date: Mon, 16 Jan 2012 15:13:11 +0100 In-Reply-To: (Stefan Monnier's message of "Mon, 16 Jan 2012 08:56:55 -0500") Message-ID: <871uqzn3bc.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Stefan Monnier writes: >>> (string= (directory-file-name (file-truename (expand-file-name file1))) >>> (directory-file-name (file-truename (expand-file-name file2)))))) > >> So, any objections to apply my patch to trunk with these changes? > > Couldn't we use something closer to what we want to ideally use? > E.g. (equal (file-attributes file1) (file-attributes file2))? We need at least the `file-truename' call. (equal (file-attributes (file-truename (expand-file-name file1))) (file-attributes (file-truename (expand-file-name file2)))))) I don't know, whether `file-truename' calls `expand-file-name' internally. `tramp-sh-handle-file-truename' does. Maybe we don't need it. We could also add already the check for the file name handler. When there is no file name handler (Emacs 24.1), it doesn't hurt. Later on, we don't need to touch the fucntion, again. And I'll start to add the file name handler upstream Tramp, once the function is available in Emacs 24.1. > Stefan Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 16 10:19:06 2012 Received: (at 10489) by debbugs.gnu.org; 16 Jan 2012 15:19:06 +0000 Received: from localhost ([127.0.0.1]:60416 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RmoKw-0000yW-8k for submit@debbugs.gnu.org; Mon, 16 Jan 2012 10:19:06 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.183]:54068) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RmoKt-0000yO-PT for 10489@debbugs.gnu.org; Mon, 16 Jan 2012 10:19:04 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EACQ/FE9FxKkV/2dsb2JhbABDqweBJYEKgQaBcgEBBAFWIwULCzQSFBgNJIgNtWuJXQIBAQgCDBEDCQEBBgEFHgoEAQIBAQIBAgECAQEBAQKCeAEGAgMHAQQBAQEBhA0EiDuaY4RS X-IronPort-AV: E=Sophos;i="4.71,518,1320642000"; d="scan'208";a="156995932" Received: from 69-196-169-21.dsl.teksavvy.com (HELO ceviche.home) ([69.196.169.21]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 16 Jan 2012 10:18:08 -0500 Received: by ceviche.home (Postfix, from userid 20848) id D49006610D; Mon, 16 Jan 2012 10:18:07 -0500 (EST) From: Stefan Monnier To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Message-ID: References: <87mx9su32g.fsf@web.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <87fwfjo24c.fsf@gmx.de> <87pqen76p4.fsf@gmail.com> <83fwfik92e.fsf@gnu.org> <87mx9q1sz7.fsf@gmail.com> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> <871uqzn3bc.fsf@gmx.de> Date: Mon, 16 Jan 2012 10:18:07 -0500 In-Reply-To: <871uqzn3bc.fsf@gmx.de> (Michael Albinus's message of "Mon, 16 Jan 2012 15:13:11 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >> E.g. (equal (file-attributes file1) (file-attributes file2))? > We need at least the `file-truename' call. > (equal (file-attributes (file-truename (expand-file-name file1))) > (file-attributes (file-truename (expand-file-name file2)))))) Why??!?! > We could also add already the check for the file name handler. Yes, that'd be fine. Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 16 10:28:46 2012 Received: (at 10489) by debbugs.gnu.org; 16 Jan 2012 15:28:46 +0000 Received: from localhost ([127.0.0.1]:60461 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RmoUF-0001DF-Pl for submit@debbugs.gnu.org; Mon, 16 Jan 2012 10:28:45 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:34007) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1RmoUD-0001D5-1R for 10489@debbugs.gnu.org; Mon, 16 Jan 2012 10:28:42 -0500 Received: (qmail invoked by alias); 16 Jan 2012 15:27:44 -0000 Received: from p57BB9718.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.151.24] by mail.gmx.net (mp006) with SMTP; 16 Jan 2012 16:27:44 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1/z1nJ1jwbzonhK45U7vT4RgO09Gb5bKcP+GBkeZ0 jhYhVUvCTaNbIc From: Michael Albinus To: Stefan Monnier Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <87fwfjo24c.fsf@gmx.de> <87pqen76p4.fsf@gmail.com> <83fwfik92e.fsf@gnu.org> <87mx9q1sz7.fsf@gmail.com> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> <871uqzn3bc.fsf@gmx.de> Date: Mon, 16 Jan 2012 16:27:41 +0100 In-Reply-To: (Stefan Monnier's message of "Mon, 16 Jan 2012 10:18:07 -0500") Message-ID: <871uqz651u.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Stefan Monnier writes: >>> E.g. (equal (file-attributes file1) (file-attributes file2))? > >> We need at least the `file-truename' call. > >> (equal (file-attributes (file-truename (expand-file-name file1))) >> (file-attributes (file-truename (expand-file-name file2)))))) > > Why??!?! albinus@slbhn1:[1187] touch 1 albinus@slbhn1:[1188] ln -s 1 2 albinus@slbhn1:[1189] ll 1 2 -rw-r--r-- 1 albinus smc3 197 Jan 16 16:22 1 lrwxrwxrwx 1 albinus smc3 1 Jan 16 16:22 2 -> 1 (file-attributes "/home/albinus/1") => (nil 1 441 823 (20244 16570) (20244 16570) (20244 16570) 197 "-rw-r--r--" nil 2708784 19) (file-attributes "/home/albinus/2") => ("1" 1 441 823 (20244 16577) (20244 16577) (20244 16577) 1 "lrwxrwxrwx" nil 2727905 19) > Stefan Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 16 14:15:52 2012 Received: (at 10489) by debbugs.gnu.org; 16 Jan 2012 19:15:52 +0000 Received: from localhost ([127.0.0.1]:60618 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rms24-0006W4-4S for submit@debbugs.gnu.org; Mon, 16 Jan 2012 14:15:52 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:45269) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rms20-0006Vv-W6 for 10489@debbugs.gnu.org; Mon, 16 Jan 2012 14:15:49 -0500 Received: by wics10 with SMTP id s10so1482139wic.3 for <10489@debbugs.gnu.org>; Mon, 16 Jan 2012 11:14:52 -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=YCJxJI4Z1Cl0CdT0n0LWOkeTljMPkn1+ZuiDoJJKGLY=; b=HNiuY3Ts4TwtwABUovlWy+UT2t5r1gorEWxx/Qlh91lW5eZ0gymGkaauJ7p237r2YG t8xyCnz0/9wQwnfUs+j7R1UHVoulNV7X7zCUIQKlGYO6VagT46844Yd5mCLgfiIB+9WX cYoFFLFG0i8uRLp26z4X5mdnO3spxq4oAKn2Q= Received: by 10.180.86.5 with SMTP id l5mr22451478wiz.17.1326741292785; Mon, 16 Jan 2012 11:14:52 -0800 (PST) Received: from thierry-MM061 (23.78.88.79.rev.sfr.net. [79.88.78.23]) by mx.google.com with ESMTPS id n3sm35814298wiz.9.2012.01.16.11.14.49 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 16 Jan 2012 11:14:51 -0800 (PST) From: Thierry Volpiatto To: Andreas Schwab Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <87fwfjo24c.fsf@gmx.de> <87pqen76p4.fsf@gmail.com> <83fwfik92e.fsf@gnu.org> <87mx9q1sz7.fsf@gmail.com> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> Date: Mon, 16 Jan 2012 20:14:47 +0100 In-Reply-To: (Andreas Schwab's message of "Mon, 16 Jan 2012 15:09:48 +0100") Message-ID: <87ehuz793s.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Andreas Schwab writes: > You also need to check whether the target is a subdirectory of the > source. Indeed yes, is there already a function to check this? If not what about something like this: #+BEGIN_SRC lisp (defun file-subdir-of-p (file1 file2) "Check if FILE1 is a subdirectory of FILE2." (when (and (not (or (file-remote-p file1) (file-remote-p file2))) (file-directory-p file1) (file-directory-p file2)) (loop with f1 = (expand-file-name file1) with f2 = (expand-file-name file2) with ls1 = (split-string f1 "/" t) with ls2 = (split-string f2 "/" t) 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 ;; Use here `file-equal-p' when ready to work. (string= (directory-file-name root) (directory-file-name f2))))) #+END_SRC -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 16 16:41:40 2012 Received: (at 10489) by debbugs.gnu.org; 16 Jan 2012 21:41:40 +0000 Received: from localhost ([127.0.0.1]:60742 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RmuJ4-0001Vw-Nn for submit@debbugs.gnu.org; Mon, 16 Jan 2012 16:41:38 -0500 Received: from chene.dit.umontreal.ca ([132.204.246.20]:48607) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RmuJ1-0001Vo-FQ for 10489@debbugs.gnu.org; Mon, 16 Jan 2012 16:41:33 -0500 Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id q0GLeYLm002539; Mon, 16 Jan 2012 16:40:34 -0500 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id A047E13002A; Mon, 16 Jan 2012 16:40:34 -0500 (EST) From: Stefan Monnier To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Message-ID: References: <87mx9su32g.fsf@web.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <87fwfjo24c.fsf@gmx.de> <87pqen76p4.fsf@gmail.com> <83fwfik92e.fsf@gnu.org> <87mx9q1sz7.fsf@gmail.com> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> <871uqzn3bc.fsf@gmx.de> <871uqz651u.fsf@gmx.de> Date: Mon, 16 Jan 2012 16:40:34 -0500 In-Reply-To: <871uqz651u.fsf@gmx.de> (Michael Albinus's message of "Mon, 16 Jan 2012 16:27:41 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4103=0 X-NAI-Spam-Version: 2.2.0.9309 : core <4103> : streams <720424> : uri <1048062> X-Spam-Score: -3.5 (---) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.5 (---) >>>> E.g. (equal (file-attributes file1) (file-attributes file2))? >>> We need at least the `file-truename' call. >>> (equal (file-attributes (file-truename (expand-file-name file1))) >>> (file-attributes (file-truename (expand-file-name file2)))))) >> >> Why??!?! > albinus@slbhn1:[1187] touch 1 > albinus@slbhn1:[1188] ln -s 1 2 > albinus@slbhn1:[1189] ll 1 2 > -rw-r--r-- 1 albinus smc3 197 Jan 16 16:22 1 > lrwxrwxrwx 1 albinus smc3 1 Jan 16 16:22 2 -> 1 > (file-attributes "/home/albinus/1") => > (nil 1 441 823 (20244 16570) (20244 16570) (20244 16570) 197 "-rw-r--r--" nil 2708784 19) > (file-attributes "/home/albinus/2") => > ("1" 1 441 823 (20244 16577) (20244 16577) (20244 16577) 1 "lrwxrwxrwx" nil 2727905 19) Ah, right. So we don't need the full semantics of file-truename, but we do need to force "follow the symlink, if any". `file-truename' is overkill, but I guess it's OK for now since I don't think we have a quick replacement for this case. Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 16 23:02:32 2012 Received: (at control) by debbugs.gnu.org; 17 Jan 2012 04:02:32 +0000 Received: from localhost ([127.0.0.1]:60942 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rn0Fi-0002wj-Ph for submit@debbugs.gnu.org; Mon, 16 Jan 2012 23:02:31 -0500 Received: from smtp.cs.ucla.edu ([131.179.128.62]:45758) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rn0Fd-0002wS-Q4 for control@debbugs.gnu.org; Mon, 16 Jan 2012 23:02:27 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 7C79039E800A for ; Mon, 16 Jan 2012 20:01:27 -0800 (PST) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZWwEWgKCQzHQ for ; Mon, 16 Jan 2012 20:01:27 -0800 (PST) Received: from [192.168.1.10] (pool-71-189-109-235.lsanca.fios.verizon.net [71.189.109.235]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 3F97F39E8006 for ; Mon, 16 Jan 2012 20:01:27 -0800 (PST) Message-ID: <4F14F2A9.3030303@cs.ucla.edu> Date: Mon, 16 Jan 2012 20:01:45 -0800 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux i686; rv:8.0) Gecko/20111124 Thunderbird/8.0 MIME-Version: 1.0 To: control@debbugs.gnu.org Subject: Bug#10489 has a patch Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) tags 10489 patch From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 17 01:08:10 2012 Received: (at submit) by debbugs.gnu.org; 17 Jan 2012 06:08:10 +0000 Received: from localhost ([127.0.0.1]:60995 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rn2DK-0006hG-Fe for submit@debbugs.gnu.org; Tue, 17 Jan 2012 01:08:10 -0500 Received: from eggs.gnu.org ([140.186.70.92]:49976) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rn2DH-0006h9-Ik for submit@debbugs.gnu.org; Tue, 17 Jan 2012 01:08:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rn2CJ-0003EJ-Uh for submit@debbugs.gnu.org; Tue, 17 Jan 2012 01:07:08 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([140.186.70.17]:41745) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rn2CJ-0003EA-TE for submit@debbugs.gnu.org; Tue, 17 Jan 2012 01:07:07 -0500 Received: from eggs.gnu.org ([140.186.70.92]:50132) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rn2CI-0002gr-RZ for bug-gnu-emacs@gnu.org; Tue, 17 Jan 2012 01:07:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rn2CG-0003DP-KI for bug-gnu-emacs@gnu.org; Tue, 17 Jan 2012 01:07:06 -0500 Received: from lo.gmane.org ([80.91.229.12]:39112) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rn2CG-0003Cr-AN for bug-gnu-emacs@gnu.org; Tue, 17 Jan 2012 01:07:04 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Rn2CC-0002H4-8L for bug-gnu-emacs@gnu.org; Tue, 17 Jan 2012 07:07:00 +0100 Received: from 93.211.85.79.rev.sfr.net ([79.85.211.93]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 17 Jan 2012 07:07:00 +0100 Received: from thierry.volpiatto by 93.211.85.79.rev.sfr.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 17 Jan 2012 07:07:00 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Date: Tue, 17 Jan 2012 07:06:47 +0100 Lines: 44 Message-ID: <8739be7thk.fsf@gmail.com> References: <87mx9su32g.fsf@web.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <87fwfjo24c.fsf@gmx.de> <87pqen76p4.fsf@gmail.com> <83fwfik92e.fsf@gnu.org> <87mx9q1sz7.fsf@gmail.com> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> <87ehuz793s.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 93.211.85.79.rev.sfr.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) Cancel-Lock: sha1:MZ/xW8KDszsjKcfS3fm8QzQwM90= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) Thierry Volpiatto writes: > Andreas Schwab writes: > >> You also need to check whether the target is a subdirectory of the >> source. > Indeed yes, is there already a function to check this? > If not what about something like this: BTW this work also for equality between two directories. (both GNU/Linux and Windows) #+BEGIN_SRC lisp (defun file-subdir-of-p (file1 file2) "Check if FILE1 is a subdirectory of FILE2." (when (and (not (or (file-remote-p file1) (file-remote-p file2))) (not (string= file1 "/")) (file-directory-p file1) (file-directory-p file2)) (or (string= file2 "/") (loop with f1 = (expand-file-name file1) with f2 = (expand-file-name file2) with ls1 = (split-string f1 "/" t) with ls2 = (split-string f2 "/" t) 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 ;; Use here `file-equal-p' when ready to work. (string= (file-truename (directory-file-name root)) (file-truename(directory-file-name f2))))))) #+END_SRC -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 21 08:01:48 2012 Received: (at 10489) by debbugs.gnu.org; 21 Jan 2012 13:01:48 +0000 Received: from localhost ([127.0.0.1]:38665 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RoaZn-0001tW-9d for submit@debbugs.gnu.org; Sat, 21 Jan 2012 08:01:48 -0500 Received: from mail-ww0-f46.google.com ([74.125.82.46]:55332) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RoaZk-0001tJ-BZ for 10489@debbugs.gnu.org; Sat, 21 Jan 2012 08:01:46 -0500 Received: by wgbdt14 with SMTP id dt14so1440031wgb.15 for <10489@debbugs.gnu.org>; Sat, 21 Jan 2012 05:01:35 -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=t67Q7JKhA2Ti+pO6wpw1Psre7PRB5EY97M55J+cYKLk=; b=GjNWUM4g6UM8rcIlK9vWA4KQHFuSm60FRzsSBwMJwGRpEUoPY2k36zJJbUCdWIrpH+ 800fxKZwYfHLt/2mBXrv9wPLLHrxNEfoFC1wUs6U6YtkFoIy0W+4WoXzmmqAof34U//7 VKQFW0ZHvpicLl1zMbULRHgiFRMeGQXYE0GII= Received: by 10.180.77.228 with SMTP id v4mr2670511wiw.8.1327150894405; Sat, 21 Jan 2012 05:01:34 -0800 (PST) Received: from thierry-MM061 (204.77.197.77.rev.sfr.net. [77.197.77.204]) by mx.google.com with ESMTPS id dr5sm19670125wib.0.2012.01.21.05.01.30 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 21 Jan 2012 05:01:32 -0800 (PST) From: Thierry Volpiatto To: Andreas Schwab Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87fwfkc4pn.fsf@gmx.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <87fwfjo24c.fsf@gmx.de> <87pqen76p4.fsf@gmail.com> <83fwfik92e.fsf@gnu.org> <87mx9q1sz7.fsf@gmail.com> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> Date: Sat, 21 Jan 2012 14:01:28 +0100 In-Reply-To: (Andreas Schwab's message of "Mon, 16 Jan 2012 15:09:48 +0100") Message-ID: <87ehuti507.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) --=-=-= Content-Type: text/plain Andreas Schwab writes: >> So, any objections to apply my patch to trunk with these changes? > > You also need to check whether the target is a subdirectory of the > source. To clarify: --8<---------------cut here---------------start------------->8--- thierry@thierry-MM061:~$ cd ~/tmp/Test/ thierry@thierry-MM061:~/tmp/Test$ ls -R .: Test1 ./Test1: Test2 ./Test1/Test2: Test3 ./Test1/Test2/Test3: thierry@thierry-MM061:~/tmp/Test$ LC_ALL=C cp -r ~/tmp/Test/ ~/tmp/Test/Test1/Test2/Test3/ cp: cannot copy a directory, `/home/thierry/tmp/Test/', into itself, `/home/thierry/tmp/Test/Test1/Test2/Test3/Test' --8<---------------cut here---------------end--------------->8--- So we need to check this. (See `file-subdir-of-p' in this patch) --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=Singlepatch-r118414ToTip.patch Content-Description: bugfix ##Merge of all patches applied from revision 118409 ## patch-r118414: Bugfix bug#10489, dired-do-copy may create infinite directory hierarchy. ## patch-r118411: * lisp/dired-aux.el (dired-copy-file-recursive): Use file-equal-p. ## patch-r118412: * lisp/files.el (file-subdir-of-p): Check if file1 is subdir of file2. ## diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1264,24 +1264,27 @@ (defun dired-copy-file-recursive (from to ok-flag &optional preserve-time top recursive) + (when (or (files-equal-p from to) + (file-subdir-of-p from to)) + (error "Can't copy directory `%s' on itself" from)) (let ((attrs (file-attributes from))) (if (and recursive - (eq t (car attrs)) - (or (eq recursive 'always) - (yes-or-no-p (format "Recursive copies of %s? " from)))) - ;; This is a directory. - (copy-directory from to preserve-time) + (eq t (car attrs)) + (or (eq recursive 'always) + (yes-or-no-p (format "Recursive copies of %s? " from)))) + ;; This is a directory. + (copy-directory from to preserve-time) ;; Not a directory. (or top (dired-handle-overwrite to)) (condition-case err - (if (stringp (car attrs)) - ;; It is a symlink - (make-symbolic-link (car attrs) to ok-flag) - (copy-file from to ok-flag preserve-time)) - (file-date-error - (push (dired-make-relative from) - dired-create-files-failures) - (dired-log "Can't set date on %s:\n%s\n" from err)))))) + (if (stringp (car attrs)) + ;; It is a symlink + (make-symbolic-link (car attrs) to ok-flag) + (copy-file from to ok-flag preserve-time)) + (file-date-error + (push (dired-make-relative from) + dired-create-files-failures) + (dired-log "Can't set date on %s:\n%s\n" from err)))))) ;;;###autoload (defun dired-rename-file (file newname ok-if-already-exists) @@ -1378,7 +1381,7 @@ ;; The basic function for half a dozen variations on cp/mv/ln/ln -s. (defun dired-create-files (file-creator operation fn-list name-constructor - &optional marker-char) + &optional marker-char) "Create one or more new files from a list of existing files FN-LIST. This function also handles querying the user, updating Dired buffers, and displaying a success or failure message. @@ -1401,10 +1404,14 @@ Optional MARKER-CHAR is a character with which to mark every newfile's entry, or t to use the current marker character if the old file was marked." - (let (dired-create-files-failures failures - skipped (success-count 0) (total (length fn-list))) - (let (to overwrite-query - overwrite-backup-query) ; for dired-handle-overwrite + (let (dired-create-files-failures + failures + skipped + (success-count 0) + (total (length fn-list))) + (let (to + overwrite-query + overwrite-backup-query) ; for dired-handle-overwrite (dolist (from fn-list) (setq to (funcall name-constructor from)) (if (equal to from) @@ -1430,10 +1437,25 @@ (cond ((integerp marker-char) marker-char) (marker-char (dired-file-marker from)) ; slow (t nil)))) - (when (and (file-directory-p from) - (file-directory-p to) - (eq file-creator 'dired-copy-file)) - (setq to (file-name-directory to))) + ;; Handle the `dired-copy-file' file-creator specially + ;; When copying a directory to another directory or + ;; possibly to itself. + ;; (e.g "~/foo" => "~/test" or "~/foo" =>"~/foo") + ;; In this case the 'name-constructor' have set the destination + ;; 'to' to "~/test/foo" because the old + ;; emacs23 behavior of `copy-directory' + ;; was no not create the subdir and copy instead the contents only. + ;; With it's new behavior (similar to cp shell command) we don't + ;; need such a construction, so modify the destination 'to' to + ;; "~/test/" instead of "~/test/foo/". + ;; If from and to are the same directory do the same, + ;; the error will be handled by `dired-copy-file-recursive'. + (let ((destname (file-name-directory to))) + (when (and (file-directory-p from) + (or (files-equal-p from destname) + (file-directory-p to)) + (eq file-creator 'dired-copy-file)) + (setq to destname))) (condition-case err (progn (funcall file-creator from to dired-overwrite-confirmed) @@ -1456,25 +1478,25 @@ (setq failures (nconc failures dired-create-files-failures)) (dired-log-summary (format "%s failed for %d file%s in %d requests" - operation (length failures) - (dired-plural-s (length failures)) - total) + operation (length failures) + (dired-plural-s (length failures)) + total) failures)) (failures (dired-log-summary (format "%s failed for %d of %d file%s" - operation (length failures) - total (dired-plural-s total)) + operation (length failures) + total (dired-plural-s total)) failures)) (skipped (dired-log-summary (format "%s: %d of %d file%s skipped" - operation (length skipped) total - (dired-plural-s total)) + operation (length skipped) total + (dired-plural-s total)) skipped)) (t (message "%s: %s file%s" - operation success-count (dired-plural-s success-count))))) + operation success-count (dired-plural-s success-count))))) (dired-move-to-filename)) (defun dired-do-create-files (op-symbol file-creator operation arg diff --git a/lisp/files.el b/lisp/files.el --- a/lisp/files.el +++ b/lisp/files.el @@ -4902,6 +4902,35 @@ directory 'full directory-files-no-dot-files-regexp))) (delete-directory-internal directory))))) +(defun files-equal-p (file1 file2) + "Return non-nil if FILE1 and FILE2 name the same file." + (and (equal (file-remote-p file1) (file-remote-p file2)) + (equal (file-attributes (file-truename (expand-file-name file1))) + (file-attributes (file-truename (expand-file-name file2)))))) + +(defun file-subdir-of-p (file1 file2) + "Check if FILE1 is a subdirectory of FILE2 on current filesystem. +If directory FILE1 is the same than directory FILE2, return non--nil." + (when (and (not (or (file-remote-p file1) + (file-remote-p file2))) + (not (string= file1 "/")) + (file-directory-p file1) + (file-directory-p file2)) + (or (string= file2 "/") + (loop with f1 = (expand-file-name file1) + with f2 = (expand-file-name file2) + with ls1 = (split-string f1 "/" t) + with ls2 = (split-string f2 "/" t) + 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 + (string= (file-truename (directory-file-name root)) + (file-truename (directory-file-name f2))))))) + (defun copy-directory (directory newname &optional keep-time parents copy-contents) "Copy DIRECTORY to NEWNAME. Both args must be strings. This function always sets the file modes of the output files to match @@ -4928,10 +4957,13 @@ (format "Copy directory %s to: " dir) default-directory default-directory nil nil) current-prefix-arg t nil))) + (when (or (files-equal-p directory newname) + (file-subdir-of-p directory newname)) + (error "Can't copy directory `%s' on itself" directory)) ;; If default-directory is a remote directory, make sure we find its ;; copy-directory handler. (let ((handler (or (find-file-name-handler directory 'copy-directory) - (find-file-name-handler newname 'copy-directory)))) + (find-file-name-handler newname 'copy-directory)))) (if handler (funcall handler 'copy-directory directory newname keep-time parents) --=-=-= Content-Type: text/plain -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 21 11:03:43 2012 Received: (at submit) by debbugs.gnu.org; 21 Jan 2012 16:03:43 +0000 Received: from localhost ([127.0.0.1]:39259 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RodPq-00069h-LN for submit@debbugs.gnu.org; Sat, 21 Jan 2012 11:03:43 -0500 Received: from eggs.gnu.org ([140.186.70.92]:46151) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RodPl-00069Q-LT for submit@debbugs.gnu.org; Sat, 21 Jan 2012 11:03:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RodPb-0003pa-B4 for submit@debbugs.gnu.org; Sat, 21 Jan 2012 11:03:28 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([140.186.70.17]:40183) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RodPb-0003pW-9V for submit@debbugs.gnu.org; Sat, 21 Jan 2012 11:03:27 -0500 Received: from eggs.gnu.org ([140.186.70.92]:47138) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RodPZ-0006Z9-OO for bug-gnu-emacs@gnu.org; Sat, 21 Jan 2012 11:03:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RodPK-0003nk-J8 for bug-gnu-emacs@gnu.org; Sat, 21 Jan 2012 11:03:25 -0500 Received: from lo.gmane.org ([80.91.229.12]:45521) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RodPJ-0003nN-MX for bug-gnu-emacs@gnu.org; Sat, 21 Jan 2012 11:03:10 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RodPI-0003X2-9V for bug-gnu-emacs@gnu.org; Sat, 21 Jan 2012 17:03:08 +0100 Received: from 204.77.197.77.rev.sfr.net ([77.197.77.204]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 21 Jan 2012 17:03:08 +0100 Received: from thierry.volpiatto by 204.77.197.77.rev.sfr.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 21 Jan 2012 17:03:08 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Date: Sat, 21 Jan 2012 17:02:46 +0100 Lines: 245 Message-ID: <87sjj9jb6h.fsf@gmail.com> References: <87mx9su32g.fsf@web.de> <87fwfjsw8t.fsf@gmail.com> <87aa5rdazl.fsf@gmx.de> <87d3anogf5.fsf@gmail.com> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <87fwfjo24c.fsf@gmx.de> <87pqen76p4.fsf@gmail.com> <83fwfik92e.fsf@gnu.org> <87mx9q1sz7.fsf@gmail.com> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> <87ehuti507.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 204.77.197.77.rev.sfr.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) Cancel-Lock: sha1:r4OnbiQ4bg2mQcnMQ/o69tt7SHw= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Thierry Volpiatto writes: > Andreas Schwab writes: > >>> So, any objections to apply my patch to trunk with these changes? >> >> You also need to check whether the target is a subdirectory of the >> source. Sorry the last patch sent haven't the last changes included. Here the good one. =2D-=20 Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997=20 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=Singlepatch-r118414ToTip.patch Content-Transfer-Encoding: quoted-printable ##Merge of all patches applied from revision 118409 ## patch-r118414: Bugfix bug#10489, dired-do-copy may create infinite direc= tory hierarchy. ## patch-r118411: * lisp/dired-aux.el (dired-copy-file-recursive): Use file= -equal-p. ## patch-r118412: * lisp/files.el (file-subdir-of-p): Check if file1 is sub= dir of file2. ##=20 diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el =2D-- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1264,24 +1264,27 @@ =20 (defun dired-copy-file-recursive (from to ok-flag &optional preserve-time top recursive) + (when (or (files-equal-p from to) + (file-subdir-of-p to from)) + (error "Can't copy directory `%s' on itself" from)) (let ((attrs (file-attributes from))) (if (and recursive =2D (eq t (car attrs)) =2D (or (eq recursive 'always) =2D (yes-or-no-p (format "Recursive copies of %s? " from)))) =2D ;; This is a directory. =2D (copy-directory from to preserve-time) + (eq t (car attrs)) + (or (eq recursive 'always) + (yes-or-no-p (format "Recursive copies of %s? " from)))) + ;; This is a directory. + (copy-directory from to preserve-time) ;; Not a directory. (or top (dired-handle-overwrite to)) (condition-case err =2D (if (stringp (car attrs)) =2D ;; It is a symlink =2D (make-symbolic-link (car attrs) to ok-flag) =2D (copy-file from to ok-flag preserve-time)) =2D (file-date-error =2D (push (dired-make-relative from) =2D dired-create-files-failures) =2D (dired-log "Can't set date on %s:\n%s\n" from err)))))) + (if (stringp (car attrs)) + ;; It is a symlink + (make-symbolic-link (car attrs) to ok-flag) + (copy-file from to ok-flag preserve-time)) + (file-date-error + (push (dired-make-relative from) + dired-create-files-failures) + (dired-log "Can't set date on %s:\n%s\n" from err)))))) =20 ;;;###autoload (defun dired-rename-file (file newname ok-if-already-exists) @@ -1378,7 +1381,7 @@ =20 ;; The basic function for half a dozen variations on cp/mv/ln/ln -s. (defun dired-create-files (file-creator operation fn-list name-constructor =2D &optional marker-char) + &optional marker-char) "Create one or more new files from a list of existing files FN-LIST. This function also handles querying the user, updating Dired buffers, and displaying a success or failure message. @@ -1401,10 +1404,14 @@ Optional MARKER-CHAR is a character with which to mark every newfile's entry, or t to use the current marker character if the old file was marked." =2D (let (dired-create-files-failures failures =2D skipped (success-count 0) (total (length fn-list))) =2D (let (to overwrite-query =2D overwrite-backup-query) ; for dired-handle-overwrite + (let (dired-create-files-failures + failures + skipped + (success-count 0) + (total (length fn-list))) + (let (to + overwrite-query + overwrite-backup-query) ; for dired-handle-overwrite (dolist (from fn-list) (setq to (funcall name-constructor from)) (if (equal to from) @@ -1430,10 +1437,27 @@ (cond ((integerp marker-char) marker-char) (marker-char (dired-file-marker from)) ; slow (t nil)))) =2D (when (and (file-directory-p from) =2D (file-directory-p to) =2D (eq file-creator 'dired-copy-file)) =2D (setq to (file-name-directory to))) + ;; Handle the `dired-copy-file' file-creator specially + ;; When copying a directory to another directory or + ;; possibly to itself. + ;; (e.g "~/foo" =3D> "~/test" or "~/foo" =3D>"~/foo") + ;; In this case the 'name-constructor' have set the destination + ;; 'to' to "~/test/foo" because the old + ;; emacs23 behavior of `copy-directory' + ;; was no not create the subdir and copy instead the contents = only. + ;; With it's new behavior (similar to cp shell command) we don= 't + ;; need such a construction, so modify the destination 'to' to + ;; "~/test/" instead of "~/test/foo/". + ;; If from and to are the same directory do the same, + ;; the error will be handled by `dired-copy-file-recursive'. + (let ((destname (file-name-directory to))) + (when (and (file-directory-p from) + (or (files-equal-p from destname) + (file-directory-p to)) + (eq file-creator 'dired-copy-file)) + (setq to destname)) + (and (file-subdir-of-p destname from) + (error "Can't copy directory `%s' on itself" from))) (condition-case err (progn (funcall file-creator from to dired-overwrite-confirmed) @@ -1456,25 +1480,25 @@ (setq failures (nconc failures dired-create-files-failures)) (dired-log-summary (format "%s failed for %d file%s in %d requests" =2D operation (length failures) =2D (dired-plural-s (length failures)) =2D total) + operation (length failures) + (dired-plural-s (length failures)) + total) failures)) (failures (dired-log-summary (format "%s failed for %d of %d file%s" =2D operation (length failures) =2D total (dired-plural-s total)) + operation (length failures) + total (dired-plural-s total)) failures)) (skipped (dired-log-summary (format "%s: %d of %d file%s skipped" =2D operation (length skipped) total =2D (dired-plural-s total)) + operation (length skipped) total + (dired-plural-s total)) skipped)) (t (message "%s: %s file%s" =2D operation success-count (dired-plural-s success-count))))) + operation success-count (dired-plural-s success-count))))) (dired-move-to-filename)) (defun dired-do-create-files (op-symbol file-creator operation arg diff --git a/lisp/files.el b/lisp/files.el =2D-- a/lisp/files.el +++ b/lisp/files.el @@ -4902,6 +4902,35 @@ directory 'full directory-files-no-dot-files-regexp))) (delete-directory-internal directory))))) =20 +(defun files-equal-p (file1 file2) + "Return non-nil if FILE1 and FILE2 name the same file." + (and (equal (file-remote-p file1) (file-remote-p file2)) + (equal (file-attributes (file-truename (expand-file-name file1))) + (file-attributes (file-truename (expand-file-name file2)))))) + +(defun file-subdir-of-p (file1 file2) + "Check if FILE1 is a subdirectory of FILE2 on current filesystem. +If directory FILE1 is the same than directory FILE2, return non--nil." + (when (and (not (or (file-remote-p file1) + (file-remote-p file2))) + (not (string=3D file1 "/")) + (file-directory-p file1) + (file-directory-p file2)) + (or (string=3D file2 "/") + (loop with f1 =3D (expand-file-name file1) + with f2 =3D (expand-file-name file2) + with ls1 =3D (split-string f1 "/" t) + with ls2 =3D (split-string f2 "/" t) + for p =3D (string-match "^/" f1) + for i in ls1 + for j in ls2 + when (string=3D i j) + concat (if p (concat "/" i) (concat i "/")) + into root + finally return + (string=3D (file-truename (directory-file-name root)) + (file-truename (directory-file-name f2))))))) + (defun copy-directory (directory newname &optional keep-time parents copy-= contents) "Copy DIRECTORY to NEWNAME. Both args must be strings. This function always sets the file modes of the output files to match @@ -4928,10 +4957,13 @@ (format "Copy directory %s to: " dir) default-directory default-directory nil nil) current-prefix-arg t nil))) + (when (or (files-equal-p directory newname) + (file-subdir-of-p directory newname)) + (error "Can't copy directory `%s' on itself" directory)) ;; If default-directory is a remote directory, make sure we find its ;; copy-directory handler. (let ((handler (or (find-file-name-handler directory 'copy-directory) =2D (find-file-name-handler newname 'copy-directory)))) + (find-file-name-handler newname 'copy-directory)))) (if handler (funcall handler 'copy-directory directory newname keep-time parents) =20 --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAk8a4aYACgkQKNF/U1nymZcRvgCfaJ5DJ15gbJ7HM7iCqLPtap+S XXIAoIhL072YOh/Qtfop/xgSPRsdecZw =07qE -----END PGP SIGNATURE----- --==-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 21 11:55:57 2012 Received: (at 10489) by debbugs.gnu.org; 21 Feb 2012 16:55:57 +0000 Received: from localhost ([127.0.0.1]:48973 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rzt0O-0004RD-Q3 for submit@debbugs.gnu.org; Tue, 21 Feb 2012 11:55:57 -0500 Received: from mail-we0-f172.google.com ([74.125.82.172]:57409) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rzt0M-0004Qy-I9 for 10489@debbugs.gnu.org; Tue, 21 Feb 2012 11:55:55 -0500 Received: by werg1 with SMTP id g1so3009739wer.3 for <10489@debbugs.gnu.org>; Tue, 21 Feb 2012 08:53:31 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.92.229 as permitted sender) client-ip=10.180.92.229; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.92.229 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.180.92.229]) by 10.180.92.229 with SMTP id cp5mr27254444wib.8.1329843211670 (num_hops = 1); Tue, 21 Feb 2012 08:53:31 -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=5FlU124+aNPbTD9qiZVUUHCTbNCk3vyA8yji4gVG5dQ=; b=gfxtf69AWVlxLDzs+1RV2MtpOntHjfK7tSNu//p1tnGQuRfhh8etK2GFYlZvg+zJZB Mda1QyGUaCxd2SroCAhH8gkO1Tyu16JIK38S4d42BPnfmmNcfMN35Kzk6g6ytV0YMygP S6sI6lw1LSPBiL4hWUHsWx2A67efxgT9CF/sQ= Received: by 10.180.92.229 with SMTP id cp5mr22704963wib.8.1329843211617; Tue, 21 Feb 2012 08:53:31 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id dw7sm23665828wib.4.2012.02.21.08.53.29 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 21 Feb 2012 08:53:30 -0800 (PST) From: Thierry Volpiatto To: Stefan Monnier Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <011AEED9E81C4DEFA6B1E03B0F57F28F@us.oracle.com> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <87fwfjo24c.fsf@gmx.de> <87pqen76p4.fsf@gmail.com> <83fwfik92e.fsf@gnu.org> <87mx9q1sz7.fsf@gmail.com> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> <871uqzn3bc.fsf@gmx.de> <871uqz651u.fsf@gmx.de> Date: Tue, 21 Feb 2012 17:53:27 +0100 In-Reply-To: (Stefan Monnier's message of "Mon, 16 Jan 2012 16:40:34 -0500") Message-ID: <87pqd89lh4.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Hi Stefan and Michael, so what is the state of this bug and what do you plan for this? As a reminder, we needed: 1) A function to compare filenames locally. 2) A tramp handler for this function. 3) A function to check if file1 is subdir of file2, locally also. 4) A tramp handler for this one also? We have more or less 1 and 3, need tramp handlers for them. What else is needed? -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 21 13:01:39 2012 Received: (at 10489) by debbugs.gnu.org; 21 Feb 2012 18:01:40 +0000 Received: from localhost ([127.0.0.1]:49043 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rzu1y-0007jA-VQ for submit@debbugs.gnu.org; Tue, 21 Feb 2012 13:01:39 -0500 Received: from chene.dit.umontreal.ca ([132.204.246.20]:56855) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rzu1u-0007j0-Pr for 10489@debbugs.gnu.org; Tue, 21 Feb 2012 13:01:36 -0500 Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id q1LHxGQY006324; Tue, 21 Feb 2012 12:59:16 -0500 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 29BB6B4467; Tue, 21 Feb 2012 12:59:16 -0500 (EST) From: Stefan Monnier To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Message-ID: References: <87mx9su32g.fsf@web.de> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <87fwfjo24c.fsf@gmx.de> <87pqen76p4.fsf@gmail.com> <83fwfik92e.fsf@gnu.org> <87mx9q1sz7.fsf@gmail.com> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> <871uqzn3bc.fsf@gmx.de> <871uqz651u.fsf@gmx.de> <87pqd89lh4.fsf@gmail.com> Date: Tue, 21 Feb 2012 12:59:16 -0500 In-Reply-To: <87pqd89lh4.fsf@gmail.com> (Thierry Volpiatto's message of "Tue, 21 Feb 2012 17:53:27 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4139=0 X-NAI-Spam-Version: 2.2.0.9309 : core <4139> : streams <730917> : uri <1069643> X-Spam-Score: -3.5 (---) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.5 (---) > so what is the state of this bug and what do you plan for this? > As a reminder, we needed: > 1) A function to compare filenames locally. > 2) A tramp handler for this function. > 3) A function to check if file1 is subdir of file2, locally also. > 4) A tramp handler for this one also? > We have more or less 1 and 3, need tramp handlers for them. > What else is needed? Just before we try and solve this problem the hard way: I just tried: % ln -s erlang-otp erl % cp -r erl/lib erlang-otp/lib/inviso/ on my Debian system, and it told me "cp: impossible de cr=E9er un r=E9pertoire (=AB=A0erl/lib=A0=BB) dans lui-m=EAme (=AB=A0erlang-otp/lib/in= viso/lib=A0=BB)", but note that it only told me so *after* performing the copy. I.e. it only detected the problem when trying to make erlang-otp/lib/inviso/lib/inviso/lib So it seems that the coreutils guys have found it sufficient to detect the inf-loop after the fact and interrupt the operation at that point rather than to try and predict that the cp will loop and don't perform it at all. It might be easier to get a solution that catches all cases that way: remember the name and identity (inode/file-attributes/younameit) of the top directory we create, and whenever we're about to copy a directory of the same name, check whether it happens to have the same identity, in which case we've hit an inf-loop. Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 21 14:46:14 2012 Received: (at 10489) by debbugs.gnu.org; 21 Feb 2012 19:46:14 +0000 Received: from localhost ([127.0.0.1]:49132 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RzvfC-0001nd-Eq for submit@debbugs.gnu.org; Tue, 21 Feb 2012 14:46:14 -0500 Received: from mailout-de.gmx.net ([213.165.64.23]:59969) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1Rzvf9-0001nO-4k for 10489@debbugs.gnu.org; Tue, 21 Feb 2012 14:46:12 -0500 Received: (qmail invoked by alias); 21 Feb 2012 19:43:45 -0000 Received: from p57BB99E7.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.153.231] by mail.gmx.net (mp033) with SMTP; 21 Feb 2012 20:43:45 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1/h8Y8aRJ3hNbEUHmOX4knnXS+yjD37TzgE/U1e5i AFJggDLZBfictn From: Michael Albinus To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <87fwfjo24c.fsf@gmx.de> <87pqen76p4.fsf@gmail.com> <83fwfik92e.fsf@gnu.org> <87mx9q1sz7.fsf@gmail.com> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> <871uqzn3bc.fsf@gmx.de> <871uqz651u.fsf@gmx.de> <87pqd89lh4.fsf@gmail.com> Date: Tue, 21 Feb 2012 20:43:40 +0100 In-Reply-To: <87pqd89lh4.fsf@gmail.com> (Thierry Volpiatto's message of "Tue, 21 Feb 2012 17:53:27 +0100") Message-ID: <871upoyntf.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Thierry Volpiatto writes: > Hi Stefan and Michael, Hi Thierry, > 1) A function to compare filenames locally. > 2) A tramp handler for this function. > 3) A function to check if file1 is subdir of file2, locally also. > 4) A tramp handler for this one also? > > We have more or less 1 and 3, need tramp handlers for them. 1 and 3 can be done without Tramp and ange-ftp handlers. Those handlers could be written easily afterwards; whether they shall be added to Emacs 24.1 depends on the release plans (which I don't know). If 24.1 will be released soon, I would be in favor to add the handlers after the release. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 21 14:49:01 2012 Received: (at 10489) by debbugs.gnu.org; 21 Feb 2012 19:49:01 +0000 Received: from localhost ([127.0.0.1]:49136 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rzvho-0001rX-VY for submit@debbugs.gnu.org; Tue, 21 Feb 2012 14:49:01 -0500 Received: from mailout-de.gmx.net ([213.165.64.23]:39772) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1Rzvhj-0001r9-2T for 10489@debbugs.gnu.org; Tue, 21 Feb 2012 14:48:55 -0500 Received: (qmail invoked by alias); 21 Feb 2012 19:46:26 -0000 Received: from p57BB99E7.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.153.231] by mail.gmx.net (mp031) with SMTP; 21 Feb 2012 20:46:26 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1/1/PB1GUv1BOTCxOUJvLvDDNGRu5nUp5sV4i8ts6 yGGNaFjQImPKO3 From: Michael Albinus To: Stefan Monnier Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <87fwfjo24c.fsf@gmx.de> <87pqen76p4.fsf@gmail.com> <83fwfik92e.fsf@gnu.org> <87mx9q1sz7.fsf@gmail.com> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> <871uqzn3bc.fsf@gmx.de> <871uqz651u.fsf@gmx.de> <87pqd89lh4.fsf@gmail.com> Date: Tue, 21 Feb 2012 20:46:21 +0100 In-Reply-To: (Stefan Monnier's message of "Tue, 21 Feb 2012 12:59:16 -0500") Message-ID: <87wr7gx94i.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Stefan Monnier writes: > It might be easier to get a solution that catches all cases that way: > remember the name and identity (inode/file-attributes/younameit) of > the top directory we create, and whenever we're about to copy > a directory of the same name, check whether it happens to have the > same identity, in which case we've hit an inf-loop. Don't know whether it is such easy in Tramp. Must be checked. Remember, Tramp could use tools like rsync and tar for copying directories. > Stefan Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 21 16:00:54 2012 Received: (at 10489) by debbugs.gnu.org; 21 Feb 2012 21:00:54 +0000 Received: from localhost ([127.0.0.1]:49243 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RzwpO-0003Yq-NG for submit@debbugs.gnu.org; Tue, 21 Feb 2012 16:00:54 -0500 Received: from mail-we0-f172.google.com ([74.125.82.172]:44892) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RzwpJ-0003YY-2s for 10489@debbugs.gnu.org; Tue, 21 Feb 2012 16:00:49 -0500 Received: by werg1 with SMTP id g1so3159942wer.3 for <10489@debbugs.gnu.org>; Tue, 21 Feb 2012 12:58:21 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.216.138.195 as permitted sender) client-ip=10.216.138.195; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.216.138.195 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.216.138.195]) by 10.216.138.195 with SMTP id a45mr7480149wej.25.1329857901066 (num_hops = 1); Tue, 21 Feb 2012 12:58:21 -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:content-transfer-encoding; bh=/ybBMn8lk5FKsSk2/5VLoyqdxKbfZjQhDxITeSATvRQ=; b=csATgA6Gzqzh/G3/FGOsZ9HV8CCgF++KCMwkVYsPQG5T1ogZuydhrVb8NzUNg1/+1N HyO/93VzgAUO0TuA2xplIIRhhdjDnpRwiakCu/JETWIXzedGpnIvG4UqnmKenFVSUBCK p6wUZqyBY3ABJvdY+/10KVX/wZvvukOvl1hGk= Received: by 10.216.138.195 with SMTP id a45mr6232555wej.25.1329857900985; Tue, 21 Feb 2012 12:58:20 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id gf3sm23484260wib.6.2012.02.21.12.58.18 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 21 Feb 2012 12:58:20 -0800 (PST) From: Thierry Volpiatto To: Stefan Monnier Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <87fwfjo24c.fsf@gmx.de> <87pqen76p4.fsf@gmail.com> <83fwfik92e.fsf@gnu.org> <87mx9q1sz7.fsf@gmail.com> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> <871uqzn3bc.fsf@gmx.de> <871uqz651u.fsf@gmx.de> <87pqd89lh4.fsf@gmail.com> Date: Tue, 21 Feb 2012 21:58:16 +0100 In-Reply-To: (Stefan Monnier's message of "Tue, 21 Feb 2012 12:59:16 -0500") Message-ID: <87mx8b3nvb.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Stefan Monnier writes: >> so what is the state of this bug and what do you plan for this? > >> As a reminder, we needed: > >> 1) A function to compare filenames locally. >> 2) A tramp handler for this function. >> 3) A function to check if file1 is subdir of file2, locally also. >> 4) A tramp handler for this one also? > >> We have more or less 1 and 3, need tramp handlers for them. > >> What else is needed? > > Just before we try and solve this problem the hard way: > I just tried: > > % ln -s erlang-otp erl > % cp -r erl/lib erlang-otp/lib/inviso/ We have to check if "erlang-otp/lib/inviso/" is a subdir of "erl/lib" to resolve this, right? The following function should work: --8<---------------cut here---------------start------------->8--- (defun file-subdir-of-p (file1 file2) "Check if FILE1 is a subdirectory of FILE2 on current filesystem. If directory FILE1 is the same than directory FILE2, return non--nil." (when (and (not (or (file-remote-p file1) (file-remote-p file2))) (not (string=3D file1 "/")) (file-directory-p file1) (file-directory-p file2)) (or (string=3D file2 "/") (loop with f1 =3D (expand-file-name (file-truename file1)) with f2 =3D (expand-file-name (file-truename file2)) with ls1 =3D (split-string f1 "/" t) with ls2 =3D (split-string f2 "/" t) for p =3D (string-match "^/" f1) for i in ls1 for j in ls2 when (string=3D i j) concat (if p (concat "/" i) (concat i "/")) into root finally return (equal (file-attributes (file-truename root)) (file-attributes f2)))))) --8<---------------cut here---------------end--------------->8--- Can you try? (file-subdir-of-p "erlang-otp/lib/inviso/" "erl/lib") > on my Debian system, and it told me "cp: impossible de cr=C3=A9er un > r=C3=A9pertoire (=C2=AB=C2=A0erl/lib=C2=A0=C2=BB) dans lui-m=C3=AAme (=C2= =AB=C2=A0erlang-otp/lib/inviso/lib=C2=A0=C2=BB)", > but note that it only told me so *after* performing the copy. > I.e. it only detected the problem when trying to make > erlang-otp/lib/inviso/lib/inviso/lib > > So it seems that the coreutils guys have found it sufficient to detect > the inf-loop after the fact and interrupt the operation at that point > rather than to try and predict that the cp will loop and don't perform > it at all. Do we have to strictly follow this? > It might be easier to get a solution that catches all cases that way: > remember the name and identity (inode/file-attributes/younameit) of > the top directory we create, "erl/lib"? > and whenever we're about to copy a directory of the same name, Not sure to fully understand this, do you mean "and whenever we're about to copy the CONTENTS of a directory of the same name?" > check whether it happens to have the same identity, in which case > we've hit an inf-loop. --=20 Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997=20 From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 21 16:06:12 2012 Received: (at 10489) by debbugs.gnu.org; 21 Feb 2012 21:06:12 +0000 Received: from localhost ([127.0.0.1]:49251 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RzwuW-0003gb-Ui for submit@debbugs.gnu.org; Tue, 21 Feb 2012 16:06:12 -0500 Received: from mail-ww0-f46.google.com ([74.125.82.46]:42283) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RzwuR-0003g4-M7 for 10489@debbugs.gnu.org; Tue, 21 Feb 2012 16:06:08 -0500 Received: by wgbdt14 with SMTP id dt14so5566360wgb.15 for <10489@debbugs.gnu.org>; Tue, 21 Feb 2012 13:03:39 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.95.1 as permitted sender) client-ip=10.180.95.1; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.95.1 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.180.95.1]) by 10.180.95.1 with SMTP id dg1mr28932830wib.21.1329858219696 (num_hops = 1); Tue, 21 Feb 2012 13:03:39 -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=AvA0C92XMRcKaU9hJ1zoXW1LZ8DnMG3hzGZe41F+wrA=; b=DBT6U4+XxgYSjBjEUK4L4U4NKh3OiyLJG8DIjAH91ixEcCCwyJ+QSK9FAILM+0g4T9 7M2G4g3ZyninDzawyu9lresNdNWNNRskKB1B+f8v7djgRSzK8HlsdKAYQR0fOSMJ+DU+ Q6greumS86iK1lBozDRpLTv58OZtmAmdQVuUc= Received: by 10.180.95.1 with SMTP id dg1mr24063758wib.21.1329858219658; Tue, 21 Feb 2012 13:03:39 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id m8sm60700967wia.11.2012.02.21.13.03.37 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 21 Feb 2012 13:03:38 -0800 (PST) From: Thierry Volpiatto To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <878vlbljnc.fsf@gmx.de> <8739bj8mu1.fsf@gmail.com> <87fwfjo24c.fsf@gmx.de> <87pqen76p4.fsf@gmail.com> <83fwfik92e.fsf@gnu.org> <87mx9q1sz7.fsf@gmail.com> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> <871uqzn3bc.fsf@gmx.de> <871uqz651u.fsf@gmx.de> <87pqd89lh4.fsf@gmail.com> <871upoyntf.fsf@gmx.de> Date: Tue, 21 Feb 2012 22:03:36 +0100 In-Reply-To: <871upoyntf.fsf@gmx.de> (Michael Albinus's message of "Tue, 21 Feb 2012 20:43:40 +0100") Message-ID: <87ipiz3nmf.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Hi Michael, Michael Albinus writes: > Thierry Volpiatto writes: > >> Hi Stefan and Michael, > > Hi Thierry, > >> 1) A function to compare filenames locally. >> 2) A tramp handler for this function. >> 3) A function to check if file1 is subdir of file2, locally also. >> 4) A tramp handler for this one also? >> >> We have more or less 1 and 3, need tramp handlers for them. > > 1 and 3 can be done without Tramp and ange-ftp handlers. Yes we have already 1 and 3, (though 3 could be achieved differently as Stefan suggest, don't know) > Those handlers could be written easily afterwards; whether they shall > be added to Emacs 24.1 depends on the release plans (which I don't > know). If 24.1 will be released soon, I would be in favor to add the > handlers after the release. Sound good. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 21 17:53:49 2012 Received: (at 10489) by debbugs.gnu.org; 21 Feb 2012 22:53:49 +0000 Received: from localhost ([127.0.0.1]:49347 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rzyaj-0007uf-Ec for submit@debbugs.gnu.org; Tue, 21 Feb 2012 17:53:49 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:39220) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rzyag-0007uS-UR for 10489@debbugs.gnu.org; Tue, 21 Feb 2012 17:53:48 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjEFAIgfRE9Ld/XJ/2dsb2JhbAA6Ca9GgnuBCIFzAQEEAVYjBQsLNBIUGA0kLodluEKJXIJ0CQwCg2IGCwQRg1AEiE+bGYRb X-IronPort-AV: E=Sophos;i="4.73,460,1325480400"; d="scan'208";a="164114551" Received: from 75-119-245-201.dsl.teksavvy.com (HELO pastel.home) ([75.119.245.201]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 21 Feb 2012 17:51:22 -0500 Received: by pastel.home (Postfix, from userid 20848) id B7FA5590F9; Tue, 21 Feb 2012 17:51:21 -0500 (EST) From: Stefan Monnier To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Message-ID: References: <87mx9su32g.fsf@web.de> <8739bj8mu1.fsf@gmail.com> <87fwfjo24c.fsf@gmx.de> <87pqen76p4.fsf@gmail.com> <83fwfik92e.fsf@gnu.org> <87mx9q1sz7.fsf@gmail.com> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> <871uqzn3bc.fsf@gmx.de> <871uqz651u.fsf@gmx.de> <87pqd89lh4.fsf@gmail.com> <87mx8b3nvb.fsf@gmail.com> Date: Tue, 21 Feb 2012 17:51:21 -0500 In-Reply-To: <87mx8b3nvb.fsf@gmail.com> (Thierry Volpiatto's message of "Tue, 21 Feb 2012 21:58:16 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >>> so what is the state of this bug and what do you plan for this? >> >>> As a reminder, we needed: >> >>> 1) A function to compare filenames locally. >>> 2) A tramp handler for this function. >>> 3) A function to check if file1 is subdir of file2, locally also. >>> 4) A tramp handler for this one also? >> >>> We have more or less 1 and 3, need tramp handlers for them. >> >>> What else is needed? >> >> Just before we try and solve this problem the hard way: >> I just tried: >> >> % ln -s erlang-otp erl >> % cp -r erl/lib erlang-otp/lib/inviso/ > We have to check if "erlang-otp/lib/inviso/" is a subdir of "erl/lib" > to resolve this, right? No, we just have to check if during the recursive copy we're trying to read one of the directories we've just made. >> So it seems that the coreutils guys have found it sufficient to detect >> the inf-loop after the fact and interrupt the operation at that point >> rather than to try and predict that the cp will loop and don't perform >> it at all. > Do we have to strictly follow this? No, it's just an alternative approach. The potential advantage is that it does not require figuring out whether a file is within some directory, it only requires checking actual equality between two directories. Another approach is to first get the complete list of files and only copy them afterwards. This doesn't require any comparison at all and completely avoids the risk of inf-loop. >> It might be easier to get a solution that catches all cases that way: >> remember the name and identity (inode/file-attributes/younameit) of >> the top directory we create, > "erl/lib"? No, we don't create erl/lib (it's the source instead), the top-level dir we create is "erlang-otp/lib/inviso/lib". >> and whenever we're about to copy a directory of the same name, > Not sure to fully understand this, do you mean "and whenever we're > about to copy the CONTENTS of a directory of the same name?" In the recursive loop, the distinction between copying a directory and copying its contents is not really relevant to this problem (the recursive call says "copy foo and its contents"). Stefan From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 22 16:40:06 2012 Received: (at 10489) by debbugs.gnu.org; 22 Feb 2012 21:40:06 +0000 Received: from localhost ([127.0.0.1]:51493 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0Jut-0003QE-WC for submit@debbugs.gnu.org; Wed, 22 Feb 2012 16:40:05 -0500 Received: from mail-ww0-f46.google.com ([74.125.82.46]:60600) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0Jup-0003Pd-IW for 10489@debbugs.gnu.org; Wed, 22 Feb 2012 16:40:01 -0500 Received: by wgbdt14 with SMTP id dt14so454263wgb.15 for <10489@debbugs.gnu.org>; Wed, 22 Feb 2012 13:37:29 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.82.39 as permitted sender) client-ip=10.180.82.39; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.82.39 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.180.82.39]) by 10.180.82.39 with SMTP id f7mr76394wiy.19.1329946649596 (num_hops = 1); Wed, 22 Feb 2012 13:37:29 -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=AqbrPYcxkPpFD9733qbVibO4KVZA6B0BDOlXEPKEYy0=; b=KEZM3Xejy1bVZZXUp44eyJk7agK04xWIkVFCPsHilox1TCn+n31FOPeNSabbxxpeRP E4aSSoOrbdcYE/ZAC4/rFiCUzjUn2QRvQKMwvPGI1R1eh8d3cbdJSaAuw5TGeQih5PEQ +vK+siU3ZBFLCChL23EpvbsbTYl3u2B9iRVIw= Received: by 10.180.82.39 with SMTP id f7mr61365wiy.19.1329946649494; Wed, 22 Feb 2012 13:37:29 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id q2sm341941wiy.7.2012.02.22.13.37.26 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 22 Feb 2012 13:37:28 -0800 (PST) From: Thierry Volpiatto To: Stefan Monnier Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87fwfjo24c.fsf@gmx.de> <87pqen76p4.fsf@gmail.com> <83fwfik92e.fsf@gnu.org> <87mx9q1sz7.fsf@gmail.com> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> <871uqzn3bc.fsf@gmx.de> <871uqz651u.fsf@gmx.de> <87pqd89lh4.fsf@gmail.com> <87mx8b3nvb.fsf@gmail.com> Date: Wed, 22 Feb 2012 22:37:24 +0100 In-Reply-To: (Stefan Monnier's message of "Tue, 21 Feb 2012 17:51:21 -0500") Message-ID: <87pqd6wnvv.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Stefan Monnier writes: >>>> so what is the state of this bug and what do you plan for this? >>> >>>> As a reminder, we needed: >>> >>>> 1) A function to compare filenames locally. >>>> 2) A tramp handler for this function. >>>> 3) A function to check if file1 is subdir of file2, locally also. >>>> 4) A tramp handler for this one also? >>> >>>> We have more or less 1 and 3, need tramp handlers for them. >>> >>>> What else is needed? >>> >>> Just before we try and solve this problem the hard way: >>> I just tried: >>> >>> % ln -s erlang-otp erl >>> % cp -r erl/lib erlang-otp/lib/inviso/ > >> We have to check if "erlang-otp/lib/inviso/" is a subdir of "erl/lib" >> to resolve this, right? > > No, we just have to check if during the recursive copy we're trying to > read one of the directories we've just made. Ok, that is true for the solutions you propose below, but what's wrong with the solution I have proposed: Just checking if the destination directory is a subdirectory of the directory we want to copy. >>> So it seems that the coreutils guys have found it sufficient to detect >>> the inf-loop after the fact and interrupt the operation at that point >>> rather than to try and predict that the cp will loop and don't perform >>> it at all. >> Do we have to strictly follow this? > > No, it's just an alternative approach. The potential advantage is that > it does not require figuring out whether a file is within some > directory, it only requires checking actual equality between two > directories. If we do not have to follow this, I would prefer not starting copying stuff the user will have to remove afterward when he realize it was an error (i.e copying a directory on itself). > Another approach is to first get the complete list of files and only > copy them afterwards. This doesn't require any comparison at all and > completely avoids the risk of inf-loop. This may be slow isn't it? >>> It might be easier to get a solution that catches all cases that way: >>> remember the name and identity (inode/file-attributes/younameit) of >>> the top directory we create, >> "erl/lib"? > > No, we don't create erl/lib (it's the source instead), the top-level dir > we create is "erlang-otp/lib/inviso/lib". > >>> and whenever we're about to copy a directory of the same name, >> Not sure to fully understand this, do you mean "and whenever we're >> about to copy the CONTENTS of a directory of the same name?" > > In the recursive loop, the distinction between copying a directory and > copying its contents is not really relevant to this problem (the > recursive call says "copy foo and its contents"). -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 22 17:02:44 2012 Received: (at 10489) by debbugs.gnu.org; 22 Feb 2012 22:02:44 +0000 Received: from localhost ([127.0.0.1]:51508 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0KGp-0003zL-DZ for submit@debbugs.gnu.org; Wed, 22 Feb 2012 17:02:43 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:24640) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0KGl-0003z3-TU for 10489@debbugs.gnu.org; Wed, 22 Feb 2012 17:02:41 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjEFABFkRU9Ld/XJ/2dsb2JhbABEr1iCcoEIgXMBAQQBViMFCws0EhQYDRABEy6HZrg1jFllFwYFAwKFFwoPDQMMg3AEiE+bGYRb X-IronPort-AV: E=Sophos;i="4.73,466,1325480400"; d="scan'208";a="164223374" Received: from 75-119-245-201.dsl.teksavvy.com (HELO pastel.home) ([75.119.245.201]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 22 Feb 2012 17:00:09 -0500 Received: by pastel.home (Postfix, from userid 20848) id B62BB59173; Wed, 22 Feb 2012 17:00:08 -0500 (EST) From: Stefan Monnier To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Message-ID: References: <87mx9su32g.fsf@web.de> <87pqen76p4.fsf@gmail.com> <83fwfik92e.fsf@gnu.org> <87mx9q1sz7.fsf@gmail.com> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> <871uqzn3bc.fsf@gmx.de> <871uqz651u.fsf@gmx.de> <87pqd89lh4.fsf@gmail.com> <87mx8b3nvb.fsf@gmail.com> <87pqd6wnvv.fsf@gmail.com> Date: Wed, 22 Feb 2012 17:00:08 -0500 In-Reply-To: <87pqd6wnvv.fsf@gmail.com> (Thierry Volpiatto's message of "Wed, 22 Feb 2012 22:37:24 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > Ok, that is true for the solutions you propose below, but what's wrong > with the solution I have proposed: > Just checking if the destination directory is a subdirectory of the > directory we want to copy. It's not a bad plan, but it's difficult to make it catch all cases because it's difficult to figure out if "the destination directory is a subdirectory of the directory we want to copy". [ e.g. because of ignored cases differences, or use of different names to refer to the same directory, because of MICROS~1 mangling. ] Of course checking if two directories are one and the same isn't that easy to do it reliably either (e.g. for lack of inodes on Windows systems, and actually I'm not sure what happens if we refer to the same dir via two different mount points, using GNU/Linux's "bind" mounts, or mounting dirs multiple times). I guess the two options aren't mutually exclusive, so it's probably worth doing a first check before starting the whole operation (trying to find out if the destination is a parent of the source based on file-truename), and then adding another check in the recursive loop to try and detect inf-loops. Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 23 01:17:54 2012 Received: (at 10489) by debbugs.gnu.org; 23 Feb 2012 06:17:54 +0000 Received: from localhost ([127.0.0.1]:51800 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0S01-00082s-MU for submit@debbugs.gnu.org; Thu, 23 Feb 2012 01:17:54 -0500 Received: from mail-we0-f172.google.com ([74.125.82.172]:33332) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0Rzx-00082d-PG for 10489@debbugs.gnu.org; Thu, 23 Feb 2012 01:17:51 -0500 Received: by werg1 with SMTP id g1so524588wer.3 for <10489@debbugs.gnu.org>; Wed, 22 Feb 2012 22:15:17 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.83.70 as permitted sender) client-ip=10.180.83.70; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.83.70 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.180.83.70]) by 10.180.83.70 with SMTP id o6mr2782700wiy.19.1329977717744 (num_hops = 1); Wed, 22 Feb 2012 22:15:17 -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=n+Gj73As+EzoaJwadS8l6LuLbNzF+di+Kex1DTrz5Tc=; b=yCZFOe0lPto9PIcrGGWo29NjLUmrwj7ezvGPwViP1Sk+xfrnwdW3Xrh/4SsecdT5JU LjUtjpug5iSsbdFJuwSIRNC9BNMv6iFnEFzq1Da1kulL0vcNLWirs9MiTby8mWzV2rb+ viDAWJy9lnJQlF6FB0mlgw7gafISBU78b2i1Q= Received: by 10.180.83.70 with SMTP id o6mr2307492wiy.19.1329977717689; Wed, 22 Feb 2012 22:15:17 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id ft8sm2123174wib.11.2012.02.22.22.15.15 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 22 Feb 2012 22:15:16 -0800 (PST) From: Thierry Volpiatto To: Stefan Monnier Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <83fwfik92e.fsf@gnu.org> <87mx9q1sz7.fsf@gmail.com> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> <871uqzn3bc.fsf@gmx.de> <871uqz651u.fsf@gmx.de> <87pqd89lh4.fsf@gmail.com> <87mx8b3nvb.fsf@gmail.com> <87pqd6wnvv.fsf@gmail.com> Date: Thu, 23 Feb 2012 07:15:13 +0100 In-Reply-To: (Stefan Monnier's message of "Wed, 22 Feb 2012 17:00:08 -0500") Message-ID: <87linuvzwu.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Stefan Monnier writes: >> Ok, that is true for the solutions you propose below, but what's wrong >> with the solution I have proposed: >> Just checking if the destination directory is a subdirectory of the >> directory we want to copy. > > It's not a bad plan, but it's difficult to make it catch all cases > because it's difficult to figure out if "the destination directory is > a subdirectory of the directory we want to copy". > [ e.g. because of ignored cases differences, or use of different names > to refer to the same directory, because of MICROS~1 mangling. ] The function I sent works also on Windos, but yes maybe there is cases where it doesn't work, don't know. Would be nice if somebody find some use cases where it fails on windows. > Of course checking if two directories are one and the same isn't that > easy to do it reliably either (e.g. for lack of inodes on Windows > systems, and actually I'm not sure what happens if we refer to the same > dir via two different mount points, using GNU/Linux's "bind" mounts, or > mounting dirs multiple times). Hmm, didn't try that, recipe welcome. > I guess the two options aren't mutually exclusive, so it's probably > worth doing a first check before starting the whole operation (trying > to find out if the destination is a parent of the source based on > file-truename), and then adding another check in the recursive loop to > try and detect inf-loops. That seem good option, so actually only code to detect inf-loops is missing to achieve that? -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 23 11:04:35 2012 Received: (at 10489) by debbugs.gnu.org; 23 Feb 2012 16:04:35 +0000 Received: from localhost ([127.0.0.1]:52907 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0b9m-00074x-Ik for submit@debbugs.gnu.org; Thu, 23 Feb 2012 11:04:35 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:47229) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0b9j-00074f-8p for 10489@debbugs.gnu.org; Thu, 23 Feb 2012 11:04:33 -0500 Received: by wibhm9 with SMTP id hm9so855859wib.3 for <10489@debbugs.gnu.org>; Thu, 23 Feb 2012 08:01:56 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.101.37 as permitted sender) client-ip=10.180.101.37; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.101.37 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.180.101.37]) by 10.180.101.37 with SMTP id fd5mr4878048wib.1.1330012916494 (num_hops = 1); Thu, 23 Feb 2012 08:01:56 -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=O5mA/wf3uw9ONxB7zXz+/7kbbWIg4dMoMQQABbviSnQ=; b=lNpigkOwdpV1AjXC9b0kn/xSotgfZAuyZfFeYhWKcOpGvE07DqIDX0wGRIY/vk7YGF etWTRQy7zN30G9TqFmdJZp/JNCKiUfrxZya6ITkwzdXv6QCpWjCpUuntGQUl9rSyc4Ro VlA+0ON6vXXxpT7Ekai2vFXKP3aghO5WNdgxk= Received: by 10.180.101.37 with SMTP id fd5mr3984385wib.1.1330012916388; Thu, 23 Feb 2012 08:01:56 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id hb10sm8326974wib.10.2012.02.23.08.01.53 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 23 Feb 2012 08:01:55 -0800 (PST) From: Thierry Volpiatto To: Stefan Monnier Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <83fwfik92e.fsf@gnu.org> <87mx9q1sz7.fsf@gmail.com> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> <871uqzn3bc.fsf@gmx.de> <871uqz651u.fsf@gmx.de> <87pqd89lh4.fsf@gmail.com> <87mx8b3nvb.fsf@gmail.com> <87pqd6wnvv.fsf@gmail.com> Date: Thu, 23 Feb 2012 17:01:51 +0100 In-Reply-To: (Stefan Monnier's message of "Wed, 22 Feb 2012 17:00:08 -0500") Message-ID: <87d395y1w0.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Stefan Monnier writes: >> Ok, that is true for the solutions you propose below, but what's wrong >> with the solution I have proposed: >> Just checking if the destination directory is a subdirectory of the >> directory we want to copy. > > It's not a bad plan, but it's difficult to make it catch all cases > because it's difficult to figure out if "the destination directory is > a subdirectory of the directory we want to copy". > [ e.g. because of ignored cases differences, or use of different names > to refer to the same directory, because of MICROS~1 mangling. ] > > Of course checking if two directories are one and the same isn't that > easy to do it reliably either (e.g. for lack of inodes on Windows > systems, and actually I'm not sure what happens if we refer to the same > dir via two different mount points, using GNU/Linux's "bind" mounts, or > mounting dirs multiple times). > > I guess the two options aren't mutually exclusive, so it's probably > worth doing a first check before starting the whole operation (trying > to find out if the destination is a parent of the source based on > file-truename), and then adding another check in the recursive loop to > try and detect inf-loops. Here a first shot of `copy-directory', with the first check disabled (file-subdir-of-p) to test the detection of the inf-loop, can you have a look? --8<---------------cut here---------------start------------->8--- (defvar copy-directory-newdir-inode nil) (defun copy-directory (directory newname &optional keep-time parents copy-contents) "Copy DIRECTORY to NEWNAME. Both args must be strings. This function always sets the file modes of the output files to match the corresponding input file. The third arg KEEP-TIME non-nil means give the output files the same last-modified time as the old ones. (This works on only some systems.) A prefix arg makes KEEP-TIME non-nil. Noninteractively, the last argument PARENTS says whether to create parent directories if they don't exist. Interactively, this happens by default. If NEWNAME names an existing directory, copy DIRECTORY as a subdirectory there. However, if called from Lisp with a non-nil optional argument COPY-CONTENTS, copy the contents of DIRECTORY directly into NEWNAME instead." (interactive (let ((dir (read-directory-name "Copy directory: " default-directory default-directory t nil))) (list dir (read-directory-name (format "Copy directory %s to: " dir) default-directory default-directory nil nil) current-prefix-arg t nil))) ;; (when (or (files-equal-p directory newname) ;; (file-subdir-of-p newname directory)) ;; (error "Can't copy directory `%s' on itself" directory)) ;; If default-directory is a remote directory, make sure we find its ;; copy-directory handler. (unwind-protect (let ((handler (or (find-file-name-handler directory 'copy-directory) (find-file-name-handler newname 'copy-directory)))) (if handler (funcall handler 'copy-directory directory newname keep-time parents) ;; Compute target name. (setq directory (file-truename (directory-file-name (expand-file-name directory))) newname (file-truename (directory-file-name (expand-file-name newname)))) ;(setq copy-directory-newdir-inode (file-attributes newname)) (cond ((not (file-directory-p newname)) ;; If NEWNAME is not an existing directory, create it; ;; that is where we will copy the files of DIRECTORY. (make-directory newname parents)) ;; If NEWNAME is an existing directory and COPY-CONTENTS ;; is nil, copy into NEWNAME/[DIRECTORY-BASENAME]. ((not copy-contents) (setq newname (expand-file-name (file-name-nondirectory (directory-file-name directory)) newname)) (and (file-exists-p newname) (not (file-directory-p newname)) (error "Cannot overwrite non-directory %s with a directory" newname)) (make-directory newname t) (unless copy-directory-newdir-inode (setq copy-directory-newdir-inode (nth 10 (file-attributes newname)))))) ;; Copy recursively. (dolist (file ;; We do not want to copy "." and "..". (directory-files directory 'full directory-files-no-dot-files-regexp)) (assert (not (equal (nth 10 (file-attributes file)) copy-directory-newdir-inode)) nil "Hit inf-loop at `%s'" file) (if (file-directory-p file) (copy-directory file newname keep-time parents) (let ((target (expand-file-name (file-name-nondirectory file) newname)) (attrs (file-attributes file))) (if (stringp (car attrs)) ; Symbolic link (make-symbolic-link (car attrs) target t) (copy-file file target t keep-time))))) ;; Set directory attributes. (let ((modes (file-modes directory)) (times (and keep-time (nth 5 (file-attributes directory))))) (if modes (set-file-modes newname modes)) (if times (set-file-times newname times))))) (setq copy-directory-newdir-inode nil))) --8<---------------cut here---------------end--------------->8--- -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 23 12:21:30 2012 Received: (at 10489) by debbugs.gnu.org; 23 Feb 2012 17:21:30 +0000 Received: from localhost ([127.0.0.1]:52933 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0cME-0000VG-6f for submit@debbugs.gnu.org; Thu, 23 Feb 2012 12:21:30 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.183]:35228) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0cMA-0000V0-TL for 10489@debbugs.gnu.org; Thu, 23 Feb 2012 12:21:28 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoIFAKU/KE9Ld/XJ/2dsb2JhbACBX4I9mj55iHCXTYZMgSuDZ4EHBIZQlEmECw X-IronPort-AV: E=Sophos;i="4.73,1,1325480400"; d="scan'208";a="164341416" Received: from 75-119-245-201.dsl.teksavvy.com (HELO pastel.home) ([75.119.245.201]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 23 Feb 2012 12:18:51 -0500 Received: by pastel.home (Postfix, from userid 20848) id 7E5D158EC6; Thu, 23 Feb 2012 12:18:51 -0500 (EST) From: Stefan Monnier To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Message-ID: References: <87mx9su32g.fsf@web.de> <87mx9q1sz7.fsf@gmail.com> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> <871uqzn3bc.fsf@gmx.de> <871uqz651u.fsf@gmx.de> <87pqd89lh4.fsf@gmail.com> <87mx8b3nvb.fsf@gmail.com> <87pqd6wnvv.fsf@gmail.com> <87d395y1w0.fsf@gmail.com> Date: Thu, 23 Feb 2012 12:18:51 -0500 In-Reply-To: <87d395y1w0.fsf@gmail.com> (Thierry Volpiatto's message of "Thu, 23 Feb 2012 17:01:51 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) > Here a first shot of `copy-directory', with the first check disabled > (file-subdir-of-p) to test the detection of the inf-loop, can you have a > look? I think we can install the file-subdir-of-p test now and leave the rest for 24.2. Can you (re)send the corresponding patch? Note that (or (files-equal-p directory newname) (file-subdir-of-p newname directory)) should be replaced by just (file-subdir-of-p newname directory), because this primitive should be a "=E2=8A=86" rather than "=E2=8A=82". > --8<---------------cut here---------------start------------->8--- I always prefer a patch rather than the resulting code, so I don't have to look for the source code to see what's changed. Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 23 17:13:03 2012 Received: (at 10489) by debbugs.gnu.org; 23 Feb 2012 22:13:03 +0000 Received: from localhost ([127.0.0.1]:53089 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0guM-0007kg-Mi for submit@debbugs.gnu.org; Thu, 23 Feb 2012 17:13:03 -0500 Received: from mail-we0-f172.google.com ([74.125.82.172]:56380) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0guI-0007k5-OB for 10489@debbugs.gnu.org; Thu, 23 Feb 2012 17:13:00 -0500 Received: by werg1 with SMTP id g1so1090882wer.3 for <10489@debbugs.gnu.org>; Thu, 23 Feb 2012 14:10:22 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.86.230 as permitted sender) client-ip=10.180.86.230; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.86.230 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.180.86.230]) by 10.180.86.230 with SMTP id s6mr436585wiz.16.1330035022990 (num_hops = 1); Thu, 23 Feb 2012 14:10:22 -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=FAT5+68DKxUJpQPqhNhxu7hvDPZ9jksftodE8WBhXns=; b=FyhxQhA3nPd2QYdIBb4/SXT0/YUXD07qe3VhomNBu7QQ3Fx9EoxAY030QQUnS8zWJr HfT7YTkv/u9DsHQMC6OsG20nDv2Y8XVrhMHvRqAk8DDrFLD65NUuEd1mfMS6A7SjRHRL FhRYXWoZquTkJUAmVio75LFsav8jsFojTSFh8= Received: by 10.180.86.230 with SMTP id s6mr350928wiz.16.1330035022920; Thu, 23 Feb 2012 14:10:22 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id fw5sm7159757wib.0.2012.02.23.14.10.20 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 23 Feb 2012 14:10:21 -0800 (PST) From: Thierry Volpiatto To: Stefan Monnier Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> <871uqzn3bc.fsf@gmx.de> <871uqz651u.fsf@gmx.de> <87pqd89lh4.fsf@gmail.com> <87mx8b3nvb.fsf@gmail.com> <87pqd6wnvv.fsf@gmail.com> <87d395y1w0.fsf@gmail.com> Date: Thu, 23 Feb 2012 23:10:18 +0100 In-Reply-To: (Stefan Monnier's message of "Thu, 23 Feb 2012 12:18:51 -0500") Message-ID: <874nuhxktx.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Stefan Monnier writes: >> Here a first shot of `copy-directory', with the first check disabled >> (file-subdir-of-p) to test the detection of the inf-loop, can you have a >> look? > > I think we can install the file-subdir-of-p test now and leave the rest > for 24.2. Can you (re)send the corresponding patch? Note that > (or (files-equal-p directory newname) > (file-subdir-of-p newname directory)) > should be replaced by just (file-subdir-of-p newname directory), because > this primitive should be a "=E2=8A=86" rather than "=E2=8A=82". Done, you should have received the patch.=20 > > I always prefer a patch rather than the resulting code, so I don't have > to look for the source code to see what's changed. Ok, here the patch for only `copy-directory' with the check by `file-subdir-of-p' disabled for testing purpose. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=Singlepatch-r118952ToTip.patch Content-Description: copy-directory ##Merge of all patches applied from revision 118951 ## patch-r118952: Return Error when trying to copy a directory on itself. ## patch-r118953: * lisp/files.el (copy-directory): Improve error message. ## diff --git a/lisp/files.el b/lisp/files.el --- a/lisp/files.el +++ b/lisp/files.el @@ -4935,6 +4935,7 @@ (equal (file-attributes (file-truename root)) (file-attributes f2)))))) +(defvar copy-directory-newdir-inode nil) (defun copy-directory (directory newname &optional keep-time parents copy-contents) "Copy DIRECTORY to NEWNAME. Both args must be strings. This function always sets the file modes of the output files to match @@ -4961,54 +4962,63 @@ (format "Copy directory %s to: " dir) default-directory default-directory nil nil) current-prefix-arg t nil))) - (when (file-subdir-of-p newname directory) - (error "Can't copy directory `%s' on itself" directory)) + ;; (when (file-subdir-of-p newname directory) + ;; (error "Can't copy directory `%s' on itself" directory)) ;; If default-directory is a remote directory, make sure we find its ;; copy-directory handler. - (let ((handler (or (find-file-name-handler directory 'copy-directory) - (find-file-name-handler newname 'copy-directory)))) - (if handler - (funcall handler 'copy-directory directory newname keep-time parents) - - ;; Compute target name. - (setq directory (directory-file-name (expand-file-name directory)) - newname (directory-file-name (expand-file-name newname))) - - (cond ((not (file-directory-p newname)) - ;; If NEWNAME is not an existing directory, create it; - ;; that is where we will copy the files of DIRECTORY. - (make-directory newname parents)) - ;; If NEWNAME is an existing directory and COPY-CONTENTS - ;; is nil, copy into NEWNAME/[DIRECTORY-BASENAME]. - ((not copy-contents) - (setq newname (expand-file-name - (file-name-nondirectory - (directory-file-name directory)) - newname)) - (and (file-exists-p newname) - (not (file-directory-p newname)) - (error "Cannot overwrite non-directory %s with a directory" - newname)) - (make-directory newname t))) - - ;; Copy recursively. - (dolist (file - ;; We do not want to copy "." and "..". - (directory-files directory 'full - directory-files-no-dot-files-regexp)) - (if (file-directory-p file) - (copy-directory file newname keep-time parents) - (let ((target (expand-file-name (file-name-nondirectory file) newname)) - (attrs (file-attributes file))) - (if (stringp (car attrs)) ; Symbolic link - (make-symbolic-link (car attrs) target t) - (copy-file file target t keep-time))))) - - ;; Set directory attributes. - (let ((modes (file-modes directory)) - (times (and keep-time (nth 5 (file-attributes directory))))) - (if modes (set-file-modes newname modes)) - (if times (set-file-times newname times)))))) + (unwind-protect + (let ((handler (or (find-file-name-handler directory 'copy-directory) + (find-file-name-handler newname 'copy-directory)))) + (if handler + (funcall handler 'copy-directory directory newname keep-time parents) + + ;; Compute target name. + (setq directory (file-truename (directory-file-name (expand-file-name directory))) + newname (file-truename (directory-file-name (expand-file-name newname)))) + (cond ((not (file-directory-p newname)) + ;; If NEWNAME is not an existing directory, create it; + ;; that is where we will copy the files of DIRECTORY. + (make-directory newname parents)) + ;; If NEWNAME is an existing directory and COPY-CONTENTS + ;; is nil, copy into NEWNAME/[DIRECTORY-BASENAME]. + ((not copy-contents) + (setq newname (expand-file-name + (file-name-nondirectory + (directory-file-name directory)) + newname)) + + (and (file-exists-p newname) + (not (file-directory-p newname)) + (error "Cannot overwrite non-directory %s with a directory" + newname)) + (make-directory newname t) + (unless copy-directory-newdir-inode + (setq copy-directory-newdir-inode (nth 10 (file-attributes newname)))))) + + ;; Copy recursively. + (dolist (file + ;; We do not want to copy "." and "..". + (directory-files directory 'full + directory-files-no-dot-files-regexp)) + (assert (not (equal (nth 10 (file-attributes file)) + copy-directory-newdir-inode)) + nil "Unable to create directory `%s' in itself `%s'" + (file-name-nondirectory (directory-file-name file)) + (file-name-directory (directory-file-name newname))) + (if (file-directory-p file) + (copy-directory file newname keep-time parents) + (let ((target (expand-file-name (file-name-nondirectory file) newname)) + (attrs (file-attributes file))) + (if (stringp (car attrs)) ; Symbolic link + (make-symbolic-link (car attrs) target t) + (copy-file file target t keep-time))))) + + ;; Set directory attributes. + (let ((modes (file-modes directory)) + (times (and keep-time (nth 5 (file-attributes directory))))) + (if modes (set-file-modes newname modes)) + (if times (set-file-times newname times))))) + (setq copy-directory-newdir-inode nil))) (put 'revert-buffer-function 'permanent-local t) (defvar revert-buffer-function nil --=-=-= Content-Type: text/plain -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 00:40:19 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 05:40:19 +0000 Received: from localhost ([127.0.0.1]:53236 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0nt8-0003WB-I7 for submit@debbugs.gnu.org; Fri, 24 Feb 2012 00:40:16 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:51283) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0nt2-0003Vl-DT for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 00:40:12 -0500 Received: by wibhm9 with SMTP id hm9so1203811wib.3 for <10489@debbugs.gnu.org>; Thu, 23 Feb 2012 21:37:30 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.78.130 as permitted sender) client-ip=10.180.78.130; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.78.130 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.180.78.130]) by 10.180.78.130 with SMTP id b2mr1813469wix.1.1330061850892 (num_hops = 1); Thu, 23 Feb 2012 21:37:30 -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=3k9R9LJuiYzWlPbTlRKzHaWblYdYOILTjUmFZDovJgE=; b=R6ORJQdRAT+ntnsfBIiVOq5tj6prf7nGBFbO5b+7cgGWALBjz8/HhSq5n3sviVKU1O NxglgKtFgO/JlmS34qg47R/Djnzbu+nYjCf1EWlyTuq0hEHm6YKX8+dw8MMnf/RUjGXk R6J7SzhfdBs5oi7H5/Yg4OZz/aZ0QIPwRCZts= Received: by 10.180.78.130 with SMTP id b2mr1488454wix.1.1330061850787; Thu, 23 Feb 2012 21:37:30 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id h19sm1090881wiw.9.2012.02.23.21.37.28 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 23 Feb 2012 21:37:29 -0800 (PST) From: Thierry Volpiatto To: Stefan Monnier Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87vcodm8ns.fsf@gmx.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> <871uqzn3bc.fsf@gmx.de> <871uqz651u.fsf@gmx.de> <87pqd89lh4.fsf@gmail.com> <87mx8b3nvb.fsf@gmail.com> <87pqd6wnvv.fsf@gmail.com> <87d395y1w0.fsf@gmail.com> Date: Fri, 24 Feb 2012 06:37:26 +0100 In-Reply-To: (Stefan Monnier's message of "Thu, 23 Feb 2012 12:18:51 -0500") Message-ID: <87zkc8x04p.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Stefan Monnier writes: > I think we can install the file-subdir-of-p test now and leave the rest > for 24.2. Can you (re)send the corresponding patch? Note that > (or (files-equal-p directory newname) > (file-subdir-of-p newname directory)) > should be replaced by just (file-subdir-of-p newname directory), because > this primitive should be a "=E2=8A=86" rather than "=E2=8A=82". I have removed one more occurence of `files-equal-p' no more needed in dired-aux.el. So this function is not needed actually; I have not removed it though. Maybe I should and add it only after 24.1? --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=patch-r118916.patch Content-Description: dired-create-files modif # HG changeset patch # User Thierry Volpiatto # Date 1330061336 -3600 # Node ID b41b1ec2b6dbe7fa96efa4b1a0dcb3be8133a46c # Parent c136fe29a3a316a56bae9c9d8dec2d8add468d48 Fix bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy. * lisp/files.el (files-equal-p): New, simple equality check between two filename. (file-subdir-of-p): New, Check if file1 is subdir of file2. (copy-directory): Return error when trying to copy a directory on itself. * lisp/dired-aux.el (dired-copy-file-recursive): Same. (dired-create-files): Modify destination when source is equal to dest when copying files. Return also when dest is a subdir of source. diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1264,24 +1264,26 @@ (defun dired-copy-file-recursive (from to ok-flag &optional preserve-time top recursive) + (when (file-subdir-of-p to from) + (error "Can't copy directory `%s' on itself" from)) (let ((attrs (file-attributes from))) (if (and recursive - (eq t (car attrs)) - (or (eq recursive 'always) - (yes-or-no-p (format "Recursive copies of %s? " from)))) - ;; This is a directory. - (copy-directory from to preserve-time) + (eq t (car attrs)) + (or (eq recursive 'always) + (yes-or-no-p (format "Recursive copies of %s? " from)))) + ;; This is a directory. + (copy-directory from to preserve-time) ;; Not a directory. (or top (dired-handle-overwrite to)) (condition-case err - (if (stringp (car attrs)) - ;; It is a symlink - (make-symbolic-link (car attrs) to ok-flag) - (copy-file from to ok-flag preserve-time)) - (file-date-error - (push (dired-make-relative from) - dired-create-files-failures) - (dired-log "Can't set date on %s:\n%s\n" from err)))))) + (if (stringp (car attrs)) + ;; It is a symlink + (make-symbolic-link (car attrs) to ok-flag) + (copy-file from to ok-flag preserve-time)) + (file-date-error + (push (dired-make-relative from) + dired-create-files-failures) + (dired-log "Can't set date on %s:\n%s\n" from err)))))) ;;;###autoload (defun dired-rename-file (file newname ok-if-already-exists) @@ -1378,7 +1380,7 @@ ;; The basic function for half a dozen variations on cp/mv/ln/ln -s. (defun dired-create-files (file-creator operation fn-list name-constructor - &optional marker-char) + &optional marker-char) "Create one or more new files from a list of existing files FN-LIST. This function also handles querying the user, updating Dired buffers, and displaying a success or failure message. @@ -1401,10 +1403,14 @@ Optional MARKER-CHAR is a character with which to mark every newfile's entry, or t to use the current marker character if the old file was marked." - (let (dired-create-files-failures failures - skipped (success-count 0) (total (length fn-list))) - (let (to overwrite-query - overwrite-backup-query) ; for dired-handle-overwrite + (let (dired-create-files-failures + failures + skipped + (success-count 0) + (total (length fn-list))) + (let (to + overwrite-query + overwrite-backup-query) ; for dired-handle-overwrite (dolist (from fn-list) (setq to (funcall name-constructor from)) (if (equal to from) @@ -1430,10 +1436,26 @@ (cond ((integerp marker-char) marker-char) (marker-char (dired-file-marker from)) ; slow (t nil)))) - (when (and (file-directory-p from) - (file-directory-p to) - (eq file-creator 'dired-copy-file)) - (setq to (file-name-directory to))) + ;; Handle the `dired-copy-file' file-creator specially + ;; When copying a directory to another directory or + ;; possibly to itself. + ;; (e.g "~/foo" => "~/test" or "~/foo" =>"~/foo") + ;; In this case the 'name-constructor' have set the destination + ;; 'to' to "~/test/foo" because the old + ;; emacs23 behavior of `copy-directory' + ;; was no not create the subdir and copy instead the contents only. + ;; With it's new behavior (similar to cp shell command) we don't + ;; need such a construction, so modify the destination 'to' to + ;; "~/test/" instead of "~/test/foo/". + ;; If from and to are the same directory do the same, + ;; the error will be handled by `dired-copy-file-recursive'. + (let ((destname (file-name-directory to))) + (when (and (file-directory-p from) + (file-directory-p to) + (eq file-creator 'dired-copy-file)) + (setq to destname)) + (and (file-subdir-of-p destname from) + (error "Can't copy directory `%s' on itself" from))) (condition-case err (progn (funcall file-creator from to dired-overwrite-confirmed) @@ -1456,25 +1478,25 @@ (setq failures (nconc failures dired-create-files-failures)) (dired-log-summary (format "%s failed for %d file%s in %d requests" - operation (length failures) - (dired-plural-s (length failures)) - total) + operation (length failures) + (dired-plural-s (length failures)) + total) failures)) (failures (dired-log-summary (format "%s failed for %d of %d file%s" - operation (length failures) - total (dired-plural-s total)) + operation (length failures) + total (dired-plural-s total)) failures)) (skipped (dired-log-summary (format "%s: %d of %d file%s skipped" - operation (length skipped) total - (dired-plural-s total)) + operation (length skipped) total + (dired-plural-s total)) skipped)) (t (message "%s: %s file%s" - operation success-count (dired-plural-s success-count))))) + operation success-count (dired-plural-s success-count))))) (dired-move-to-filename)) (defun dired-do-create-files (op-symbol file-creator operation arg diff --git a/lisp/files.el b/lisp/files.el --- a/lisp/files.el +++ b/lisp/files.el @@ -510,36 +510,14 @@ (other :tag "Query" other)) :group 'find-file) -;; This is an odd variable IMO. -;; You might wonder why it is needed, when we could just do: -;; (set (make-local-variable 'enable-local-variables) nil) -;; These two are not precisely the same. -;; Setting this variable does not cause -*- mode settings to be -;; ignored, whereas setting enable-local-variables does. -;; Only three places in Emacs use this variable: tar and arc modes, -;; and rmail. The first two don't need it. They already use -;; inhibit-local-variables-regexps, which is probably enough, and -;; could also just set enable-local-variables locally to nil. -;; Them setting it has the side-effect that dir-locals cannot apply to -;; eg tar files (?). FIXME Is this appropriate? -;; AFAICS, rmail is the only thing that needs this, and the only -;; reason it uses it is for BABYL files (which are obsolete). -;; These contain "-*- rmail -*-" in the first line, which rmail wants -;; to respect, so that find-file on a BABYL file will switch to -;; rmail-mode automatically (this is nice, but hardly essential, -;; since most people are used to explicitly running a command to -;; access their mail; M-x gnus etc). Rmail files may happen to -;; contain Local Variables sections in messages, which Rmail wants to -;; ignore. So AFAICS the only reason this variable exists is for a -;; minor convenience feature for handling of an obsolete Rmail file format. (defvar local-enable-local-variables t "Like `enable-local-variables' but meant for buffer-local bindings. The meaningful values are nil and non-nil. The default is non-nil. If a major mode sets this to nil, buffer-locally, then any local -variables list in a file visited in that mode will be ignored. - -This variable does not affect the use of major modes specified -in a -*- line.") +variables list in the file will be ignored. + +This variable does not affect the use of major modes +specified in a -*- line.") (defcustom enable-local-eval 'maybe "Control processing of the \"variable\" `eval' in a file's local variables. @@ -981,18 +959,20 @@ (defcustom remote-file-name-inhibit-cache 10 "Whether to use the remote file-name cache for read access. -When `nil', never expire cached values (caution) -When `t', never use the cache (safe, but may be slow) -A number means use cached values for that amount of seconds since caching. - -The attributes of remote files are cached for better performance. -If they are changed outside of Emacs's control, the cached values -become invalid, and must be reread. If you are sure that nothing -other than Emacs changes the files, you can set this variable to `nil'. - -If a remote file is checked regularly, it might be a good idea to -let-bind this variable to a value less than the interval between -consecutive checks. For example: + +When `nil', always use the cached values. +When `t', never use them. +A number means use them for that amount of seconds since they were +cached. + +File attributes of remote files are cached for better performance. +If they are changed out of Emacs' control, the cached values +become invalid, and must be invalidated. + +In case a remote file is checked regularly, it might be +reasonable to let-bind this variable to a value less then the +time period between two checks. +Example: (defun display-time-file-nonempty-p (file) (let ((remote-file-name-inhibit-cache (- display-time-interval 5))) @@ -2425,6 +2405,9 @@ calling FUNCTION (if it's not nil), we delete the suffix that matched REGEXP and search the list again for another match. +If the file name matches `inhibit-first-line-modes-regexps', +then `auto-mode-alist' is not processed. + The extensions whose FUNCTION is `archive-mode' should also appear in `auto-coding-alist' with `no-conversion' coding system. @@ -2495,55 +2478,16 @@ See also `auto-mode-alist'.") -(define-obsolete-variable-alias 'inhibit-first-line-modes-regexps - 'inhibit-file-local-variables-regexps "24.1") - -;; TODO really this should be a list of modes (eg tar-mode), not regexps, -;; because we are duplicating info from auto-mode-alist. -;; TODO many elements of this list are also in auto-coding-alist. -(defvar inhibit-local-variables-regexps - (mapcar 'purecopy '("\\.tar\\'" "\\.t[bg]z\\'" - "\\.arc\\'" "\\.zip\\'" "\\.lzh\\'" "\\.lha\\'" - "\\.zoo\\'" "\\.[jew]ar\\'" "\\.xpi\\'" "\\.rar\\'" - "\\.7z\\'" - "\\.sx[dmicw]\\'" "\\.odt\\'" - "\\.tiff?\\'" "\\.gif\\'" "\\.png\\'" "\\.jpe?g\\'")) - "List of regexps matching file names in which to ignore local variables. -This includes `-*-' lines as well as trailing \"Local Variables\" sections. -Files matching this list are typically binary file formats. -They may happen to contain sequences that look like local variable -specifications, but are not really, or they may be containers for -member files with their own local variable sections, which are -not appropriate for the containing file. -See also `inhibit-local-variables-suffixes'.") - -(define-obsolete-variable-alias 'inhibit-first-line-modes-suffixes - 'inhibit-local-variables-suffixes "24.1") - -(defvar inhibit-local-variables-suffixes nil - "List of regexps matching suffixes to remove from file names. -When checking `inhibit-local-variables-regexps', we first discard +(defvar inhibit-first-line-modes-regexps + (mapcar 'purecopy '("\\.tar\\'" "\\.tgz\\'" "\\.tiff?\\'" + "\\.gif\\'" "\\.png\\'" "\\.jpe?g\\'")) + "List of regexps; if one matches a file name, don't look for `-*-'.") + +(defvar inhibit-first-line-modes-suffixes nil + "List of regexps for what to ignore, for `inhibit-first-line-modes-regexps'. +When checking `inhibit-first-line-modes-regexps', we first discard from the end of the file name anything that matches one of these regexps.") -;; TODO explicitly add case-fold-search t? -(defun inhibit-local-variables-p () - "Return non-nil if file local variables should be ignored. -This checks the file (or buffer) name against `inhibit-local-variables-regexps' -and `inhibit-local-variables-suffixes'." - (let ((temp inhibit-local-variables-regexps) - (name (if buffer-file-name - (file-name-sans-versions buffer-file-name) - (buffer-name)))) - (while (let ((sufs inhibit-local-variables-suffixes)) - (while (and sufs (not (string-match (car sufs) name))) - (setq sufs (cdr sufs))) - sufs) - (setq name (substring name 0 (match-beginning 0)))) - (while (and temp - (not (string-match (car temp) name))) - (setq temp (cdr temp))) - temp)) - (defvar auto-mode-interpreter-regexp (purecopy "#![ \t]?\\([^ \t\n]*\ /bin/env[ \t]\\)?\\([^ \t\n]+\\)") @@ -2606,24 +2550,21 @@ (defun set-auto-mode (&optional keep-mode-if-same) "Select major mode appropriate for current buffer. -To find the right major mode, this function checks for a -*- mode tag +To find the right major mode, this function checks for a -*- mode tag, checks for a `mode:' entry in the Local Variables section of the file, checks if it uses an interpreter listed in `interpreter-mode-alist', matches the buffer beginning against `magic-mode-alist', compares the filename against the entries in `auto-mode-alist', then matches the buffer beginning against `magic-fallback-mode-alist'. -If `enable-local-variables' is nil, or if the file name matches -`inhibit-local-variables-regexps', this function does not check -for any mode: tag anywhere in the file. If `local-enable-local-variables' -is nil, then the only mode: tag that can be relevant is a -*- one. +If `enable-local-variables' is nil, this function does not check for +any mode: tag anywhere in the file. If the optional argument KEEP-MODE-IF-SAME is non-nil, then we set the major mode only if that would change it. In other words we don't actually set it to the same mode the buffer already has." ;; Look for -*-MODENAME-*- or -*- ... mode: MODENAME; ... -*- - (let ((try-locals (not (inhibit-local-variables-p))) - end done mode modes) + (let (end done mode modes) ;; Once we drop the deprecated feature where mode: is also allowed to ;; specify minor-modes (ie, there can be more than one "mode:"), we can ;; remove this section and just let (hack-local-variables t) handle it. @@ -2631,9 +2572,7 @@ (save-excursion (goto-char (point-min)) (skip-chars-forward " \t\n") - ;; Note by design local-enable-local-variables does not matter here. (and enable-local-variables - try-locals (setq end (set-auto-mode-1)) (if (save-excursion (search-forward ":" end t)) ;; Find all specifications for the `mode:' variable @@ -2664,12 +2603,8 @@ (or (set-auto-mode-0 mode keep-mode-if-same) ;; continuing would call minor modes again, toggling them off (throw 'nop nil)))))) - ;; hack-local-variables checks local-enable-local-variables etc, but - ;; we might as well be explicit here for the sake of clarity. (and (not done) enable-local-variables - local-enable-local-variables - try-locals (setq mode (hack-local-variables t)) (not (memq mode modes)) ; already tried and failed (if (not (functionp mode)) @@ -2779,24 +2714,38 @@ (defun set-auto-mode-1 () "Find the -*- spec in the buffer. Call with point at the place to start searching from. -If one is found, set point to the beginning and return the position -of the end. Otherwise, return nil; may change point. -The variable `inhibit-local-variables-regexps' can cause a -*- spec to -be ignored; but `enable-local-variables' and `local-enable-local-variables' -have no effect." +If one is found, set point to the beginning +and return the position of the end. +Otherwise, return nil; point may be changed." (let (beg end) (and ;; Don't look for -*- if this file name matches any - ;; of the regexps in inhibit-local-variables-regexps. - (not (inhibit-local-variables-p)) + ;; of the regexps in inhibit-first-line-modes-regexps. + (let ((temp inhibit-first-line-modes-regexps) + (name (if buffer-file-name + (file-name-sans-versions buffer-file-name) + (buffer-name)))) + (while (let ((sufs inhibit-first-line-modes-suffixes)) + (while (and sufs (not (string-match (car sufs) name))) + (setq sufs (cdr sufs))) + sufs) + (setq name (substring name 0 (match-beginning 0)))) + (while (and temp + (not (string-match (car temp) name))) + (setq temp (cdr temp))) + (not temp)) + (search-forward "-*-" (line-end-position - ;; If the file begins with "#!" (exec - ;; interpreter magic), look for mode frobs - ;; in the first two lines. You cannot - ;; necessarily put them in the first line - ;; of such a file without screwing up the - ;; interpreter invocation. The same holds - ;; for '\" in man pages (preprocessor + ;; If the file begins with "#!" + ;; (exec interpreter magic), look + ;; for mode frobs in the first two + ;; lines. You cannot necessarily + ;; put them in the first line of + ;; such a file without screwing up + ;; the interpreter invocation. + ;; The same holds for + ;; '\" + ;; in man pages (preprocessor ;; magic for the `man' program). (and (looking-at "^\\(#!\\|'\\\\\"\\)") 2)) t) (progn @@ -3141,41 +3090,19 @@ If MODE-ONLY is non-nil, all we do is check whether a \"mode:\" is specified, and return the corresponding mode symbol, or nil. In this case, we try to ignore minor-modes, and only return a -major-mode. - -If `enable-local-variables' or `local-enable-local-variables' is nil, -this function does nothing. If `inhibit-local-variables-regexps' -applies to the file in question, the file is not scanned for -local variables, but directory-local variables may still be applied." - ;; We don't let inhibit-local-variables-p influence the value of - ;; enable-local-variables, because then it would affect dir-local - ;; variables. We don't want to search eg tar files for file local - ;; variable sections, but there is no reason dir-locals cannot apply - ;; to them. The real meaning of inhibit-local-variables-p is "do - ;; not scan this file for local variables". +major-mode." (let ((enable-local-variables (and local-enable-local-variables enable-local-variables)) result) (unless mode-only (setq file-local-variables-alist nil) (report-errors "Directory-local variables error: %s" - ;; Note this is a no-op if enable-local-variables is nil. (hack-dir-local-variables))) - ;; This entire function is basically a no-op if enable-local-variables - ;; is nil. All it does is set file-local-variables-alist to nil. - (when enable-local-variables - ;; This part used to ignore enable-local-variables when mode-only - ;; was non-nil. That was inappropriate, eg consider the - ;; (artificial) example of: - ;; (setq local-enable-local-variables nil) - ;; Open a file foo.txt that contains "mode: sh". - ;; It correctly opens in text-mode. - ;; M-x set-visited-file name foo.c, and it incorrectly stays in text-mode. - (unless (or (inhibit-local-variables-p) - ;; If MODE-ONLY is non-nil, and the prop line specifies a - ;; mode, then we're done, and have no need to scan further. - (and (setq result (hack-local-variables-prop-line mode-only)) - mode-only)) + (when (or mode-only enable-local-variables) + ;; If MODE-ONLY is non-nil, and the prop line specifies a mode, + ;; then we're done, and have no need to scan further. + (unless (and (setq result (hack-local-variables-prop-line mode-only)) + mode-only) ;; Look for "Local variables:" line in last page. (save-excursion (goto-char (point-max)) @@ -3265,13 +3192,14 @@ (indirect-variable var)) val) result) (error nil))))) - (forward-line 1)))))))) - ;; Now we've read all the local variables. - ;; If MODE-ONLY is non-nil, return whether the mode was specified. - (if mode-only result - ;; Otherwise, set the variables. - (hack-local-variables-filter result nil) - (hack-local-variables-apply))))) + (forward-line 1))))))))) + ;; Now we've read all the local variables. + ;; If MODE-ONLY is non-nil, return whether the mode was specified. + (cond (mode-only result) + ;; Otherwise, set the variables. + (enable-local-variables + (hack-local-variables-filter result nil) + (hack-local-variables-apply))))) (defun hack-local-variables-apply () "Apply the elements of `file-local-variables-alist'. @@ -3683,7 +3611,7 @@ (interactive "FSet visited file name: ") (if (buffer-base-buffer) (error "An indirect buffer cannot visit a file")) - (let (truename old-try-locals) + (let (truename) (if filename (setq filename (if (string-equal filename "") @@ -3708,8 +3636,7 @@ (progn (and filename (lock-buffer filename)) (unlock-buffer))) - (setq old-try-locals (not (inhibit-local-variables-p)) - buffer-file-name filename) + (setq buffer-file-name filename) (if filename ; make buffer name reflect filename. (let ((new-name (file-name-nondirectory buffer-file-name))) (setq default-directory (file-name-directory buffer-file-name)) @@ -4861,13 +4788,7 @@ (defun rename-uniquely () "Rename current buffer to a similar name not already taken. This function is useful for creating multiple shell process buffers -or multiple mail buffers, etc. - -Note that some commands, in particular those based on `compilation-mode' -\(`compile', `grep', etc.) will reuse the current buffer if it has the -appropriate mode even if it has been renamed. So as well as renaming -the buffer, you also need to switch buffers before running another -instance of such commands." +or multiple mail buffers, etc." (interactive) (save-match-data (let ((base-name (buffer-name))) @@ -4985,6 +4906,35 @@ directory 'full directory-files-no-dot-files-regexp))) (delete-directory-internal directory))))) +(defun files-equal-p (file1 file2) + "Return non-nil if FILE1 and FILE2 name the same file." + (and (equal (file-remote-p file1) (file-remote-p file2)) + (equal (file-attributes (file-truename (expand-file-name file1))) + (file-attributes (file-truename (expand-file-name file2)))))) + +(defun file-subdir-of-p (file1 file2) + "Check if FILE1 is a subdirectory of FILE2 on current filesystem. +If directory FILE1 is the same than directory FILE2, return non--nil." + (when (and (not (or (file-remote-p file1) + (file-remote-p file2))) + (not (string= file1 "/")) + (file-directory-p file1) + (file-directory-p file2)) + (or (string= file2 "/") + (loop with f1 = (expand-file-name (file-truename file1)) + with f2 = (expand-file-name (file-truename file2)) + with ls1 = (split-string f1 "/" t) + with ls2 = (split-string f2 "/" t) + 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 + (equal (file-attributes (file-truename root)) + (file-attributes f2)))))) + (defun copy-directory (directory newname &optional keep-time parents copy-contents) "Copy DIRECTORY to NEWNAME. Both args must be strings. This function always sets the file modes of the output files to match @@ -5011,10 +4961,12 @@ (format "Copy directory %s to: " dir) default-directory default-directory nil nil) current-prefix-arg t nil))) + (when (file-subdir-of-p newname directory) + (error "Can't copy directory `%s' on itself" directory)) ;; If default-directory is a remote directory, make sure we find its ;; copy-directory handler. (let ((handler (or (find-file-name-handler directory 'copy-directory) - (find-file-name-handler newname 'copy-directory)))) + (find-file-name-handler newname 'copy-directory)))) (if handler (funcall handler 'copy-directory directory newname keep-time parents) @@ -5048,7 +5000,7 @@ (copy-directory file newname keep-time parents) (let ((target (expand-file-name (file-name-nondirectory file) newname)) (attrs (file-attributes file))) - (if (stringp (car attrs)) ; Symbolic link + (if (stringp (car attrs)) ; Symbolic link (make-symbolic-link (car attrs) target t) (copy-file file target t keep-time))))) @@ -5135,8 +5087,6 @@ Optional third argument PRESERVE-MODES non-nil means don't alter the files modes. Normally we reinitialize them using `normal-mode'. -This function binds `revert-buffer-in-progress-p' non-nil while it operates. - If the value of `revert-buffer-function' is non-nil, it is called to do all the work for this command. Otherwise, the hooks `before-revert-hook' and `after-revert-hook' are run at the beginning --=-=-= Content-Type: text/plain -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 02:19:20 2012 Received: (at submit) by debbugs.gnu.org; 24 Feb 2012 07:19:20 +0000 Received: from localhost ([127.0.0.1]:53298 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0pR1-0005nU-Gd for submit@debbugs.gnu.org; Fri, 24 Feb 2012 02:19:20 -0500 Received: from eggs.gnu.org ([140.186.70.92]:41441) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0pQx-0005nF-0Q for submit@debbugs.gnu.org; Fri, 24 Feb 2012 02:19:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S0pON-0002ww-LO for submit@debbugs.gnu.org; Fri, 24 Feb 2012 02:16:37 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([140.186.70.17]:51391) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0pON-0002wn-Ia for submit@debbugs.gnu.org; Fri, 24 Feb 2012 02:16:35 -0500 Received: from eggs.gnu.org ([140.186.70.92]:56490) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0pOH-0004J5-6Q for bug-gnu-emacs@gnu.org; Fri, 24 Feb 2012 02:16:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S0pOF-0002vs-2n for bug-gnu-emacs@gnu.org; Fri, 24 Feb 2012 02:16:28 -0500 Received: from plane.gmane.org ([80.91.229.3]:51613) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0pOE-0002vi-MT for bug-gnu-emacs@gnu.org; Fri, 24 Feb 2012 02:16:27 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1S0pOB-0006xd-A4 for bug-gnu-emacs@gnu.org; Fri, 24 Feb 2012 08:16:23 +0100 Received: from lbe83-2-78-243-104-167.fbx.proxad.net ([78.243.104.167]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 24 Feb 2012 08:16:23 +0100 Received: from thierry.volpiatto by lbe83-2-78-243-104-167.fbx.proxad.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 24 Feb 2012 08:16:23 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Date: Fri, 24 Feb 2012 08:16:08 +0100 Lines: 148 Message-ID: <87vcmwwvk7.fsf@gmail.com> References: <87mx9su32g.fsf@web.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> <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> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: lbe83-2-78-243-104-167.fbx.proxad.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) Cancel-Lock: sha1:U3BAdJiY9tuHaE3Aoo6WWsSLCKg= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Thierry Volpiatto writes: > Stefan Monnier writes: > >> I think we can install the file-subdir-of-p test now and leave the rest >> for 24.2. Can you (re)send the corresponding patch? Note that >> (or (files-equal-p directory newname) >> (file-subdir-of-p newname directory)) >> should be replaced by just (file-subdir-of-p newname directory), because >> this primitive should be a "⊆" rather than "⊂". > > I have removed one more occurence of `files-equal-p' no more needed in > dired-aux.el. > So this function is not needed actually; I have not removed it though. > Maybe I should and add it only after 24.1? Just realize that this match was quite old. I have merged this patch with last revision of today. So ignore precedent and review this one. I it's ok I will apply it on trunk. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=patch-r118916.patch Content-Description: Merge patch with last revision # HG changeset patch # User Thierry Volpiatto # Date 1330067166 -3600 # Node ID 71a95b366b8509169d01466c44f01c1bcd96d4f7 # Parent d736ca342d20302be2fcb7e81f1c9e364b759663 Fix bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy. * lisp/files.el (files-equal-p): New, simple equality check between two filename. (file-subdir-of-p): New, Check if file1 is subdir of file2. (copy-directory): Return error when trying to copy a directory on itself. * lisp/dired-aux.el (dired-copy-file-recursive): Same. (dired-create-files): Modify destination when source is equal to dest when copying files. Return also when dest is a subdir of source. diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1264,6 +1264,8 @@ (defun dired-copy-file-recursive (from to ok-flag &optional preserve-time top recursive) + (when (file-subdir-of-p to from) + (error "Can't copy directory `%s' on itself" from)) (let ((attrs (file-attributes from))) (if (and recursive (eq t (car attrs)) @@ -1430,10 +1432,26 @@ (cond ((integerp marker-char) marker-char) (marker-char (dired-file-marker from)) ; slow (t nil)))) - (when (and (file-directory-p from) - (file-directory-p to) - (eq file-creator 'dired-copy-file)) - (setq to (file-name-directory to))) + ;; Handle the `dired-copy-file' file-creator specially + ;; When copying a directory to another directory or + ;; possibly to itself. + ;; (e.g "~/foo" => "~/test" or "~/foo" =>"~/foo") + ;; In this case the 'name-constructor' have set the destination + ;; 'to' to "~/test/foo" because the old + ;; emacs23 behavior of `copy-directory' + ;; was no not create the subdir and copy instead the contents only. + ;; With it's new behavior (similar to cp shell command) we don't + ;; need such a construction, so modify the destination 'to' to + ;; "~/test/" instead of "~/test/foo/". + ;; If from and to are the same directory do the same, + ;; the error will be handled by `dired-copy-file-recursive'. + (let ((destname (file-name-directory to))) + (when (and (file-directory-p from) + (file-directory-p to) + (eq file-creator 'dired-copy-file)) + (setq to destname)) + (and (file-subdir-of-p destname from) + (error "Can't copy directory `%s' on itself" from))) (condition-case err (progn (funcall file-creator from to dired-overwrite-confirmed) diff --git a/lisp/files.el b/lisp/files.el --- a/lisp/files.el +++ b/lisp/files.el @@ -4985,6 +4985,35 @@ directory 'full directory-files-no-dot-files-regexp))) (delete-directory-internal directory))))) +(defun files-equal-p (file1 file2) + "Return non-nil if FILE1 and FILE2 name the same file." + (and (equal (file-remote-p file1) (file-remote-p file2)) + (equal (file-attributes (file-truename (expand-file-name file1))) + (file-attributes (file-truename (expand-file-name file2)))))) + +(defun file-subdir-of-p (file1 file2) + "Check if FILE1 is a subdirectory of FILE2 on current filesystem. +If directory FILE1 is the same than directory FILE2, return non--nil." + (when (and (not (or (file-remote-p file1) + (file-remote-p file2))) + (not (string= file1 "/")) + (file-directory-p file1) + (file-directory-p file2)) + (or (string= file2 "/") + (loop with f1 = (expand-file-name (file-truename file1)) + with f2 = (expand-file-name (file-truename file2)) + with ls1 = (split-string f1 "/" t) + with ls2 = (split-string f2 "/" t) + 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 + (equal (file-attributes (file-truename root)) + (file-attributes f2)))))) + (defun copy-directory (directory newname &optional keep-time parents copy-contents) "Copy DIRECTORY to NEWNAME. Both args must be strings. This function always sets the file modes of the output files to match @@ -5011,6 +5040,8 @@ (format "Copy directory %s to: " dir) default-directory default-directory nil nil) current-prefix-arg t nil))) + (when (file-subdir-of-p newname directory) + (error "Can't copy directory `%s' on itself" directory)) ;; If default-directory is a remote directory, make sure we find its ;; copy-directory handler. (let ((handler (or (find-file-name-handler directory 'copy-directory) --=-=-= Content-Type: text/plain -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 04:23:43 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 09:23:43 +0000 Received: from localhost ([127.0.0.1]:53395 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0rNO-0000C5-LO for submit@debbugs.gnu.org; Fri, 24 Feb 2012 04:23:43 -0500 Received: from mtaout23.012.net.il ([80.179.55.175]:61330) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0rNM-0000Bd-Ap for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 04:23:42 -0500 Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0LZW00E004LODI00@a-mtaout23.012.net.il> for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 11:21:00 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.127.12.178]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LZW00EDA4MZD020@a-mtaout23.012.net.il>; Fri, 24 Feb 2012 11:21:00 +0200 (IST) Date: Fri, 24 Feb 2012 11:19:04 +0200 From: Eli Zaretskii Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy In-reply-to: <87vcmwwvk7.fsf@gmail.com> X-012-Sender: halo1@inter.net.il To: Thierry Volpiatto Message-id: <834nugtwqf.fsf@gnu.org> References: <87mx9su32g.fsf@web.de> <87pqekopb5.fsf@gmail.com> <87hazwoost.fsf@gmail.com> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> <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> X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) > From: Thierry Volpiatto > Date: Fri, 24 Feb 2012 08:16:08 +0100 > > Just realize that this match was quite old. > I have merged this patch with last revision of today. > So ignore precedent and review this one. > I it's ok I will apply it on trunk. Some feedback below. Apologies if I say something silly because I didn't track this discussion from the beginning. > + (when (file-subdir-of-p to from) > + (error "Can't copy directory `%s' on itself" from)) A better error message would be (error "Cannot copy `%s' into its subdirectory `%s'" from to) IOW, don't assume that the fact of TO being a subdirectory of FROM is immediately evident to the user, just by looking at one of them. > + ;; In this case the 'name-constructor' have set the destination > + ;; 'to' to "~/test/foo" because the old > + ;; emacs23 behavior of `copy-directory' > + ;; was no not create the subdir and copy instead the contents only. ^^^^^^^^^^^^^ Something's wrong here. Did you mean "to not create"? If so, "not to create the subdirectory and instead copy the contents" is clearer. > + ;; With it's new behavior ^^^^ "its". "It's" is a short for "it is", which is not what you want here. > (similar to cp shell command) we don't ^^^^^^^^^^^^^^^^^^^ "to the `cp' shell command" > + ;; need such a construction, so modify the destination 'to' to ^^^^^^^^^^^^^^^^^^^^^^^^ What "construction"? This word doesn't belong here. > + ;; "~/test/" instead of "~/test/foo/". > + ;; If from and to are the same directory do the same, Suggest to use FROM and TO, in caps, to distinguish arguments from the rest of the comment text. > + (error "Can't copy directory `%s' on itself" from))) See above for a better error message text. > +(defun files-equal-p (file1 file2) > + "Return non-nil if FILE1 and FILE2 name the same file." > + (and (equal (file-remote-p file1) (file-remote-p file2)) > + (equal (file-attributes (file-truename (expand-file-name file1))) > + (file-attributes (file-truename (expand-file-name file2)))))) I don't understand why you use expand-file-name here: file-truename does it for you anyway. > +(defun file-subdir-of-p (file1 file2) > + "Check if FILE1 is a subdirectory of FILE2 on current filesystem. > +If directory FILE1 is the same than directory FILE2, return non--nil." Suggest to modify the doc string as follows: "Return non-nil if FILE1 is a subdirectory of FILE2. Note that a directory is treated by this function as a subdirectory of itself." Btw, I would call the arguments DIR1 and DIR2, otherwise the above sounds awkward ("FILE1 is a subdirectory ...") and even begs a question about what happens if FILE1 is not a directory, but a file living inside the directory FILE2. > + (when (and (not (or (file-remote-p file1) > + (file-remote-p file2))) > + (not (string= file1 "/")) Unixism alert! What about the equivalent "X:/" on Windows? Also, what should the following return? (file-subdir-of-p "/" "/") According to the doc string, it should return non-nil, but the above string= condition would seem to cause it return nil, right? > + (or (string= file2 "/") Same here, on both accounts. Why do you single-case "/", anyway? It's as good a directory as any. > + (loop with f1 = (expand-file-name (file-truename file1)) > + with f2 = (expand-file-name (file-truename file2)) file-truename already expands its argument, so why would you need to run it through expand-file-name again? > + for p = (string-match "^/" f1) Unixism alert again! > + (equal (file-attributes (file-truename root)) > + (file-attributes f2)))))) Why don't you use files-equal-p here? > + (when (file-subdir-of-p newname directory) > + (error "Can't copy directory `%s' on itself" directory)) See above. Finally, it looks like this function only works when its two arguments already exist; when they don't, it returns nil. If this is the intent, it should be reflected in the doc string. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 04:52:02 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 09:52:02 +0000 Received: from localhost ([127.0.0.1]:53406 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0roo-0000r8-5J for submit@debbugs.gnu.org; Fri, 24 Feb 2012 04:52:02 -0500 Received: from mail-ww0-f42.google.com ([74.125.82.42]:62329) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0rol-0000qb-V1 for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 04:52:01 -0500 Received: by wgbgn7 with SMTP id gn7so267729wgb.3 for <10489@debbugs.gnu.org>; Fri, 24 Feb 2012 01:49:21 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.90.225 as permitted sender) client-ip=10.180.90.225; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.90.225 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.180.90.225]) by 10.180.90.225 with SMTP id bz1mr3469492wib.5.1330076961223 (num_hops = 1); Fri, 24 Feb 2012 01:49:21 -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=ukhoAe1jxOmLzihGbDXwnj2ZJC9Sh3oY1aNxQiZuu3U=; b=xc7zZg94ld+Z45eT77yjI3FFCjrtBqYzlJrAYjdCMwMKqVkmjteb+9xZ8Iu305A6Mq G1BtVJg95sCzdUpriyqzHutSvccRg6mmTgipNz+ViHYZnuPBZoklV3cqSsfY2UBHshYq RrKTxM7T2lgB4SdPVQVU4L0NIfb/kObD/pQWA= Received: by 10.180.90.225 with SMTP id bz1mr2776839wib.5.1330076961175; Fri, 24 Feb 2012 01:49:21 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id s2sm6148827wix.3.2012.02.24.01.49.18 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 24 Feb 2012 01:49:20 -0800 (PST) From: Thierry Volpiatto To: Eli Zaretskii Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> <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> Date: Fri, 24 Feb 2012 10:49:15 +0100 In-Reply-To: <834nugtwqf.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 24 Feb 2012 11:19:04 +0200") Message-ID: <87mx884l44.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Hi Eli and thanks for your feedback. Eli Zaretskii writes: > Some feedback below. Apologies if I say something silly because I > didn't track this discussion from the beginning. > >> + (when (file-subdir-of-p to from) >> + (error "Can't copy directory `%s' on itself" from)) > > A better error message would be > > (error "Cannot copy `%s' into its subdirectory `%s'" from to) Agree. > IOW, don't assume that the fact of TO being a subdirectory of FROM is > immediately evident to the user, just by looking at one of them. > >> + ;; In this case the 'name-constructor' have set the destination >> + ;; 'to' to "~/test/foo" because the old >> + ;; emacs23 behavior of `copy-directory' >> + ;; was no not create the subdir and copy instead the contents only. > ^^^^^^^^^^^^^ > Something's wrong here. Did you mean "to not create"? If so, "not to > create the subdirectory and instead copy the contents" is clearer. > >> + ;; With it's new behavior > ^^^^ > "its". "It's" is a short for "it is", which is not what you want here. Yes thanks, I always do this mistake. >> (similar to cp shell command) we don't > ^^^^^^^^^^^^^^^^^^^ > "to the `cp' shell command" > >> + ;; need such a construction, so modify the destination 'to' to > ^^^^^^^^^^^^^^^^^^^^^^^^ > What "construction"? This word doesn't belong here. > >> + ;; "~/test/" instead of "~/test/foo/". >> + ;; If from and to are the same directory do the same, Ok for all corrections in comments. > Suggest to use FROM and TO, in caps, to distinguish arguments from the > rest of the comment text. > >> + (error "Can't copy directory `%s' on itself" from))) > > See above for a better error message text. Same agree on this. >> +(defun files-equal-p (file1 file2) >> + "Return non-nil if FILE1 and FILE2 name the same file." >> + (and (equal (file-remote-p file1) (file-remote-p file2)) >> + (equal (file-attributes (file-truename (expand-file-name file1))) >> + (file-attributes (file-truename (expand-file-name file2)))))) > > I don't understand why you use expand-file-name here: file-truename > does it for you anyway. Yes, agree, vestiges of precedents changes. >> +(defun file-subdir-of-p (file1 file2) >> + "Check if FILE1 is a subdirectory of FILE2 on current filesystem. >> +If directory FILE1 is the same than directory FILE2, return non--nil." > > Suggest to modify the doc string as follows: > > "Return non-nil if FILE1 is a subdirectory of FILE2. > Note that a directory is treated by this function as a subdirectory of itself." Ok > Btw, I would call the arguments DIR1 and DIR2, otherwise the above > sounds awkward ("FILE1 is a subdirectory ...") and even begs a > question about what happens if FILE1 is not a directory, but a file > living inside the directory FILE2. Agree. >> + (when (and (not (or (file-remote-p file1) >> + (file-remote-p file2))) >> + (not (string= file1 "/")) > > Unixism alert! What about the equivalent "X:/" on Windows? Think this is no more needed. > Also, what should the following return? > > (file-subdir-of-p "/" "/") > > According to the doc string, it should return non-nil, but the above > string= condition would seem to cause it return nil, right? Right. >> + (or (string= file2 "/") > > Same here, on both accounts. Why do you single-case "/", anyway? > It's as good a directory as any. Should be removed yes. >> + (loop with f1 = (expand-file-name (file-truename file1)) >> + with f2 = (expand-file-name (file-truename file2)) > > file-truename already expands its argument, so why would you need to > run it through expand-file-name again? Yes same as above. >> + for p = (string-match "^/" f1) > > Unixism alert again! No, it is not, this allow the function to work both on window and nix. See (if p (concat "/" i) (concat i "/")) Will add comment there. >> + (equal (file-attributes (file-truename root)) >> + (file-attributes f2)))))) > > Why don't you use files-equal-p here? I think I can, don't remember though, I have to check. >> + (when (file-subdir-of-p newname directory) >> + (error "Can't copy directory `%s' on itself" directory)) > > See above. Same agree. > Finally, it looks like this function only works when its two arguments > already exist; when they don't, it returns nil. If this is the > intent, it should be reflected in the doc string. It is not the intent, but that is a good question, what if I copy e.g: ~/tmp/Test to ~/tmp/Test/Test1 where Test1 is a non--existing subdir of Test. Will check this, thanks. Though that the change that would follow later after 24.1 should fix this, falling back with the same behavior as 'cp'. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 07:21:00 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 12:21:00 +0000 Received: from localhost ([127.0.0.1]:53492 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0u8u-0004GA-9e for submit@debbugs.gnu.org; Fri, 24 Feb 2012 07:20:57 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:59783) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0u8n-0004Fr-Q5 for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 07:20:52 -0500 Received: by wibhm9 with SMTP id hm9so1397971wib.3 for <10489@debbugs.gnu.org>; Fri, 24 Feb 2012 04:18:10 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.80.40 as permitted sender) client-ip=10.180.80.40; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.80.40 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.180.80.40]) by 10.180.80.40 with SMTP id o8mr3927354wix.10.1330085890324 (num_hops = 1); Fri, 24 Feb 2012 04:18:10 -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=IMLxkNShxSHOgMvUhvUYbkI4iZq2Atf3jzl/AnPSPes=; b=GWLO7+BbGP/fFXeofSkiVU2SfL32BTRiv0bYrLT7tq1xBm05sah/xDV5NOXU7/sav6 D0ibzqP040nUsXew48P/18w1fbHdX26t7fq7usZVGS4rmDMV9dFPV46CWqhaw6mda6Dd zeidv1tZaWci131+AMTDPlsF0A3JUi0CYUPsU= Received: by 10.180.80.40 with SMTP id o8mr3143113wix.10.1330085890229; Fri, 24 Feb 2012 04:18:10 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id cs4sm7728666wib.8.2012.02.24.04.18.07 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 24 Feb 2012 04:18:09 -0800 (PST) From: Thierry Volpiatto To: Eli Zaretskii Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> <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> Date: Fri, 24 Feb 2012 13:18:05 +0100 In-Reply-To: <834nugtwqf.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 24 Feb 2012 11:19:04 +0200") Message-ID: <87r4xkwhky.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) --=-=-= Content-Type: text/plain Eli Zaretskii writes: > A better error message would be > > (error "Cannot copy `%s' into its subdirectory `%s'" from to) Done Have fixed commented block in `dired-create-files', have a look. > I don't understand why you use expand-file-name here: file-truename > does it for you anyway. Fixed. > Suggest to modify the doc string as follows: Done. Have modified `file-subdir-of-p' according to your advices. Please have a look. (Tested with success on windows also) (file-subdir-of-p "/" "/") works now. > Finally, it looks like this function only works when its two arguments > already exist; when they don't, it returns nil. If this is the > intent, it should be reflected in the doc string. Fixed docstring. Fixed `copy-directory' by doing another check of `file-subdir-of-p' after creation of the non--existing subdir. Thanks for this. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=patch-r118916.patch Content-Description: Improved version with Eli advices # HG changeset patch # User Thierry Volpiatto # Date 1330085238 -3600 # Node ID 3006935d19d27ff609e7f691d436efcdeb3b928f # Parent d736ca342d20302be2fcb7e81f1c9e364b759663 Fix bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy. * lisp/files.el (files-equal-p): New, simple equality check between two filename. (file-subdir-of-p): New, Check if file1 is subdir of file2. (copy-directory): Return error when trying to copy a directory on itself. * lisp/dired-aux.el (dired-copy-file-recursive): Same. (dired-create-files): Modify destination when source is equal to dest when copying files. Return also when dest is a subdir of source. diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1264,6 +1264,8 @@ (defun dired-copy-file-recursive (from to ok-flag &optional preserve-time top recursive) + (when (file-subdir-of-p to from) + (error "Cannot copy `%s' into its subdirectory `%s'" from to)) (let ((attrs (file-attributes from))) (if (and recursive (eq t (car attrs)) @@ -1430,10 +1432,30 @@ (cond ((integerp marker-char) marker-char) (marker-char (dired-file-marker from)) ; slow (t nil)))) - (when (and (file-directory-p from) - (file-directory-p to) - (eq file-creator 'dired-copy-file)) - (setq to (file-name-directory to))) + ;; Handle the `dired-copy-file' file-creator specially + ;; When copying a directory to another directory or + ;; possibly to itself or one of its subdirectories. + ;; e.g "~/foo/" => "~/test/" + ;; or "~/foo/" =>"~/foo/" + ;; or "~/foo/ => ~/foo/bar/") + ;; In this case the 'name-constructor' have set the destination + ;; TO to "~/test/foo" because the old emacs23 behavior + ;; of `copy-directory' was to not create the subdirectory + ;; and instead copy the contents. + ;; With the new behavior of `copy-directory' + ;; (similar to the `cp' shell command) we don't + ;; need such a construction of the target directory, + ;; so modify the destination TO to "~/test/" instead of "~/test/foo/". + (let ((destname (file-name-directory to))) + (when (and (file-directory-p from) + (file-directory-p to) + (eq file-creator 'dired-copy-file)) + (setq to destname)) + ;; If DESTNAME and FROM are the same directory or + ;; If DESTNAME is a subdirectory of FROM, return error. + (and (file-subdir-of-p destname from) + (error "Cannot copy `%s' into its subdirectory `%s'" + from to))) (condition-case err (progn (funcall file-creator from to dired-overwrite-confirmed) diff --git a/lisp/files.el b/lisp/files.el --- a/lisp/files.el +++ b/lisp/files.el @@ -4985,6 +4985,34 @@ directory 'full directory-files-no-dot-files-regexp))) (delete-directory-internal directory))))) +(defun files-equal-p (file1 file2) + "Return non-nil if FILE1 and FILE2 name the same file." + (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." + (when (and (not (or (file-remote-p dir1) + (file-remote-p dir2))) + (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)))) + (defun copy-directory (directory newname &optional keep-time parents copy-contents) "Copy DIRECTORY to NEWNAME. Both args must be strings. This function always sets the file modes of the output files to match @@ -5011,6 +5039,9 @@ (format "Copy directory %s to: " dir) default-directory default-directory nil nil) current-prefix-arg t nil))) + (when (file-subdir-of-p newname directory) + (error "Cannot copy `%s' into its subdirectory `%s'" + directory newname)) ;; If default-directory is a remote directory, make sure we find its ;; copy-directory handler. (let ((handler (or (find-file-name-handler directory 'copy-directory) @@ -5025,7 +5056,12 @@ (cond ((not (file-directory-p newname)) ;; If NEWNAME is not an existing directory, create it; ;; that is where we will copy the files of DIRECTORY. - (make-directory newname parents)) + (make-directory newname parents) + ;; `file-subdir-of-p' doesn't handle non--existing directories, + ;; so double check now if NEWNAME is not a subdir of DIRECTORY. + (and (file-subdir-of-p newname directory) + (error "Cannot copy `%s' into its subdirectory `%s'" + directory newname))) ;; If NEWNAME is an existing directory and COPY-CONTENTS ;; is nil, copy into NEWNAME/[DIRECTORY-BASENAME]. ((not copy-contents) --=-=-= Content-Type: text/plain -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 07:57:10 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 12:57:10 +0000 Received: from localhost ([127.0.0.1]:53517 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0uhx-0005rf-EY for submit@debbugs.gnu.org; Fri, 24 Feb 2012 07:57:10 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:46466) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S0uht-0005r4-VS for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 07:57:07 -0500 Received: (qmail invoked by alias); 24 Feb 2012 12:54:24 -0000 Received: from p57BB94C0.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.148.192] by mail.gmx.net (mp012) with SMTP; 24 Feb 2012 13:54:24 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX19VQ8UAX6pV46FX6wrvdPmTFsxNrasSqVNLe85ypH x+roOQvlhlN1/k From: Michael Albinus To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> <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> Date: Fri, 24 Feb 2012 13:54:16 +0100 In-Reply-To: <87r4xkwhky.fsf@gmail.com> (Thierry Volpiatto's message of "Fri, 24 Feb 2012 13:18:05 +0100") Message-ID: <87haygie87.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: Eli Zaretskii , 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Thierry Volpiatto writes: > --- a/lisp/files.el > +++ b/lisp/files.el > +(defun files-equal-p (file1 file2) > + > +(defun file-subdir-of-p (dir1 dir2) For both functions, please check for a file name handler, and call it if available. It doesn't matter that they are not implemented yet; there is the fallback to the native implementation in that case. With this check, I could start to implement the file name handlers in Tramp's upstream repository. > +(defun files-equal-p (file1 file2) > + "Return non-nil if FILE1 and FILE2 name the same file." > + (and (equal (file-remote-p file1) (file-remote-p file2)) > + (equal (file-attributes (file-truename file1)) > + (file-attributes (file-truename file2))))) This implementation requires, that inode number and filesystem device number are always unique. This is true for local files, if you run a Unix-like system. It is not guaranteed for remote files. And it is even not guaranted, if the local system is Windows: on mounted drives, the returned inode number is 0: (file-attributes "y:/.emacs") => (nil 1 101567 513 (20295 15877) (20234 46272) (20234 46272) 33083 "-rw-rw-rw-" nil 0 (47631 . 5881)) Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 08:39:05 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 13:39:06 +0000 Received: from localhost ([127.0.0.1]:53538 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0vMQ-0006oj-Oq for submit@debbugs.gnu.org; Fri, 24 Feb 2012 08:39:04 -0500 Received: from mail-ww0-f46.google.com ([74.125.82.46]:63502) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0vMM-0006oO-Lk for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 08:38:56 -0500 Received: by wgbdt14 with SMTP id dt14so1932566wgb.15 for <10489@debbugs.gnu.org>; Fri, 24 Feb 2012 05:36:15 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.216.137.147 as permitted sender) client-ip=10.216.137.147; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.216.137.147 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.216.137.147]) by 10.216.137.147 with SMTP id y19mr1282855wei.5.1330090575146 (num_hops = 1); Fri, 24 Feb 2012 05:36:15 -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=How/DWp7AJVyxTB2oQMfXeF99mnq0LoRc/gBzS4tFig=; b=cKvU0pVbfqnp9fvKCEWfOumvoPYl3BYRclh7ibb78JgaXivLJzyL0Y2H309u1wJToF quIeplPTUhYrz+HPuINBZhahPTrZ9PJrfjMJBcoyYe1xYTTMHW8g76AS01s5DqWyAuh0 CDVh0kUSSilSYwEFqnsdx13RnnRCtBrUQwdQg= Received: by 10.216.137.147 with SMTP id y19mr1027881wei.5.1330090575027; Fri, 24 Feb 2012 05:36:15 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id m16sm8587752wie.9.2012.02.24.05.36.12 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 24 Feb 2012 05:36:14 -0800 (PST) From: Thierry Volpiatto To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> <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> <87haygie87.fsf@gmx.de> Date: Fri, 24 Feb 2012 14:36:11 +0100 In-Reply-To: <87haygie87.fsf@gmx.de> (Michael Albinus's message of "Fri, 24 Feb 2012 13:54:16 +0100") Message-ID: <87mx88wdys.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: Eli Zaretskii , 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Hi Michael, Michael Albinus writes: > For both functions, please check for a file name handler, and call it if > available. It doesn't matter that they are not implemented yet; there is > the fallback to the native implementation in that case. > > With this check, I could start to implement the file name handlers in > Tramp's upstream repository. Do you mean something like in copy-directory: --8<---------------cut here---------------start------------->8--- (let ((handler (or (find-file-name-handler directory 'copy-directory) (find-file-name-handler newname 'copy-directory)))) (if handler (funcall handler 'copy-directory directory newname keep-time parents) --8<---------------cut here---------------end--------------->8--- >> +(defun files-equal-p (file1 file2) >> + "Return non-nil if FILE1 and FILE2 name the same file." >> + (and (equal (file-remote-p file1) (file-remote-p file2)) >> + (equal (file-attributes (file-truename file1)) >> + (file-attributes (file-truename file2))))) > > This implementation requires, that inode number and filesystem device > number are always unique. This is true for local files, if you run a > Unix-like system. It is not guaranteed for remote files. And it is even > not guaranted, if the local system is Windows: on mounted drives, the > returned inode number is 0: That annoying because the solution proposed by Stephane (stopping the loop before being infinite) is based on Inode comparison, at least as I have implemented it. > (file-attributes "y:/.emacs") > => (nil 1 101567 513 (20295 15877) (20234 46272) (20234 46272) 33083 "-rw-rw-rw-" nil 0 (47631 . 5881)) So what do you propose for such a case? -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 09:36:26 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 14:36:26 +0000 Received: from localhost ([127.0.0.1]:53561 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0wG2-00088V-20 for submit@debbugs.gnu.org; Fri, 24 Feb 2012 09:36:26 -0500 Received: from mtaout22.012.net.il ([80.179.55.172]:50485) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0wFx-00088E-Lx for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 09:36:24 -0500 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0LZW00B00J1D5A00@a-mtaout22.012.net.il> for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 16:33:40 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.127.12.178]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LZW00A6LJ439NG0@a-mtaout22.012.net.il>; Fri, 24 Feb 2012 16:33:40 +0200 (IST) Date: Fri, 24 Feb 2012 16:33:56 +0200 From: Eli Zaretskii Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy In-reply-to: <87haygie87.fsf@gmx.de> X-012-Sender: halo1@inter.net.il To: Michael Albinus Message-id: <83wr7cs3l7.fsf@gnu.org> References: <87mx9su32g.fsf@web.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> <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> <87haygie87.fsf@gmx.de> X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, thierry.volpiatto@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) > From: Michael Albinus > Cc: Eli Zaretskii , 10489@debbugs.gnu.org > Date: Fri, 24 Feb 2012 13:54:16 +0100 > > > +(defun files-equal-p (file1 file2) > > + "Return non-nil if FILE1 and FILE2 name the same file." > > + (and (equal (file-remote-p file1) (file-remote-p file2)) > > + (equal (file-attributes (file-truename file1)) > > + (file-attributes (file-truename file2))))) > > This implementation requires, that inode number and filesystem device > number are always unique. This is true for local files, if you run a > Unix-like system. It is not guaranteed for remote files. And it is even > not guaranted, if the local system is Windows: on mounted drives, the > returned inode number is 0: Mounted how (i.e. with what command or feature)? Btw, this function is only interested in directories; do directories also return a zero for inode in that case? Anyway, I'd consider this a bug in `stat' implemented in w32.c, and wouldn't bother the Lisp code with that. The probability of 2 directories having _all_ of their attributes identical is very small, even if we don't fix this in w32.c. As an additional precaution, we could compare their absolute file names as well. From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 09:42:24 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 14:42:24 +0000 Received: from localhost ([127.0.0.1]:53566 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0wLn-0008Gv-VM for submit@debbugs.gnu.org; Fri, 24 Feb 2012 09:42:24 -0500 Received: from mtaout22.012.net.il ([80.179.55.172]:52088) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0wLm-0008Gi-5n for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 09:42:23 -0500 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0LZW00B00JAL6Y00@a-mtaout22.012.net.il> for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 16:39:18 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.127.12.178]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LZW0097XJDHZDN0@a-mtaout22.012.net.il>; Fri, 24 Feb 2012 16:39:18 +0200 (IST) Date: Fri, 24 Feb 2012 16:39:35 +0200 From: Eli Zaretskii Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy In-reply-to: <87r4xkwhky.fsf@gmail.com> X-012-Sender: halo1@inter.net.il To: Thierry Volpiatto Message-id: <83vcmws3bs.fsf@gnu.org> References: <87mx9su32g.fsf@web.de> <87ty3w9639.fsf@gmx.de> <8762gckckt.fsf@gmail.com> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> <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> X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) > From: Thierry Volpiatto > Cc: 10489@debbugs.gnu.org > Date: Fri, 24 Feb 2012 13:18:05 +0100 > > Have modified `file-subdir-of-p' according to your advices. > Please have a look. (Tested with success on windows also) Looks good to me, thanks. From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 09:48:17 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 14:48:17 +0000 Received: from localhost ([127.0.0.1]:53580 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0wRU-0008PZ-J0 for submit@debbugs.gnu.org; Fri, 24 Feb 2012 09:48:16 -0500 Received: from mail-we0-f172.google.com ([74.125.82.172]:47156) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0wRR-0008PM-J0 for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 09:48:14 -0500 Received: by werg1 with SMTP id g1so1532717wer.3 for <10489@debbugs.gnu.org>; Fri, 24 Feb 2012 06:45:33 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.86.198 as permitted sender) client-ip=10.180.86.198; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.86.198 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.180.86.198]) by 10.180.86.198 with SMTP id r6mr5830546wiz.22.1330094733732 (num_hops = 1); Fri, 24 Feb 2012 06:45:33 -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=W6fgfihvShIMLZG8rKZ/5wAVGWQZHuSvP+34ht/JfIs=; b=IfpPLX5YmVBq6GzU3tN2/AfWqYatuwpg4H4Kba9u2RDdlwgLt0qMnBWyEA9JhVBLXn a/XBohbahUtw8GrHERw0tsjLKRr74M6F6KGi0eza9dKaAzPfYmOV6/QJlnFoAu1qsTR0 MOvMwBJQaE74i+FuFgEHzQllLz0kNbHA2tW+E= Received: by 10.180.86.198 with SMTP id r6mr4684669wiz.22.1330094712293; Fri, 24 Feb 2012 06:45:12 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id m16sm9364745wie.9.2012.02.24.06.45.10 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 24 Feb 2012 06:45:11 -0800 (PST) From: Thierry Volpiatto To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> <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> <87haygie87.fsf@gmx.de> Date: Fri, 24 Feb 2012 15:45:08 +0100 In-Reply-To: <87haygie87.fsf@gmx.de> (Michael Albinus's message of "Fri, 24 Feb 2012 13:54:16 +0100") Message-ID: <87ipiwwarv.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: Eli Zaretskii , 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Michael Albinus writes: > > For both functions, please check for a file name handler, and call it if > available. It doesn't matter that they are not implemented yet; there is > the fallback to the native implementation in that case. What about the check for file-remote-p in `file-subdir-of-p': (when (and (not (or (file-remote-p dir1) (file-remote-p dir2))) Is that ok for you? Anyway you could always modify these functions for your need afterward. > With this check, I could start to implement the file name handlers in > Tramp's upstream repository. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 09:54:15 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 14:54:15 +0000 Received: from localhost ([127.0.0.1]:53584 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0wXG-00006M-QN for submit@debbugs.gnu.org; Fri, 24 Feb 2012 09:54:15 -0500 Received: from mail-ww0-f46.google.com ([74.125.82.46]:46574) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0wXD-000069-SL for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 09:54:13 -0500 Received: by wgbdt14 with SMTP id dt14so2004358wgb.15 for <10489@debbugs.gnu.org>; Fri, 24 Feb 2012 06:51:32 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.95.1 as permitted sender) client-ip=10.180.95.1; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.95.1 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.180.95.1]) by 10.180.95.1 with SMTP id dg1mr5775214wib.21.1330095092157 (num_hops = 1); Fri, 24 Feb 2012 06:51:32 -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=ww1dnDQuDmzMZ2ztxBqZat7DQXUiM3Du9id13yxdIeo=; b=OhQbg/p2QcTgz2P5by+xSTOvAH/vH3ZJHurRmGDu8EaRP+k1bV7rxwN7Vlee4YX32v ZaLdcuRMl80lRuGoAIL7iAvq38WfdIBDQSJE1z1E1REFt3HYV2OmJRdNkVr6bm/wFapq Rvq/b+KGGbEyA7juMu0U5J+t3+QgdsX5G75ec= Received: by 10.180.95.1 with SMTP id dg1mr4644478wib.21.1330095032114; Fri, 24 Feb 2012 06:50:32 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id m16sm9423826wie.9.2012.02.24.06.50.30 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 24 Feb 2012 06:50:31 -0800 (PST) From: Thierry Volpiatto To: Eli Zaretskii Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87pqek9269.fsf@gmx.de> <87r4z0yqfx.fsf@gmail.com> <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> Date: Fri, 24 Feb 2012 15:50:28 +0100 In-Reply-To: <83vcmws3bs.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 24 Feb 2012 16:39:35 +0200") Message-ID: <87ehtkwaiz.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Eli Zaretskii writes: >> From: Thierry Volpiatto >> Cc: 10489@debbugs.gnu.org >> Date: Fri, 24 Feb 2012 13:18:05 +0100 >> >> Have modified `file-subdir-of-p' according to your advices. >> Please have a look. (Tested with success on windows also) > > Looks good to me, thanks. Ok thanks, If no objections, I will apply this patch tonight. However, Michael I would like to have more precisions for the call of tramp handlers. Thanks. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 10:03:32 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 15:03:32 +0000 Received: from localhost ([127.0.0.1]:54229 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0wgD-0000St-Gs for submit@debbugs.gnu.org; Fri, 24 Feb 2012 10:03:31 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:57771) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S0wg9-0000Se-GE for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 10:03:27 -0500 Received: (qmail invoked by alias); 24 Feb 2012 15:00:44 -0000 Received: from p57BB94C0.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.148.192] by mail.gmx.net (mp004) with SMTP; 24 Feb 2012 16:00:44 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX19Vkm88qylVbieG0dYlCtWTmzTcMhQGd5uPPvpiau gRvGDYkbruUH1D From: Michael Albinus To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87r4z0yqfx.fsf@gmail.com> <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> <87haygie87.fsf@gmx.de> <87mx88wdys.fsf@gmail.com> Date: Fri, 24 Feb 2012 16:00:34 +0100 In-Reply-To: <87mx88wdys.fsf@gmail.com> (Thierry Volpiatto's message of "Fri, 24 Feb 2012 14:36:11 +0100") Message-ID: <87d394i8dp.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: Eli Zaretskii , 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Thierry Volpiatto writes: > Hi Michael, Hi Thierry, >> For both functions, please check for a file name handler, and call it if >> available. It doesn't matter that they are not implemented yet; there is >> the fallback to the native implementation in that case. >> >> With this check, I could start to implement the file name handlers in >> Tramp's upstream repository. > Do you mean something like in copy-directory: > > --8<---------------cut here---------------start------------->8--- > (let ((handler (or (find-file-name-handler directory 'copy-directory) > (find-file-name-handler newname 'copy-directory)))) > (if handler > (funcall handler 'copy-directory directory newname keep-time parents) > --8<---------------cut here---------------end--------------->8--- Yes. And in the example you have shown, please add COPY-CONTENTS to the call of the handler, this is another error in `copy-directory'. > So what do you propose for such a case? Check, whether inode number and device number are trustworthy. A value of 0 or '(0 0) isn't. Fall back to the hard way (compare file names via string-equal). Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 10:22:05 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 15:22:05 +0000 Received: from localhost ([127.0.0.1]:54251 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0wyC-00018c-Ha for submit@debbugs.gnu.org; Fri, 24 Feb 2012 10:22:05 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:40519) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S0wy9-000180-PE for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 10:22:03 -0500 Received: (qmail invoked by alias); 24 Feb 2012 15:19:20 -0000 Received: from p57BB94C0.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.148.192] by mail.gmx.net (mp040) with SMTP; 24 Feb 2012 16:19:20 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1939kIEt853kpB8uwYrG5fwOCp2DwBu6bbzyNYZHP gtA+V/wIvFlV2z From: Michael Albinus To: Eli Zaretskii Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87r4z0yqfx.fsf@gmail.com> <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> <87haygie87.fsf@gmx.de> <83wr7cs3l7.fsf@gnu.org> Date: Fri, 24 Feb 2012 16:19:13 +0100 In-Reply-To: <83wr7cs3l7.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 24 Feb 2012 16:33:56 +0200") Message-ID: <8762ewi7im.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, thierry.volpiatto@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Eli Zaretskii writes: >> This implementation requires, that inode number and filesystem device >> number are always unique. This is true for local files, if you run a >> Unix-like system. It is not guaranteed for remote files. And it is even >> not guaranted, if the local system is Windows: on mounted drives, the >> returned inode number is 0: > > Mounted how (i.e. with what command or feature)? Don't know, somebody has added "network drives" to my login. All I can say is --8<---------------cut here---------------start------------->8--- U:\>net use New connections will be remembered. Status Local Remote Network ------------------------------------------------------------------------------- Disconnected R: \\ASLSDA0\ZENTRAL Microsoft Windows Network OK U: \\DESTGSFILN2\lb01177$ Microsoft Windows Network OK Y: \\sambager1\albinus Microsoft Windows Network The command completed successfully. --8<---------------cut here---------------end--------------->8--- > Btw, this function is only interested in directories; do directories > also return a zero for inode in that case? We are speaking about (defun files-equal-p (file1 file2) ... This is also for files. However, there is the same problem with directories: (file-attributes "y:/") => (t 1 101567 513 (0 0) (0 0) (0 0) 0 "drwxrwxrwx" nil 0 (47631 . 5881)) > Anyway, I'd consider this a bug in `stat' implemented in w32.c, and > wouldn't bother the Lisp code with that. OK, that would be fine. Do we know, that device number and inode number are trustworthy on all systems Emacs runs? When I've started with Tramp years ago, it was the first lesson I've learnt, that we shouldn't use inode and device numbers for serious things. And I have the impression, both values aren't used heavily (this was a result of code inspection some years ago, it might have changed). > The probability of 2 directories having _all_ of their attributes > identical is very small, even if we don't fix this in w32.c. We are also speaking about files. And then it is a problem. Example: On UNIX: # cp -p ~/.emacs ~/to-be-tested On Windows (y: is my UNIX home directory): (equal (file-attributes "y:/.emacs") (file-attributes "y:/to-be-tested")) => t Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 10:26:00 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 15:26:00 +0000 Received: from localhost ([127.0.0.1]:54257 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0x1z-0001HK-U4 for submit@debbugs.gnu.org; Fri, 24 Feb 2012 10:26:00 -0500 Received: from mailout-de.gmx.net ([213.165.64.23]:38974) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S0x1x-0001Gz-Fs for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 10:25:58 -0500 Received: (qmail invoked by alias); 24 Feb 2012 15:23:16 -0000 Received: from p57BB94C0.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.148.192] by mail.gmx.net (mp069) with SMTP; 24 Feb 2012 16:23:16 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX19hjkoxk8VhBoHHMTVA29NUK6eGhXDH0N4iklEELL nctZSjWmdsv36d From: Michael Albinus To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87r4z0yqfx.fsf@gmail.com> <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> <87haygie87.fsf@gmx.de> <87ipiwwarv.fsf@gmail.com> Date: Fri, 24 Feb 2012 16:23:09 +0100 In-Reply-To: <87ipiwwarv.fsf@gmail.com> (Thierry Volpiatto's message of "Fri, 24 Feb 2012 15:45:08 +0100") Message-ID: <871upki7c2.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: Eli Zaretskii , 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Thierry Volpiatto writes: Hi Thierry, > What about the check for file-remote-p in `file-subdir-of-p': > > (when (and (not (or (file-remote-p dir1) > (file-remote-p dir2))) > > Is that ok for you? No. Call a file name handler, and forget the rest. > Anyway you could always modify these functions for your need afterward. Sure. But I want to be able to tell "If you are using Emacs 24.1, take Tramp 2.2.5, (which is more recent than the built-in) and your problem will be solved". This guy hasn't to patch anything. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 10:29:21 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 15:29:21 +0000 Received: from localhost ([127.0.0.1]:54309 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0x5E-0001QM-1g for submit@debbugs.gnu.org; Fri, 24 Feb 2012 10:29:20 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:57011) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S0x5A-0001Q2-KB for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 10:29:17 -0500 Received: (qmail invoked by alias); 24 Feb 2012 15:26:35 -0000 Received: from p57BB94C0.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.148.192] by mail.gmx.net (mp016) with SMTP; 24 Feb 2012 16:26:35 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX18fJLxDRnYf6LsytCb10SMY0V4MtWsjdoIGQYL9td sOq3x996j5YUQh From: Michael Albinus To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87r4z0yqfx.fsf@gmail.com> <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> Date: Fri, 24 Feb 2012 16:26:28 +0100 In-Reply-To: <87ehtkwaiz.fsf@gmail.com> (Thierry Volpiatto's message of "Fri, 24 Feb 2012 15:50:28 +0100") Message-ID: <87wr7cgsm3.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: Eli Zaretskii , 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) 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. > Thanks. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 10:54:53 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 15:54:53 +0000 Received: from localhost ([127.0.0.1]:54314 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0xTw-0002Ao-7I for submit@debbugs.gnu.org; Fri, 24 Feb 2012 10:54:53 -0500 Received: from mail-ww0-f42.google.com ([74.125.82.42]:44287) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0xTs-0002AV-EN for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 10:54:49 -0500 Received: by wgbgn7 with SMTP id gn7so557462wgb.3 for <10489@debbugs.gnu.org>; Fri, 24 Feb 2012 07:52:08 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.83.97 as permitted sender) client-ip=10.180.83.97; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.83.97 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.180.83.97]) by 10.180.83.97 with SMTP id p1mr6276904wiy.19.1330098728207 (num_hops = 1); Fri, 24 Feb 2012 07:52:08 -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=jIPX1vaEE3E7Fe/qaavTU5YCB9DmUmebqi+JrSRFrLU=; b=T8ssbXzNFHKl4oCLT6KeMnKxxVdIp2IAeNUs6GLCQQUY3nUVB/NaR/p8tk9vK+5vzb XqxXAYTuIOQk952Oep+76MHj+4T6MW2LqPJm69aQEaZZcqqL6NTIIPRGPabJBqBH70bX kA+yt5tRGw5TaxMCRUe4AZmgHxKDmchiGN334= Received: by 10.180.83.97 with SMTP id p1mr5040526wiy.19.1330098728153; Fri, 24 Feb 2012 07:52:08 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id dr5sm10241641wib.0.2012.02.24.07.52.06 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 24 Feb 2012 07:52:07 -0800 (PST) From: Thierry Volpiatto To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy 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> Date: Fri, 24 Feb 2012 16:52:04 +0100 In-Reply-To: <87wr7cgsm3.fsf@gmx.de> (Michael Albinus's message of "Fri, 24 Feb 2012 16:26:28 +0100") Message-ID: <87aa48w7ob.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: Eli Zaretskii , 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Michael Albinus writes: > Thierry Volpiatto writes: > >> However, Michael I would like to have more precisions for the call of >> tramp handlers. > > What exactly? Should the handler be called at the beginning of the function? If it's the case, something is wrong in copy-directory. > 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. > >> Thanks. > > Best regards, Michael. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 11:05:05 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 16:05:05 +0000 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 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 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 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= Received: by 10.180.77.228 with SMTP id v4mr5244630wiw.2.1330099339909; Fri, 24 Feb 2012 08:02:19 -0800 (PST) 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) From: Thierry Volpiatto To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy 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> Date: Fri, 24 Feb 2012 17:02:16 +0100 In-Reply-To: <87wr7cgsm3.fsf@gmx.de> (Michael Albinus's message of "Fri, 24 Feb 2012 16:26:28 +0100") Message-ID: <8762eww77b.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: Eli Zaretskii , 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) 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 From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 11:18:12 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 16:18:12 +0000 Received: from localhost ([127.0.0.1]:54345 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0xqW-0002iY-3m for submit@debbugs.gnu.org; Fri, 24 Feb 2012 11:18:12 -0500 Received: from rcsinet15.oracle.com ([148.87.113.117]:23866) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0xqT-0002iL-44 for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 11:18:10 -0500 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by rcsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q1OGFPXt009754 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 24 Feb 2012 16:15:26 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q1OGFOri010129 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 24 Feb 2012 16:15:25 GMT Received: from abhmt118.oracle.com (abhmt118.oracle.com [141.146.116.70]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q1OGFOfi017181; Fri, 24 Feb 2012 10:15:24 -0600 Received: from dradamslap1 (/10.159.39.252) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 24 Feb 2012 08:15:24 -0800 From: "Drew Adams" To: "'Thierry Volpiatto'" , "'Michael Albinus'" 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> <8762eww77b.fsf@gmail.com> Subject: RE: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Date: Fri, 24 Feb 2012 08:15:20 -0800 Message-ID: <448B2DBD622541A9821AC6454974902C@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <8762eww77b.fsf@gmail.com> Thread-Index: AczzDeDj54I/R4jTQyuTaFLNaU/8hQAATNLQ X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-CT-RefId: str=0001.0A090207.4F47B7A0.00EB,ss=1,re=0.000,fgs=0 X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) Just a quick question about this: >> + (equal (file-attributes (file-truename (expand-file-name file1))) >> + (file-attributes (file-truename (expand-file-name file2)))))) > > I don't understand why you use expand-file-name here: > file-truename does it for you anyway. That's true, but only for Emacs 24+. Is there any chance that this code will be used (say by Tramp) with Emacs < 24, where `file-truename' does not expand a relative file name? From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 11:20:22 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 16:20:23 +0000 Received: from localhost ([127.0.0.1]:54349 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0xsb-0002le-Et for submit@debbugs.gnu.org; Fri, 24 Feb 2012 11:20:22 -0500 Received: from mailout-de.gmx.net ([213.165.64.23]:43801) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S0xsX-0002lQ-Ux for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 11:20:19 -0500 Received: (qmail invoked by alias); 24 Feb 2012 16:17:36 -0000 Received: from p57BB94C0.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.148.192] by mail.gmx.net (mp071) with SMTP; 24 Feb 2012 17:17:36 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1+QJzVGf9aQR11DFwHvat7kAZbG+3DIDT2e7KAcBf pEnZh+2KeQYjfT From: Michael Albinus To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy 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> <87aa48w7ob.fsf@gmail.com> Date: Fri, 24 Feb 2012 17:17:29 +0100 In-Reply-To: <87aa48w7ob.fsf@gmail.com> (Thierry Volpiatto's message of "Fri, 24 Feb 2012 16:52:04 +0100") Message-ID: <87y5rsdx46.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: Eli Zaretskii , 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Thierry Volpiatto writes: > Should the handler be called at the beginning of the function? In general, yes. But sometimes, there is the same code to be applied in the native function and the handler. So it is done in the native code, and the handler avoids that code. > If it's the case, something is wrong in copy-directory. I will check later on. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 11:24:23 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 16:24:23 +0000 Received: from localhost ([127.0.0.1]:54357 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0xwV-0002rn-9W for submit@debbugs.gnu.org; Fri, 24 Feb 2012 11:24:23 -0500 Received: from mailout-de.gmx.net ([213.165.64.23]:57935) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S0xwT-0002rb-Kk for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 11:24:22 -0500 Received: (qmail invoked by alias); 24 Feb 2012 16:21:40 -0000 Received: from p57BB94C0.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.148.192] by mail.gmx.net (mp035) with SMTP; 24 Feb 2012 17:21:40 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX19oF2FWA7NovxQ/Ah35pQwJxOU5v1Z5Z7hrGtEPzh mo7NVj8Q6kf06E From: Michael Albinus To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy 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> <8762eww77b.fsf@gmail.com> Date: Fri, 24 Feb 2012 17:21:33 +0100 In-Reply-To: <8762eww77b.fsf@gmail.com> (Thierry Volpiatto's message of "Fri, 24 Feb 2012 17:02:16 +0100") Message-ID: <87ty2gdwxe.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: Eli Zaretskii , 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Thierry Volpiatto writes: > (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)) Not needed anymore, you have called the handler already. > (equal (file-attributes (file-truename file1)) > (file-attributes (file-truename file2))))))) Here we have the discussion about the inode numbers. But this is an edge case; let's go this way. Eli will fix it for Windows :-) > (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)))))) Looks OK on the first glance. > BTW I have added the COPY-CONTENTS arg to your handler in > `copy-directory'. Thanks. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 11:28:01 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 16:28:01 +0000 Received: from localhost ([127.0.0.1]:54361 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0y00-0002wp-RO for submit@debbugs.gnu.org; Fri, 24 Feb 2012 11:28:01 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:50421) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S0xzy-0002wb-9x for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 11:27:59 -0500 Received: (qmail invoked by alias); 24 Feb 2012 16:25:17 -0000 Received: from p57BB94C0.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.148.192] by mail.gmx.net (mp012) with SMTP; 24 Feb 2012 17:25:17 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1/9ZeBncKj9qSpSeEi3yc9FIhtCpT8SW+zcDu4dCQ oyuoArJrORpOCK From: Michael Albinus To: "Drew Adams" Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.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> <8762eww77b.fsf@gmail.com> <448B2DBD622541A9821AC6454974902C@us.oracle.com> Date: Fri, 24 Feb 2012 17:25:10 +0100 In-Reply-To: <448B2DBD622541A9821AC6454974902C@us.oracle.com> (Drew Adams's message of "Fri, 24 Feb 2012 08:15:20 -0800") Message-ID: <87pqd4dwrd.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, 'Thierry Volpiatto' X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) "Drew Adams" writes: >> I don't understand why you use expand-file-name here: >> file-truename does it for you anyway. > > That's true, but only for Emacs 24+. Is there any chance that this > code will be used (say by Tramp) with Emacs < 24, where > `file-truename' does not expand a relative file name? "This code" belongs to a function introduced with Emacs 24. Tramp cannot use it for older/other Emacsen, because it does not exist there :-) If Tramp *emulates* this code, it is responsible to do it correctly. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 11:46:04 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 16:46:04 +0000 Received: from localhost ([127.0.0.1]:54368 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0yHU-0003Mi-J1 for submit@debbugs.gnu.org; Fri, 24 Feb 2012 11:46:04 -0500 Received: from rcsinet15.oracle.com ([148.87.113.117]:46089) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0yHS-0003ME-Ai for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 11:46:03 -0500 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by rcsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q1OGh2ob008545 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 24 Feb 2012 16:43:03 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q1OGguFY011020 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 24 Feb 2012 16:42:57 GMT Received: from abhmt117.oracle.com (abhmt117.oracle.com [141.146.116.69]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q1OGguXp005568; Fri, 24 Feb 2012 10:42:56 -0600 Received: from dradamslap1 (/10.159.39.252) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 24 Feb 2012 08:42:56 -0800 From: "Drew Adams" To: "'Michael Albinus'" References: <87mx9su32g.fsf@web.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> <8762eww77b.fsf@gmail.com><448B2DBD622541A9821AC6454974902C@us.oracle.com> <87pqd4dwrd.fsf@gmx.de> Subject: RE: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Date: Fri, 24 Feb 2012 08:42:52 -0800 Message-ID: <162B52AA951643EDAD73E8648240E623@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <87pqd4dwrd.fsf@gmx.de> Thread-Index: AczzEOjwz6Gr/0wmTf6StOe+ybDLAwAAdfCg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Source-IP: ucsinet22.oracle.com [156.151.31.94] X-CT-RefId: str=0001.0A090209.4F47BE29.010F,ss=1,re=0.000,fgs=0 X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, 'Thierry Volpiatto' X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) > >> I don't understand why you use expand-file-name here: > >> file-truename does it for you anyway. > > > > That's true, but only for Emacs 24+. Is there any chance that this > > code will be used (say by Tramp) with Emacs < 24, where > > `file-truename' does not expand a relative file name? > > "This code" belongs to a function introduced with Emacs 24. > Tramp cannot use it for older/other Emacsen, because it does > not exist there :-) > > If Tramp *emulates* this code, it is responsible to do it correctly. I see. I guess by the last part you mean that if the next Tramp version (which will presumably take advantage of this) were to be used with an older Emacs version, then it would test `(fboundp 'files-equal-p)' and if nil do something else (e.g. emulate it) to test equality. Is that what you meant? From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 12:07:34 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 17:07:34 +0000 Received: from localhost ([127.0.0.1]:54391 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0ycH-0003qr-4p for submit@debbugs.gnu.org; Fri, 24 Feb 2012 12:07:34 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:60874) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S0ycE-0003qb-Bb for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 12:07:31 -0500 Received: (qmail invoked by alias); 24 Feb 2012 17:04:48 -0000 Received: from p57BB94C0.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.148.192] by mail.gmx.net (mp004) with SMTP; 24 Feb 2012 18:04:48 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1+IWmBiz2iItm5tREHMXv9n+j1Fz3N7y4A1R8a4sQ 3n21oYHL40mxt9 From: Michael Albinus To: "Drew Adams" Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.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> <8762eww77b.fsf@gmail.com> <448B2DBD622541A9821AC6454974902C@us.oracle.com> <87pqd4dwrd.fsf@gmx.de> <162B52AA951643EDAD73E8648240E623@us.oracle.com> Date: Fri, 24 Feb 2012 18:04:42 +0100 In-Reply-To: <162B52AA951643EDAD73E8648240E623@us.oracle.com> (Drew Adams's message of "Fri, 24 Feb 2012 08:42:52 -0800") Message-ID: <87k43cxivp.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, 'Thierry Volpiatto' X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) "Drew Adams" writes: > I see. I guess by the last part you mean that if the next Tramp > version (which will presumably take advantage of this) were to be used > with an older Emacs version, then it would test `(fboundp > 'files-equal-p)' and if nil do something else (e.g. emulate it) to > test equality. Is that what you meant? Yes. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 12:25:49 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 17:25:50 +0000 Received: from localhost ([127.0.0.1]:54404 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0ytx-0004GG-2W for submit@debbugs.gnu.org; Fri, 24 Feb 2012 12:25:49 -0500 Received: from mail-we0-f172.google.com ([74.125.82.172]:56731) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S0ytu-0004G3-2R for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 12:25:47 -0500 Received: by werg1 with SMTP id g1so1643389wer.3 for <10489@debbugs.gnu.org>; Fri, 24 Feb 2012 09:23:05 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.102.132 as permitted sender) client-ip=10.180.102.132; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.102.132 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.180.102.132]) by 10.180.102.132 with SMTP id fo4mr4420915wib.6.1330104185675 (num_hops = 1); Fri, 24 Feb 2012 09:23:05 -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=BJmpIJBChb/24qBnCIVe50M16JoHeDIQ6q/LfVzjG0E=; b=V0+FtwyC9le2TleQFMZS7/8scXiXQJ1SK5ftSUAeOJ/cB3kafXnwHr7ElBiySJnNG6 2QWT15b2egMp2z2FNA5X5ymni3Lj993ojjnlAVURhuRcLPAo2YCBDz2umuz/4VPbf8X1 1VyQbsWnla/yhmMGWtEzH42xh/sZchgdIk7wE= Received: by 10.180.102.132 with SMTP id fo4mr3532878wib.6.1330104185558; Fri, 24 Feb 2012 09:23:05 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id gf3sm4827773wib.6.2012.02.24.09.23.02 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 24 Feb 2012 09:23:03 -0800 (PST) From: Thierry Volpiatto To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.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> <8762eww77b.fsf@gmail.com> <87ty2gdwxe.fsf@gmx.de> Date: Fri, 24 Feb 2012 18:23:00 +0100 In-Reply-To: <87ty2gdwxe.fsf@gmx.de> (Michael Albinus's message of "Fri, 24 Feb 2012 17:21:33 +0100") Message-ID: <871upkw3gr.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: Eli Zaretskii , 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Michael Albinus writes: > Thierry Volpiatto writes: > >> (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)) > > Not needed anymore, you have called the handler already. You mean this is not needed: (and (equal (file-remote-p file1) (file-remote-p file2)) right? >> (equal (file-attributes (file-truename file1)) >> (file-attributes (file-truename file2))))))) > > Here we have the discussion about the inode numbers. But this is an edge > case; let's go this way. Eli will fix it for Windows :-) Yes I leave it as it is because it still not clear what to do here. Think it is safe enough anyway. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 13:46:10 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 18:46:11 +0000 Received: from localhost ([127.0.0.1]:54490 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S109i-0000DQ-PF for submit@debbugs.gnu.org; Fri, 24 Feb 2012 13:46:10 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:55653) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S109h-0000D2-Lz for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 13:46:10 -0500 Received: (qmail invoked by alias); 24 Feb 2012 18:43:28 -0000 Received: from p57BB94C0.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.148.192] by mail.gmx.net (mp030) with SMTP; 24 Feb 2012 19:43:28 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX180IsF/b0I0ElmqRkFHIvszL9edWWljB6buXOkhVm KHe7YIuZU4DMaf From: Michael Albinus To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.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> <8762eww77b.fsf@gmail.com> <87ty2gdwxe.fsf@gmx.de> <871upkw3gr.fsf@gmail.com> Date: Fri, 24 Feb 2012 19:43:20 +0100 In-Reply-To: <871upkw3gr.fsf@gmail.com> (Thierry Volpiatto's message of "Fri, 24 Feb 2012 18:23:00 +0100") Message-ID: <87linsxebb.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: Eli Zaretskii , 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Thierry Volpiatto writes: >> Not needed anymore, you have called the handler already. > You mean this is not needed: > > (and (equal (file-remote-p file1) (file-remote-p file2)) > > right? Yes. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 14:44:24 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 19:44:24 +0000 Received: from localhost ([127.0.0.1]:54548 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1143-0001al-R5 for submit@debbugs.gnu.org; Fri, 24 Feb 2012 14:44:24 -0500 Received: from mtaout23.012.net.il ([80.179.55.175]:55168) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1141-0001aZ-QU for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 14:44:22 -0500 Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0LZW00F00WMULN00@a-mtaout23.012.net.il> for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 21:41:40 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.127.12.178]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LZW00FDKXDEL250@a-mtaout23.012.net.il>; Fri, 24 Feb 2012 21:41:40 +0200 (IST) Date: Fri, 24 Feb 2012 21:42:42 +0200 From: Eli Zaretskii Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy In-reply-to: <8762ewi7im.fsf@gmx.de> X-012-Sender: halo1@inter.net.il To: Michael Albinus Message-id: <83r4xkrpal.fsf@gnu.org> References: <87mx9su32g.fsf@web.de> <87r4z0yqfx.fsf@gmail.com> <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> <87haygie87.fsf@gmx.de> <83wr7cs3l7.fsf@gnu.org> <8762ewi7im.fsf@gmx.de> X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, thierry.volpiatto@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) > From: Michael Albinus > Cc: thierry.volpiatto@gmail.com, 10489@debbugs.gnu.org > Date: Fri, 24 Feb 2012 16:19:13 +0100 > > Eli Zaretskii writes: > > >> This implementation requires, that inode number and filesystem device > >> number are always unique. This is true for local files, if you run a > >> Unix-like system. It is not guaranteed for remote files. And it is even > >> not guaranted, if the local system is Windows: on mounted drives, the > >> returned inode number is 0: > > > > Mounted how (i.e. with what command or feature)? > > Don't know, somebody has added "network drives" to my login. All I can > say is > > --8<---------------cut here---------------start------------->8--- > U:\>net use > New connections will be remembered. > > Status Local Remote Network > ------------------------------------------------------------------------------- > Disconnected R: \\ASLSDA0\ZENTRAL Microsoft Windows Network > OK U: \\DESTGSFILN2\lb01177$ Microsoft Windows Network > OK Y: \\sambager1\albinus Microsoft Windows Network > The command completed successfully. > --8<---------------cut here---------------end--------------->8--- And all of the \\server\share\foo directories, and also those below them, return zero inodes? From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 15:05:48 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 20:05:49 +0000 Received: from localhost ([127.0.0.1]:54569 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S11Ol-00025n-TQ for submit@debbugs.gnu.org; Fri, 24 Feb 2012 15:05:48 -0500 Received: from mtaout23.012.net.il ([80.179.55.175]:56305) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S11Oh-00025Z-Pd for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 15:05:44 -0500 Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0LZW00F00Y48NL00@a-mtaout23.012.net.il> for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 22:03:02 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.127.12.178]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LZW00FB5YD1L290@a-mtaout23.012.net.il>; Fri, 24 Feb 2012 22:03:02 +0200 (IST) Date: Fri, 24 Feb 2012 22:04:08 +0200 From: Eli Zaretskii Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy In-reply-to: <8762eww77b.fsf@gmail.com> X-012-Sender: halo1@inter.net.il To: Thierry Volpiatto Message-id: <83pqd4roav.fsf@gnu.org> 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> <8762eww77b.fsf@gmail.com> X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, michael.albinus@gmx.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) > From: Thierry Volpiatto > Cc: Eli Zaretskii , 10489@debbugs.gnu.org > Date: Fri, 24 Feb 2012 17:02:16 +0100 > > (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) If FILE1 and FILE2 have different 'files-equal-p handlers, which one of them, if any, should be invoked here? IOW, shouldn't we invoke a file handler only if it can handle _both_ files? Also, if each file has a different handler, doesn't that in itself already mean the files are not equal? > (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) Same issue here. Except that, unlike in the files-equal-p case, it's not so clear what to do if each file has a different handler, or if one has a handler, but the other doesn't. From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 15:09:07 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 20:09:07 +0000 Received: from localhost ([127.0.0.1]:54574 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S11Rz-0002AY-6c for submit@debbugs.gnu.org; Fri, 24 Feb 2012 15:09:07 -0500 Received: from mail-we0-f172.google.com ([74.125.82.172]:57099) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S11Rw-0002A3-AG for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 15:09:05 -0500 Received: by werg1 with SMTP id g1so1739513wer.3 for <10489@debbugs.gnu.org>; Fri, 24 Feb 2012 12:06:23 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.93.194 as permitted sender) client-ip=10.180.93.194; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.93.194 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.180.93.194]) by 10.180.93.194 with SMTP id cw2mr8120232wib.0.1330113983267 (num_hops = 1); Fri, 24 Feb 2012 12:06:23 -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=hiHudxPJVvCVg6viapLbUY1NQBbIADxdHvly5baA9Ds=; b=Oiq+XXzk+Q/OMMH3mlr9+JAzM4APXJ8jUhHFRS+jEIg/iJmm/AZHIMJvstWfOaE18m p7aRM820Nu3qAYZJDDl474lQaL9oJav/5KRB71Aei9jyf9Gbm+V8bY1NRkO7emi/grXK vq+Y7ky4UhW6Va+UED9rcBZ6xN/ip5XMOzm9k= Received: by 10.180.93.194 with SMTP id cw2mr6558311wib.0.1330113983197; Fri, 24 Feb 2012 12:06:23 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id s2sm13166407wix.3.2012.02.24.12.06.20 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 24 Feb 2012 12:06:22 -0800 (PST) From: Thierry Volpiatto To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.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> <8762eww77b.fsf@gmail.com> <87ty2gdwxe.fsf@gmx.de> <871upkw3gr.fsf@gmail.com> <87linsxebb.fsf@gmx.de> Date: Fri, 24 Feb 2012 21:06:19 +0100 In-Reply-To: <87linsxebb.fsf@gmx.de> (Michael Albinus's message of "Fri, 24 Feb 2012 19:43:20 +0100") Message-ID: <8762ewj8sk.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: Eli Zaretskii , 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Michael Albinus writes: > Thierry Volpiatto writes: > >>> Not needed anymore, you have called the handler already. >> You mean this is not needed: >> >> (and (equal (file-remote-p file1) (file-remote-p file2)) >> >> right? > > Yes. Thanks, applied. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 15:36:20 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 20:36:20 +0000 Received: from localhost ([127.0.0.1]:54583 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S11sJ-0002mn-7Z for submit@debbugs.gnu.org; Fri, 24 Feb 2012 15:36:20 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:48202) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S11sG-0002ma-DS for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 15:36:17 -0500 Received: (qmail invoked by alias); 24 Feb 2012 20:33:34 -0000 Received: from p57BB94C0.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.148.192] by mail.gmx.net (mp016) with SMTP; 24 Feb 2012 21:33:34 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1/P1oAzFcnPvgMBp9mDxj+XpcoqH09xRiS8asBagW eaoOU8M/sO2tCd From: Michael Albinus To: Eli Zaretskii Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> Date: Fri, 24 Feb 2012 21:33:26 +0100 In-Reply-To: <83pqd4roav.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 24 Feb 2012 22:04:08 +0200") Message-ID: <87haygx97t.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Eli Zaretskii writes: >> From: Thierry Volpiatto >> Cc: Eli Zaretskii , 10489@debbugs.gnu.org >> Date: Fri, 24 Feb 2012 17:02:16 +0100 >> >> (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) > > If FILE1 and FILE2 have different 'files-equal-p handlers, which one > of them, if any, should be invoked here? The one for FILE1. > IOW, shouldn't we invoke a file handler only if it can handle _both_ > files? Also, if each file has a different handler, doesn't that in > itself already mean the files are not equal? We shouldn't add too much to file name handler optimization here. The handler will know what to do. Likely, there won't be different handlers. It's always `tramp-file-name-handler', which calls the respective sub-handlers. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 15:37:53 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 20:37:53 +0000 Received: from localhost ([127.0.0.1]:54587 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S11to-0002ow-KG for submit@debbugs.gnu.org; Fri, 24 Feb 2012 15:37:53 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:52587) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S11tl-0002oj-Oa for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 15:37:50 -0500 Received: (qmail invoked by alias); 24 Feb 2012 20:35:07 -0000 Received: from p57BB94C0.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.148.192] by mail.gmx.net (mp002) with SMTP; 24 Feb 2012 21:35:07 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX199HCUE1lZ9bASKePzeD2QENylPCx4UmJoK479Qo0 zMYGuXOaehPnNC From: Michael Albinus To: Eli Zaretskii Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy 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> <87haygie87.fsf@gmx.de> <83wr7cs3l7.fsf@gnu.org> <8762ewi7im.fsf@gmx.de> <83r4xkrpal.fsf@gnu.org> Date: Fri, 24 Feb 2012 21:35:00 +0100 In-Reply-To: <83r4xkrpal.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 24 Feb 2012 21:42:42 +0200") Message-ID: <87d394x957.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, thierry.volpiatto@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Eli Zaretskii writes: >> Disconnected R: \\ASLSDA0\ZENTRAL Microsoft Windows Network >> OK U: \\DESTGSFILN2\lb01177$ Microsoft Windows Network >> OK Y: \\sambager1\albinus Microsoft Windows Network >> The command completed successfully. >> --8<---------------cut here---------------end--------------->8--- > > And all of the \\server\share\foo directories, and also those below > them, return zero inodes? I haven't checked. If it's important, I could do on Monday. Just tell me. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 16:57:17 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 21:57:17 +0000 Received: from localhost ([127.0.0.1]:54636 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S138f-0004dL-1p for submit@debbugs.gnu.org; Fri, 24 Feb 2012 16:57:17 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:57449) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S138b-0004d7-L2 for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 16:57:14 -0500 Received: by wibhm9 with SMTP id hm9so1750646wib.3 for <10489@debbugs.gnu.org>; Fri, 24 Feb 2012 13:54:32 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.216.134.5 as permitted sender) client-ip=10.216.134.5; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.216.134.5 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.216.134.5]) by 10.216.134.5 with SMTP id r5mr2128719wei.39.1330120472248 (num_hops = 1); Fri, 24 Feb 2012 13:54:32 -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=/7JSdWMo1hUv873Na9dN1u3fvtY7up0OVBZ5EZ+3sUY=; b=dt3ss1utUsS3fS9yk11cs2mR0GMyW/LdlmR4QS37IT0X/bZsm1Y84qAGxjpfU4dQMd LfvmYYQFXsJW626ayLJCDStN1QJnX10W8lTZehDXLNBJQvSPeqKUNVWkpl2BcuTAVRSW SOnRmvJaZ0hIXgALyyJXk3DZW+ZUAVPad90tA= Received: by 10.216.134.5 with SMTP id r5mr1716115wei.39.1330120472191; Fri, 24 Feb 2012 13:54:32 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id s8sm6117921wiz.8.2012.02.24.13.54.30 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 24 Feb 2012 13:54:31 -0800 (PST) From: Thierry Volpiatto To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> Date: Fri, 24 Feb 2012 22:54:28 +0100 In-Reply-To: <87haygx97t.fsf@gmx.de> (Michael Albinus's message of "Fri, 24 Feb 2012 21:33:26 +0100") Message-ID: <87aa47rj6z.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: Eli Zaretskii , 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Michael Albinus writes: > Eli Zaretskii writes: > >>> From: Thierry Volpiatto >>> Cc: Eli Zaretskii , 10489@debbugs.gnu.org >>> Date: Fri, 24 Feb 2012 17:02:16 +0100 >>> >>> (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) >> >> If FILE1 and FILE2 have different 'files-equal-p handlers, which one >> of them, if any, should be invoked here? > > The one for FILE1. > >> IOW, shouldn't we invoke a file handler only if it can handle _both_ >> files? Also, if each file has a different handler, doesn't that in >> itself already mean the files are not equal? > > We shouldn't add too much to file name handler optimization here. The > handler will know what to do. > > Likely, there won't be different handlers. It's always > `tramp-file-name-handler', which calls the respective sub-handlers. Now we have an error until you write handlers: tramp-file-name-for-operation: unknown file I/O primitive: file-subdir-of-p This happen when copying with sudo method. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 24 18:51:52 2012 Received: (at 10489) by debbugs.gnu.org; 24 Feb 2012 23:51:52 +0000 Received: from localhost ([127.0.0.1]:54711 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S14vX-00082q-Qb for submit@debbugs.gnu.org; Fri, 24 Feb 2012 18:51:52 -0500 Received: from fencepost.gnu.org ([140.186.70.10]:50347 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S14vU-00082h-2Z for 10489@debbugs.gnu.org; Fri, 24 Feb 2012 18:51:48 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1S14sw-0007A2-Nc; Fri, 24 Feb 2012 18:49:10 -0500 From: Glenn Morris To: thierry volpiatto Subject: Re: /srv/bzr/emacs/trunk r107412: * lisp/files.el (file-subdir-of-p): Fix typo. References: X-Spook: ASPIC blackjack doctrine Area 51 Osama anthrax North X-Ran: fxfg=-U[3@Lg:MashmKCm$eemF)'0)g:i!^{sq_R]h()D(.]J,"W)P!6{Dn:^@cbZ7uS8f X-Hue: magenta X-Attribution: GM Date: Fri, 24 Feb 2012 18:49:10 -0500 In-Reply-To: (thierry volpiatto's message of "Fri, 24 Feb 2012 22:16:56 +0100") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) thierry volpiatto wrote: > message: > * lisp/files.el (file-subdir-of-p): Fix typo. > modified: > lisp/ChangeLog You didn't actually install any change to files.el. Also, there's no need for "* lisp/", just use "* files.el". > + * lisp/files.el (file-subdir-of-p): Fix typo. From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 25 00:14:02 2012 Received: (at 10489) by debbugs.gnu.org; 25 Feb 2012 05:14:02 +0000 Received: from localhost ([127.0.0.1]:54945 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S19xJ-0002Qc-OE for submit@debbugs.gnu.org; Sat, 25 Feb 2012 00:14:01 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:33272) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S19xH-0002QU-EM for 10489@debbugs.gnu.org; Sat, 25 Feb 2012 00:14:00 -0500 Received: by wibhm9 with SMTP id hm9so1853187wib.3 for <10489@debbugs.gnu.org>; Fri, 24 Feb 2012 21:11:21 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.216.133.147 as permitted sender) client-ip=10.216.133.147; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.216.133.147 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.216.133.147]) by 10.216.133.147 with SMTP id q19mr2153331wei.28.1330146681213 (num_hops = 1); Fri, 24 Feb 2012 21:11:21 -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=Y3leH3FW+w44SjTC60f8Gk+J+izVsPq9+cbauOQvoCs=; b=sSoL7XK+ihyRFFIS1kcuNWZ8xtksNXlwXrWEYxz8iecZlk4mxdH+op5H0IHgN7RbBp k29tS1Q4IYQiMQzCMfHLvvGqH20C4FR8zOJTieOB7iMa4HRBFUIL2KukmV8OB2pngsOE FxBkKkEbMbZmcyWpeD848XPrt8ZXCECMhsoTc= Received: by 10.216.133.147 with SMTP id q19mr1731195wei.28.1330146681089; Fri, 24 Feb 2012 21:11:21 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id gp8sm7612110wib.5.2012.02.24.21.11.19 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 24 Feb 2012 21:11:20 -0800 (PST) From: Thierry Volpiatto To: Glenn Morris Subject: Re: /srv/bzr/emacs/trunk r107412: * lisp/files.el (file-subdir-of-p): Fix typo. References: Date: Sat, 25 Feb 2012 06:11:16 +0100 In-Reply-To: (Glenn Morris's message of "Fri, 24 Feb 2012 18:49:10 -0500") Message-ID: <878vjrxzt7.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Glenn Morris writes: > thierry volpiatto wrote: > >> message: >> * lisp/files.el (file-subdir-of-p): Fix typo. >> modified: >> lisp/ChangeLog > > You didn't actually install any change to files.el. > Also, there's no need for "* lisp/", just use "* files.el". An error, you did the change so fast... funcalll, that a merge happen. >> + * lisp/files.el (file-subdir-of-p): Fix typo. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 25 01:23:40 2012 Received: (at 10489) by debbugs.gnu.org; 25 Feb 2012 06:23:40 +0000 Received: from localhost ([127.0.0.1]:55000 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1B2h-00042v-UO for submit@debbugs.gnu.org; Sat, 25 Feb 2012 01:23:40 -0500 Received: from mtaout22.012.net.il ([80.179.55.172]:51715) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1B2e-00042j-3v for 10489@debbugs.gnu.org; Sat, 25 Feb 2012 01:23:39 -0500 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0LZX00H00QQD9W00@a-mtaout22.012.net.il> for 10489@debbugs.gnu.org; Sat, 25 Feb 2012 08:19:37 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.127.12.178]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LZX00HJ6QWOAA00@a-mtaout22.012.net.il>; Sat, 25 Feb 2012 08:19:37 +0200 (IST) Date: Sat, 25 Feb 2012 08:21:39 +0200 From: Eli Zaretskii Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy In-reply-to: <87d394x957.fsf@gmx.de> X-012-Sender: halo1@inter.net.il To: Michael Albinus Message-id: <83obsnsaa4.fsf@gnu.org> 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> <87haygie87.fsf@gmx.de> <83wr7cs3l7.fsf@gnu.org> <8762ewi7im.fsf@gmx.de> <83r4xkrpal.fsf@gnu.org> <87d394x957.fsf@gmx.de> X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, thierry.volpiatto@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) > From: Michael Albinus > Cc: thierry.volpiatto@gmail.com, 10489@debbugs.gnu.org > Date: Fri, 24 Feb 2012 21:35:00 +0100 > > Eli Zaretskii writes: > > >> Disconnected R: \\ASLSDA0\ZENTRAL Microsoft Windows Network > >> OK U: \\DESTGSFILN2\lb01177$ Microsoft Windows Network > >> OK Y: \\sambager1\albinus Microsoft Windows Network > >> The command completed successfully. > >> --8<---------------cut here---------------end--------------->8--- > > > > And all of the \\server\share\foo directories, and also those below > > them, return zero inodes? > > I haven't checked. If it's important, I could do on Monday. Just tell me. I'd like to know the extent of the problem. Specifically, does _any_ networked drive trigger this problem, or just some of them? If the latter, is it perhaps limited to Samba (which seems to be the type of the mount there), or anyway to the specific kind of software that manages the mounted volume? TIA From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 25 02:05:45 2012 Received: (at 10489) by debbugs.gnu.org; 25 Feb 2012 07:05:45 +0000 Received: from localhost ([127.0.0.1]:55015 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1BhQ-00050Z-Kj for submit@debbugs.gnu.org; Sat, 25 Feb 2012 02:05:45 -0500 Received: from mtaout22.012.net.il ([80.179.55.172]:60363) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1BhM-00050Q-U7 for 10489@debbugs.gnu.org; Sat, 25 Feb 2012 02:05:42 -0500 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0LZX00H00SWDNA00@a-mtaout22.012.net.il> for 10489@debbugs.gnu.org; Sat, 25 Feb 2012 09:03:00 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.127.12.178]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LZX00H4ISWZN010@a-mtaout22.012.net.il>; Sat, 25 Feb 2012 09:03:00 +0200 (IST) Date: Sat, 25 Feb 2012 09:05:02 +0200 From: Eli Zaretskii Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy In-reply-to: <87haygx97t.fsf@gmx.de> X-012-Sender: halo1@inter.net.il To: Michael Albinus Message-id: <83k43bs89t.fsf@gnu.org> References: <87mx9su32g.fsf@web.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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, thierry.volpiatto@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) > From: Michael Albinus > Cc: Thierry Volpiatto , 10489@debbugs.gnu.org > Date: Fri, 24 Feb 2012 21:33:26 +0100 > > Eli Zaretskii writes: > > >> From: Thierry Volpiatto > >> Cc: Eli Zaretskii , 10489@debbugs.gnu.org > >> Date: Fri, 24 Feb 2012 17:02:16 +0100 > >> > >> (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) > > > > If FILE1 and FILE2 have different 'files-equal-p handlers, which one > > of them, if any, should be invoked here? > > The one for FILE1. Can you explain why? My question wasn't rhetorical, it was due to a real confusion about what should be done in this situation and why. > > IOW, shouldn't we invoke a file handler only if it can handle _both_ > > files? Also, if each file has a different handler, doesn't that in > > itself already mean the files are not equal? > > We shouldn't add too much to file name handler optimization here. The > handler will know what to do. "Will know" how? Is it documented anywhere how to write a handler so it handles such situations? If so, please point me to that documentation, and perhaps I will see the light there. > Likely, there won't be different handlers. It's always > `tramp-file-name-handler', which calls the respective sub-handlers. ??? Are we to assume that a file-handler is always the Tramp handler? What about others, like jka-compr? From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 25 03:58:55 2012 Received: (at 10489) by debbugs.gnu.org; 25 Feb 2012 08:58:55 +0000 Received: from localhost ([127.0.0.1]:55063 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1DSx-00088i-8p for submit@debbugs.gnu.org; Sat, 25 Feb 2012 03:58:55 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:47598) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S1DSv-00088Y-7T for 10489@debbugs.gnu.org; Sat, 25 Feb 2012 03:58:54 -0500 Received: (qmail invoked by alias); 25 Feb 2012 08:56:13 -0000 Received: from p57BB96D1.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.150.209] by mail.gmx.net (mp030) with SMTP; 25 Feb 2012 09:56:13 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX19wvEJysN1wvHaNaxk8luG0uKtCjfHzo97DVwezFt Tyl7suk2NiU3iO From: Michael Albinus To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <87aa47rj6z.fsf@gmail.com> Date: Sat, 25 Feb 2012 09:56:04 +0100 In-Reply-To: <87aa47rj6z.fsf@gmail.com> (Thierry Volpiatto's message of "Fri, 24 Feb 2012 22:54:28 +0100") Message-ID: <878vjrxpej.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: Eli Zaretskii , 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Thierry Volpiatto writes: > Now we have an error until you write handlers: > > tramp-file-name-for-operation: unknown file I/O primitive: > file-subdir-of-p > > This happen when copying with sudo method. Should be fixed now. Btw, it might be useful if you could add documentation about `files-equal-p' and `file-subdir-of-p' in doc/lispref/files.texi. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 25 04:11:16 2012 Received: (at 10489) by debbugs.gnu.org; 25 Feb 2012 09:11:16 +0000 Received: from localhost ([127.0.0.1]:55071 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1Det-0008QN-Px for submit@debbugs.gnu.org; Sat, 25 Feb 2012 04:11:16 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:41116) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1Der-0008Q8-5Q for 10489@debbugs.gnu.org; Sat, 25 Feb 2012 04:11:14 -0500 Received: by wibhm9 with SMTP id hm9so1906085wib.3 for <10489@debbugs.gnu.org>; Sat, 25 Feb 2012 01:08:33 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.216.137.13 as permitted sender) client-ip=10.216.137.13; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.216.137.13 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.216.137.13]) by 10.216.137.13 with SMTP id x13mr2936839wei.57.1330160913870 (num_hops = 1); Sat, 25 Feb 2012 01:08:33 -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=5PhBNxG/Qb41GIE6sdN8MUF8u0y2R0UXv3d1wqorYuE=; b=ShblYOgoyu3OD1O0wW1Zut9B8eZeG1/txgHvVZFPLDLwkyqxcK2/1m7LFbdFUaB+66 40gxRTgpcLokS9n49+xQ6T+ERFg/CBcRmbBDcJM/zFe+bocmOoEc6My6E5C5va272p1V DWWme0fXiRB7DGsljWnkf6SpRQgIWdPCJEHKM= Received: by 10.216.137.13 with SMTP id x13mr2347349wei.57.1330160913707; Sat, 25 Feb 2012 01:08:33 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id m16sm21264561wie.9.2012.02.25.01.08.31 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 25 Feb 2012 01:08:32 -0800 (PST) From: Thierry Volpiatto To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <87aa47rj6z.fsf@gmail.com> <878vjrxpej.fsf@gmx.de> Date: Sat, 25 Feb 2012 10:08:29 +0100 In-Reply-To: <878vjrxpej.fsf@gmx.de> (Michael Albinus's message of "Sat, 25 Feb 2012 09:56:04 +0100") Message-ID: <87pqd3i8ky.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: Eli Zaretskii , 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Michael Albinus writes: > Thierry Volpiatto writes: > >> Now we have an error until you write handlers: >> >> tramp-file-name-for-operation: unknown file I/O primitive: >> file-subdir-of-p >> >> This happen when copying with sudo method. > > Should be fixed now. Thanks. > Btw, it might be useful if you could add documentation about > `files-equal-p' and `file-subdir-of-p' in doc/lispref/files.texi. I will have a look. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 25 04:58:59 2012 Received: (at 10489) by debbugs.gnu.org; 25 Feb 2012 09:59:00 +0000 Received: from localhost ([127.0.0.1]:55127 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1EP5-000178-Dp for submit@debbugs.gnu.org; Sat, 25 Feb 2012 04:58:59 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:52451) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1EP4-00016z-2M; Sat, 25 Feb 2012 04:58:58 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AicFAKU/KE9MCodT/2dsb2JhbACBX5x7eYhwnhmGGQSGUJRJhAs X-IronPort-AV: E=Sophos;i="4.73,1,1325480400"; d="scan'208";a="164543970" Received: from 76-10-135-83.dsl.teksavvy.com (HELO pastel.home) ([76.10.135.83]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 25 Feb 2012 04:56:18 -0500 Received: by pastel.home (Postfix, from userid 20848) id 7F2B659673; Sat, 25 Feb 2012 04:56:18 -0500 (EST) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Message-ID: References: <87mx9su32g.fsf@web.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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <83k43bs89t.fsf@gnu.org> Date: Sat, 25 Feb 2012 04:56:18 -0500 In-Reply-To: <83k43bs89t.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 25 Feb 2012 09:05:02 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus , thierry.volpiatto@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >> > If FILE1 and FILE2 have different 'files-equal-p handlers, which one >> > of them, if any, should be invoked here? >> The one for FILE1. > Can you explain why? It's just a convention. We already do that in the few other file primitives that bump into the same problem. > My question wasn't rhetorical, it was due to a real confusion about > what should be done in this situation and why. It's the responsibility of FILE1's handler to check FILE2's handler. >> > Also, if each file has a different handler, doesn't that in >> > itself already mean the files are not equal? No: /foo should be equal to file:///foo (if you use url-handler-mode) but they don't use the same handler. >> We shouldn't add too much to file name handler optimization here. >> The handler will know what to do. > "Will know" how? Is it documented anywhere how to write a handler so > it handles such situations? If so, please point me to that > documentation, and perhaps I will see the light there. There is no right answer, in general, so no it's not documented. But at least the file handler's writer, thanks to his knowledge of the special semantics of his handler, should be able to write something useful. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 25 08:05:56 2012 Received: (at 10489) by debbugs.gnu.org; 25 Feb 2012 13:05:56 +0000 Received: from localhost ([127.0.0.1]:55266 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1HJz-000718-Qk for submit@debbugs.gnu.org; Sat, 25 Feb 2012 08:05:56 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:52047) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S1HJx-000710-Gd for 10489@debbugs.gnu.org; Sat, 25 Feb 2012 08:05:54 -0500 Received: (qmail invoked by alias); 25 Feb 2012 13:03:12 -0000 Received: from p57BB96D1.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.150.209] by mail.gmx.net (mp038) with SMTP; 25 Feb 2012 14:03:12 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1/z/iwXL3/zqvdEzARMJkspO+EQOLGfEAo4D6EaHs hq1cIAbo7VqqHi From: Michael Albinus To: Eli Zaretskii Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <83k43bs89t.fsf@gnu.org> Date: Sat, 25 Feb 2012 14:03:04 +0100 In-Reply-To: <83k43bs89t.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 25 Feb 2012 09:05:02 +0200") Message-ID: <87399zxdyv.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, thierry.volpiatto@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Eli Zaretskii writes: >> Likely, there won't be different handlers. It's always >> `tramp-file-name-handler', which calls the respective sub-handlers. > > ??? Are we to assume that a file-handler is always the Tramp handler? > What about others, like jka-compr? I stay corrected, there's also `url-file-handler'. For the other file name handlers, I do not expect that they will offer an own implementation of `files-equal-p' and alike. They will go out of the way. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 25 08:08:55 2012 Received: (at 10489) by debbugs.gnu.org; 25 Feb 2012 13:08:55 +0000 Received: from localhost ([127.0.0.1]:55270 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1HMr-00075O-NG for submit@debbugs.gnu.org; Sat, 25 Feb 2012 08:08:54 -0500 Received: from mailout-de.gmx.net ([213.165.64.23]:48875) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S1HMp-00075H-Ny for 10489@debbugs.gnu.org; Sat, 25 Feb 2012 08:08:52 -0500 Received: (qmail invoked by alias); 25 Feb 2012 13:06:06 -0000 Received: from p57BB96D1.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.150.209] by mail.gmx.net (mp027) with SMTP; 25 Feb 2012 14:06:06 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX19pEMdjNcJpAJGnkIi+IB33sYLRdJmaxT3OO2Q5EW B/ynSj26bhCAWS From: Michael Albinus To: Stefan Monnier Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <83k43bs89t.fsf@gnu.org> Date: Sat, 25 Feb 2012 14:05:58 +0100 In-Reply-To: (Stefan Monnier's message of "Sat, 25 Feb 2012 04:56:18 -0500") Message-ID: <87y5rrvz9l.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: Eli Zaretskii , 10489@debbugs.gnu.org, thierry.volpiatto@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Stefan Monnier writes: >> "Will know" how? Is it documented anywhere how to write a handler so >> it handles such situations? If so, please point me to that >> documentation, and perhaps I will see the light there. > > There is no right answer, in general, so no it's not documented. But at > least the file handler's writer, thanks to his knowledge of the special > semantics of his handler, should be able to write something useful. Existing handlers behave correctly, as far as I see. But maybe we could add a sentence fo files.texi, node "Magic File Names", that a handler shall be aware of this. > Stefan Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 25 09:38:03 2012 Received: (at 10489) by debbugs.gnu.org; 25 Feb 2012 14:38:03 +0000 Received: from localhost ([127.0.0.1]:55287 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1Il9-0000jF-4E for submit@debbugs.gnu.org; Sat, 25 Feb 2012 09:38:03 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:8004) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1Il7-0000ir-If for 10489@debbugs.gnu.org; Sat, 25 Feb 2012 09:38:02 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AicFAKU/KE9MCodT/2dsb2JhbACBX5x7eYhwnhmGGQSGUJRJhAs X-IronPort-AV: E=Sophos;i="4.73,1,1325480400"; d="scan'208";a="164567410" Received: from 76-10-135-83.dsl.teksavvy.com (HELO pastel.home) ([76.10.135.83]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 25 Feb 2012 09:35:20 -0500 Received: by pastel.home (Postfix, from userid 20848) id 5A19E5941E; Sat, 25 Feb 2012 09:35:20 -0500 (EST) From: Stefan Monnier To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Message-ID: References: <87mx9su32g.fsf@web.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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <83k43bs89t.fsf@gnu.org> <87399zxdyv.fsf@gmx.de> Date: Sat, 25 Feb 2012 09:35:20 -0500 In-Reply-To: <87399zxdyv.fsf@gmx.de> (Michael Albinus's message of "Sat, 25 Feb 2012 14:03:04 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: Eli Zaretskii , 10489@debbugs.gnu.org, thierry.volpiatto@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >>> Likely, there won't be different handlers. It's always >>> `tramp-file-name-handler', which calls the respective sub-handlers. >> ??? Are we to assume that a file-handler is always the Tramp handler? >> What about others, like jka-compr? > I stay corrected, there's also `url-file-handler'. I'm sure there are others. I seem to remember bumping into a package recently which implemented yet another file-name-handler of the same general kind. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 25 09:59:55 2012 Received: (at 10489) by debbugs.gnu.org; 25 Feb 2012 14:59:55 +0000 Received: from localhost ([127.0.0.1]:56356 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1J6I-0001Te-Ia for submit@debbugs.gnu.org; Sat, 25 Feb 2012 09:59:55 -0500 Received: from mail-we0-f172.google.com ([74.125.82.172]:46395) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1J6G-0001TW-3d for 10489@debbugs.gnu.org; Sat, 25 Feb 2012 09:59:53 -0500 Received: by werb10 with SMTP id b10so201701wer.3 for <10489@debbugs.gnu.org>; Sat, 25 Feb 2012 06:57:11 -0800 (PST) Received-SPF: pass (google.com: domain of lennart.borgman@gmail.com designates 10.180.101.72 as permitted sender) client-ip=10.180.101.72; Authentication-Results: mr.google.com; spf=pass (google.com: domain of lennart.borgman@gmail.com designates 10.180.101.72 as permitted sender) smtp.mail=lennart.borgman@gmail.com; dkim=pass header.i=lennart.borgman@gmail.com Received: from mr.google.com ([10.180.101.72]) by 10.180.101.72 with SMTP id fe8mr13977393wib.4.1330181831363 (num_hops = 1); Sat, 25 Feb 2012 06:57:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=tufsoKmqFnPmHCAyYXxRYg38Y+MglLBd3wYaD+ufZDE=; b=MAdyvZ4QuJGZSLm1/AnhG3EB1pHAkRVuW0TlHtxcorhbc3pbNBckvkD67of0316CF7 zGMT7fLu7O4/4nmzFSVXJm5qcPyFLjJrCvmWKAdVeSs0UTlpcHaBvtZ0S+OjU2RGNx8f IKN0st6xiN7toqgYRy2IbiH+b31UA8ZHDYoQs= Received: by 10.180.101.72 with SMTP id fe8mr11184079wib.4.1330181831208; Sat, 25 Feb 2012 06:57:11 -0800 (PST) MIME-Version: 1.0 Received: by 10.216.153.198 with HTTP; Sat, 25 Feb 2012 06:56:51 -0800 (PST) In-Reply-To: References: <87mx9su32g.fsf@web.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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <83k43bs89t.fsf@gnu.org> <87399zxdyv.fsf@gmx.de> From: Lennart Borgman Date: Sat, 25 Feb 2012 15:56:51 +0100 Message-ID: Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy To: Stefan Monnier Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus , thierry.volpiatto@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On Sat, Feb 25, 2012 at 15:35, Stefan Monnier wrote: >>>> Likely, there won't be different handlers. It's always >>>> `tramp-file-name-handler', which calls the respective sub-handlers. >>> ??? Are we to assume that a file-handler is always the Tramp handler? >>> What about others, like jka-compr? >> I stay corrected, there's also `url-file-handler'. > > I'm sure there are others. > I seem to remember bumping into a package recently which implemented yet > another file-name-handler of the same general kind. I have implemented one in nXhtml for handling file types that Emacs itself should not handle. From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 25 10:39:28 2012 Received: (at 10489) by debbugs.gnu.org; 25 Feb 2012 15:39:28 +0000 Received: from localhost ([127.0.0.1]:56366 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1JiZ-0002NM-Ve for submit@debbugs.gnu.org; Sat, 25 Feb 2012 10:39:28 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:45471) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S1JiX-0002NE-Ei for 10489@debbugs.gnu.org; Sat, 25 Feb 2012 10:39:26 -0500 Received: (qmail invoked by alias); 25 Feb 2012 15:36:43 -0000 Received: from p57BB96D1.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.150.209] by mail.gmx.net (mp038) with SMTP; 25 Feb 2012 16:36:43 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX18IJ685pkMI11XNEJVk35LgKUqqyQ4AI6e3AzD6lx 5qepq9Dgf+Qou/ From: Michael Albinus To: Stefan Monnier Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <83k43bs89t.fsf@gnu.org> Date: Sat, 25 Feb 2012 16:36:34 +0100 In-Reply-To: (Stefan Monnier's message of "Sat, 25 Feb 2012 04:56:18 -0500") Message-ID: <87sjhyx6v1.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: Eli Zaretskii , 10489@debbugs.gnu.org, thierry.volpiatto@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Stefan Monnier writes: >>> > Also, if each file has a different handler, doesn't that in >>> > itself already mean the files are not equal? > > No: /foo should be equal to file:///foo (if you use url-handler-mode) > but they don't use the same handler. It will be hard to detect that /sudo::/foo is equal to file:///foo. And the result might be different, when file:///foo and /sudo::/foo are compared, because another file name handler is involved. Maybe we shouldn't try to detect this, and we should regard them as not equal. > Stefan Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 25 10:56:12 2012 Received: (at 10489) by debbugs.gnu.org; 25 Feb 2012 15:56:12 +0000 Received: from localhost ([127.0.0.1]:56370 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1Jyl-0002mN-S7 for submit@debbugs.gnu.org; Sat, 25 Feb 2012 10:56:12 -0500 Received: from mail-ww0-f46.google.com ([74.125.82.46]:45135) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1Jyj-0002mF-Am for 10489@debbugs.gnu.org; Sat, 25 Feb 2012 10:56:10 -0500 Received: by wgbdt14 with SMTP id dt14so2697253wgb.15 for <10489@debbugs.gnu.org>; Sat, 25 Feb 2012 07:53:28 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.97.130 as permitted sender) client-ip=10.180.97.130; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.97.130 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.180.97.130]) by 10.180.97.130 with SMTP id ea2mr14062089wib.20.1330185208538 (num_hops = 1); Sat, 25 Feb 2012 07:53:28 -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=ysxLS54uMPJt7P9gErbmb9QHs21PGvjhf7a8wakZUNw=; b=VqV29r79kfbDznYk6LBPbP9TLaXwlZdFzoiBrVFP3wSVW400V/Q7hIGy9z5I/WY1kQ wfzW1SCkY3pA1Lp1mpKBm0RdOZ/WyGQOlpk6SV5rgPDjlN+HsX5ZhjjBRyhZUeUsfzEe 2tzHnErBmTDxdDQK0O/r7kSDZk2zE7g0BJBw0= Received: by 10.180.97.130 with SMTP id ea2mr11249135wib.20.1330185208455; Sat, 25 Feb 2012 07:53:28 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id df3sm10310986wib.1.2012.02.25.07.53.26 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 25 Feb 2012 07:53:27 -0800 (PST) From: Thierry Volpiatto To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <83k43bs89t.fsf@gnu.org> <87sjhyx6v1.fsf@gmx.de> Date: Sat, 25 Feb 2012 16:53:24 +0100 In-Reply-To: <87sjhyx6v1.fsf@gmx.de> (Michael Albinus's message of "Sat, 25 Feb 2012 16:36:34 +0100") Message-ID: <87obsmnc3v.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: Eli Zaretskii , 10489@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Michael Albinus writes: > Stefan Monnier writes: > >>>> > Also, if each file has a different handler, doesn't that in >>>> > itself already mean the files are not equal? >> >> No: /foo should be equal to file:///foo (if you use url-handler-mode) >> but they don't use the same handler. > > It will be hard to detect that /sudo::/foo is equal to file:///foo. And > the result might be different, when file:///foo and /sudo::/foo are > compared, because another file name handler is involved. > > Maybe we shouldn't try to detect this, and we should regard them as not > equal. Agree, don't think that in real life people try do something like copy /sudo::/foo ==> file:///foo -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 25 17:44:28 2012 Received: (at 10489) by debbugs.gnu.org; 25 Feb 2012 22:44:28 +0000 Received: from localhost ([127.0.0.1]:56487 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1QLs-0003cP-Gd for submit@debbugs.gnu.org; Sat, 25 Feb 2012 17:44:28 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.183]:20526) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1QLq-0003cJ-Vx for 10489@debbugs.gnu.org; Sat, 25 Feb 2012 17:44:27 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AicFAKU/KE9MCodT/2dsb2JhbACBX5x7eYhwnhmGGQSGUJRJhAs X-IronPort-AV: E=Sophos;i="4.73,1,1325480400"; d="scan'208";a="164640939" Received: from 76-10-135-83.dsl.teksavvy.com (HELO pastel.home) ([76.10.135.83]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 25 Feb 2012 17:41:44 -0500 Received: by pastel.home (Postfix, from userid 20848) id BDDC25941E; Sat, 25 Feb 2012 17:41:43 -0500 (EST) From: Stefan Monnier To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Message-ID: References: <87mx9su32g.fsf@web.de> <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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <83k43bs89t.fsf@gnu.org> <87sjhyx6v1.fsf@gmx.de> <87obsmnc3v.fsf@gmail.com> Date: Sat, 25 Feb 2012 17:41:43 -0500 In-Reply-To: <87obsmnc3v.fsf@gmail.com> (Thierry Volpiatto's message of "Sat, 25 Feb 2012 16:53:24 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: Eli Zaretskii , 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >> It will be hard to detect that /sudo::/foo is equal to file:///foo. Maybe (in this case it might be reasonably easy, but of course there are harder cases). But the fact that it's sometimes hard doesn't justify preventing file-handlers from trying to handle it when they can. I.e. don't just assume "different file-handler => different file". > Agree, don't think that in real life people try do something like > copy /sudo::/foo ==> file:///foo This whole bug report started because someone tried to make a similarly silly "copy to itself". Stefan From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 26 04:24:41 2012 Received: (at 10489) by debbugs.gnu.org; 26 Feb 2012 09:24:41 +0000 Received: from localhost ([127.0.0.1]:56720 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1aLQ-0001Zj-Nw for submit@debbugs.gnu.org; Sun, 26 Feb 2012 04:24:41 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:54232) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S1aLN-0001Za-EC for 10489@debbugs.gnu.org; Sun, 26 Feb 2012 04:24:38 -0500 Received: (qmail invoked by alias); 26 Feb 2012 09:21:51 -0000 Received: from p57BB9BF1.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.155.241] by mail.gmx.net (mp012) with SMTP; 26 Feb 2012 10:21:51 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX18hkMAOmjQhdOfjiI01EI6DST7j1d9+k5ThlinjYv 3vxXpVl4P8Mq9U From: Michael Albinus To: Stefan Monnier Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <83k43bs89t.fsf@gnu.org> <87sjhyx6v1.fsf@gmx.de> <87obsmnc3v.fsf@gmail.com> Date: Sun, 26 Feb 2012 10:21:42 +0100 In-Reply-To: (Stefan Monnier's message of "Sat, 25 Feb 2012 17:41:43 -0500") Message-ID: <87mx86vtjt.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Stefan Monnier writes: >>> It will be hard to detect that /sudo::/foo is equal to file:///foo. > > Maybe (in this case it might be reasonably easy, but of course there are > harder cases). We would need a function `file-local-representation' or something like this, which returns "/foo" in both file name handler implementations. Tramp's file name handler doesn't know of URL syntax, and vice versa. And no, I do NOT propose to add this. Sounds like overengineering to me. > Stefan Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 26 04:51:00 2012 Received: (at 10489) by debbugs.gnu.org; 26 Feb 2012 09:51:00 +0000 Received: from localhost ([127.0.0.1]:56771 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1akt-0003sU-Hg for submit@debbugs.gnu.org; Sun, 26 Feb 2012 04:51:00 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:43729) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S1aks-0003sN-1i for 10489@debbugs.gnu.org; Sun, 26 Feb 2012 04:50:58 -0500 Received: (qmail invoked by alias); 26 Feb 2012 09:48:12 -0000 Received: from p57BB9BF1.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.155.241] by mail.gmx.net (mp012) with SMTP; 26 Feb 2012 10:48:12 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1+nYPlpa56n/DXHMKVAx6U59Ru94PhoBbr1zU/I/T UudT0ttzHzib0/ From: Michael Albinus To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <87aa47rj6z.fsf@gmail.com> <878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com> Date: Sun, 26 Feb 2012 10:48:03 +0100 In-Reply-To: <87pqd3i8ky.fsf@gmail.com> (Thierry Volpiatto's message of "Sat, 25 Feb 2012 10:08:29 +0100") Message-ID: <87ipiuvsbw.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Thierry Volpiatto writes: >> Btw, it might be useful if you could add documentation about >> `files-equal-p' and `file-subdir-of-p' in doc/lispref/files.texi. > I will have a look. Thanks. The implementation of `files-equal-p' returns t, if both FILE1 and FILE2 do not exist. Either it is a bug, or it must be documented. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 26 14:51:46 2012 Received: (at 10489) by debbugs.gnu.org; 26 Feb 2012 19:51:46 +0000 Received: from localhost ([127.0.0.1]:58562 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1k8I-0003XM-CG for submit@debbugs.gnu.org; Sun, 26 Feb 2012 14:51:46 -0500 Received: from mail-ww0-f46.google.com ([74.125.82.46]:36706) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1k8E-0003XE-Pu for 10489@debbugs.gnu.org; Sun, 26 Feb 2012 14:51:44 -0500 Received: by wgbdq11 with SMTP id dq11so309093wgb.15 for <10489@debbugs.gnu.org>; Sun, 26 Feb 2012 11:48:55 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.14.73 as permitted sender) client-ip=10.180.14.73; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.14.73 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.180.14.73]) by 10.180.14.73 with SMTP id n9mr21880709wic.16.1330285735161 (num_hops = 1); Sun, 26 Feb 2012 11:48:55 -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=XMJHeVfbrl8k2NUqfD8I5rSQOMKkEdWuE66qrikb68Y=; b=SFVeOArwFQwkzCNgMj6civtFyqsvG/TVcu+xTKIvuVyjTmI9fJm1uxOYOPGxWNL1gQ T+oa56FQN/dJcSk3SUncDOjXZzxHthgfYh4jc6SHcmIGiieMB0SgaBdhyb2Di63S0ObV 0+tOYRz/5HkP5YjU7YUw3hMw2EZgBoUo1Vfig= Received: by 10.180.14.73 with SMTP id n9mr17461635wic.16.1330285735087; Sun, 26 Feb 2012 11:48:55 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id ft8sm17223266wib.11.2012.02.26.11.48.52 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 26 Feb 2012 11:48:54 -0800 (PST) From: Thierry Volpiatto To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <87aa47rj6z.fsf@gmail.com> <878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> Date: Sun, 26 Feb 2012 20:48:50 +0100 In-Reply-To: <87ipiuvsbw.fsf@gmx.de> (Michael Albinus's message of "Sun, 26 Feb 2012 10:48:03 +0100") Message-ID: <87k439gyu5.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Hi Michael, Michael Albinus writes: > Thierry Volpiatto writes: > >>> Btw, it might be useful if you could add documentation about >>> `files-equal-p' and `file-subdir-of-p' in doc/lispref/files.texi. >> I will have a look. > > Thanks. > > The implementation of `files-equal-p' returns t, Of course, (equal nil nil)=>t where nil and nil are the file-attributes of non--existing files. > if both FILE1 and FILE2 do not exist. Either it is a bug, or it must > be documented. We can fallback to string comparison when one of the file-attributes return nil. It would also make file-subdir-of-p working with non--existing dirnames. (with one optional arg): --8<---------------cut here---------------start------------->8--- diff --git a/lisp/files.el b/lisp/files.el --- a/lisp/files.el +++ b/lisp/files.el @@ -4991,10 +4991,16 @@ (find-file-name-handler file2 'files-equal-p)))) (if handler (funcall handler 'files-equal-p file1 file2) - (equal (file-attributes (file-truename file1)) - (file-attributes (file-truename file2)))))) - -(defun file-subdir-of-p (dir1 dir2) + (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) + (string= (file-truename + (file-name-as-directory file1)) + (file-truename + (file-name-as-directory file2)))))))) + +(defun file-subdir-of-p (dir1 dir2 &optional noexist) "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, @@ -5003,8 +5009,9 @@ (find-file-name-handler dir2 'file-subdir-of-p)))) (if handler (funcall handler 'file-subdir-of-p dir1 dir2) - (when (and (file-directory-p dir1) - (file-directory-p dir2)) + (when (or noexist + (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 "/")) --8<---------------cut here---------------end--------------->8--- -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 26 20:33:01 2012 Received: (at 10489) by debbugs.gnu.org; 27 Feb 2012 01:33:01 +0000 Received: from localhost ([127.0.0.1]:58671 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1pSW-0002o1-8h for submit@debbugs.gnu.org; Sun, 26 Feb 2012 20:33:01 -0500 Received: from chene.dit.umontreal.ca ([132.204.246.20]:51186) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1pSR-0002nm-Qh for 10489@debbugs.gnu.org; Sun, 26 Feb 2012 20:32:56 -0500 Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id q1R1U5pD015733; Sun, 26 Feb 2012 20:30:06 -0500 Received: by ceviche.home (Postfix, from userid 20848) id A9E6066231; Sun, 26 Feb 2012 16:38:41 -0500 (EST) From: Stefan Monnier To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Message-ID: References: <87mx9su32g.fsf@web.de> <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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <83k43bs89t.fsf@gnu.org> <87sjhyx6v1.fsf@gmx.de> <87obsmnc3v.fsf@gmail.com> <87mx86vtjt.fsf@gmx.de> Date: Sun, 26 Feb 2012 16:38:41 -0500 In-Reply-To: <87mx86vtjt.fsf@gmx.de> (Michael Albinus's message of "Sun, 26 Feb 2012 10:21:42 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4144=0 X-NAI-Spam-Version: 2.2.0.9309 : core <4144> : streams <732529> : uri <1072717> X-Spam-Score: -2.0 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.0 (--) >>>> It will be hard to detect that /sudo::/foo is equal to file:///foo. >> Maybe (in this case it might be reasonably easy, but of course there are >> harder cases). > We would need a function `file-local-representation' or something like > this, which returns "/foo" in both file name handler implementations. > Tramp's file name handler doesn't know of URL syntax, and vice versa. Tramp's knowledge of the semantics of "/sudo::" lets it simply turn (file-equal-p "/sudo::/foo" "file:///foo") into (file-equal-p "/foo" "file:///foo"), after which the url-handler-mode can do the same kind of trivial reasoning. > And no, I do NOT propose to add this. Sounds like overengineering to me. Neither do I. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 26 20:33:03 2012 Received: (at 10489) by debbugs.gnu.org; 27 Feb 2012 01:33:03 +0000 Received: from localhost ([127.0.0.1]:58673 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1pSX-0002oA-Kq for submit@debbugs.gnu.org; Sun, 26 Feb 2012 20:33:03 -0500 Received: from pruche.dit.umontreal.ca ([132.204.246.22]:38515) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1pSS-0002no-85 for 10489@debbugs.gnu.org; Sun, 26 Feb 2012 20:32:58 -0500 Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id q1R1U5BN003858; Sun, 26 Feb 2012 20:30:06 -0500 Received: by ceviche.home (Postfix, from userid 20848) id 8EF4C661AA; Sun, 26 Feb 2012 16:40:37 -0500 (EST) From: Stefan Monnier To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Message-ID: References: <87mx9su32g.fsf@web.de> <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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <87aa47rj6z.fsf@gmail.com> <878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> <87k439gyu5.fsf@gmail.com> Date: Sun, 26 Feb 2012 16:40:37 -0500 In-Reply-To: <87k439gyu5.fsf@gmail.com> (Thierry Volpiatto's message of "Sun, 26 Feb 2012 20:48:50 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Level: X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0.2 X-NAI-Spam-Rules: 2 Rules triggered GEN_SPAM_FEATRE=0.2, RV4144=0 X-NAI-Spam-Version: 2.2.0.9309 : core <4144> : streams <732529> : uri <1072717> X-Spam-Score: -2.0 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.0 (--) >> if both FILE1 and FILE2 do not exist. Either it is a bug, or it must >> be documented. Since file-equal-p checks equality of *files* as opposed to equality of file *names*, all we need to do is to remind (in the docstring) that this predicate is only defined on existing files. Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 01:48:48 2012 Received: (at 10489) by debbugs.gnu.org; 27 Feb 2012 06:48:48 +0000 Received: from localhost ([127.0.0.1]:58768 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1uO7-0001Wj-CO for submit@debbugs.gnu.org; Mon, 27 Feb 2012 01:48:47 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:57572) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1uO4-0001Wb-Dg for 10489@debbugs.gnu.org; Mon, 27 Feb 2012 01:48:45 -0500 Received: by wicr5 with SMTP id r5so491330wic.3 for <10489@debbugs.gnu.org>; Sun, 26 Feb 2012 22:45:54 -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 Received: from mr.google.com ([10.180.77.228]) by 10.180.77.228 with SMTP id v4mr25096601wiw.2.1330325154051 (num_hops = 1); Sun, 26 Feb 2012 22:45:54 -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=Yli0j/kC6+brjzUakeWj/RWjBsfqxM92eETxEGYJDRg=; b=EY8JGTS4Wo5nUvLD7BVva3KG9joJZUL/o7saV9Tp5wWiNpUxGK/rza8xNycIHaFXFT oApNDKhOffvJjIOEPj4YDHnQrSSgj65oXbUGhdRKUK7w1uLuPNtBP0Y6oGIOc8n9PZMC l51Py/3+NTOI14jz5VcmhY3NLsw7LiczaLXsk= Received: by 10.180.77.228 with SMTP id v4mr19924196wiw.2.1330325153975; Sun, 26 Feb 2012 22:45:53 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id er8sm50773546wib.1.2012.02.26.22.45.51 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 26 Feb 2012 22:45:52 -0800 (PST) From: Thierry Volpiatto To: Stefan Monnier Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <87aa47rj6z.fsf@gmail.com> <878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> <87k439gyu5.fsf@gmail.com> Date: Mon, 27 Feb 2012 07:45:49 +0100 In-Reply-To: (Stefan Monnier's message of "Sun, 26 Feb 2012 16:40:37 -0500") Message-ID: <87fwdwhizm.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Stefan Monnier writes: >>> if both FILE1 and FILE2 do not exist. Either it is a bug, or it must >>> be documented. > > Since file-equal-p checks equality of *files* as opposed to equality of > file *names*, all we need to do is to remind (in the docstring) that > this predicate is only defined on existing files. I have modified files-equal-p and file-subdir-of-p to work with non--existing files, this allow to remove one call to file-subdir-of-p in copy-directory and not create the initial top directory in this case (not in this patch yet). --8<---------------cut here---------------start------------->8--- diff --git a/lisp/files.el b/lisp/files.el --- a/lisp/files.el +++ b/lisp/files.el @@ -4986,25 +4986,33 @@ (delete-directory-internal directory))))) (defun files-equal-p (file1 file2) - "Return non-nil if FILE1 and FILE2 name the same file." + "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) - (equal (file-attributes (file-truename file1)) - (file-attributes (file-truename file2)))))) - -(defun file-subdir-of-p (dir1 dir2) + (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) + (string= (file-truename + (file-name-as-directory file1)) + (file-truename + (file-name-as-directory file2)))))))) + +(defun file-subdir-of-p (dir1 dir2 &optional noexist) "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." +This function only works when its two arguments already exist unless +optional argument NOEXIST is non--nil, otherwise 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 - (funcall handler 'file-subdir-of-p dir1 dir2) - (when (and (file-directory-p dir1) - (file-directory-p dir2)) + (funcall handler 'file-subdir-of-p dir1 dir2 noexist) + (when (or noexist + (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 "/")) --8<---------------cut here---------------end--------------->8--- I will apply it today if no objections. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 02:48:54 2012 Received: (at 10489) by debbugs.gnu.org; 27 Feb 2012 07:48:54 +0000 Received: from localhost ([127.0.0.1]:58820 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1vKH-0002wN-SP for submit@debbugs.gnu.org; Mon, 27 Feb 2012 02:48:54 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:64291) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1vKF-0002w9-9O for 10489@debbugs.gnu.org; Mon, 27 Feb 2012 02:48:52 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AicFAKU/KE9FxJvl/2dsb2JhbACBX5x7eYhwnhmGGQSGUJRJhAs X-IronPort-AV: E=Sophos;i="4.73,1,1325480400"; d="scan'208";a="164779991" Received: from 69-196-155-229.dsl.teksavvy.com (HELO pastel.home) ([69.196.155.229]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 27 Feb 2012 02:46:00 -0500 Received: by pastel.home (Postfix, from userid 20848) id C96D3594FB; Mon, 27 Feb 2012 02:45:58 -0500 (EST) From: Stefan Monnier To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Message-ID: References: <87mx9su32g.fsf@web.de> <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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <87aa47rj6z.fsf@gmail.com> <878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> <87k439gyu5.fsf@gmail.com> <87fwdwhizm.fsf@gmail.com> Date: Mon, 27 Feb 2012 02:45:58 -0500 In-Reply-To: <87fwdwhizm.fsf@gmail.com> (Thierry Volpiatto's message of "Mon, 27 Feb 2012 07:45:49 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > I have modified files-equal-p and file-subdir-of-p to work with > non--existing files, Calling files-equal-p on non-existing files makes no sense, so I don't think we should support it (at least not until we have concrete evidence that it is needed, at which point we can decide what we intend it to mean). Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 03:07:21 2012 Received: (at 10489) by debbugs.gnu.org; 27 Feb 2012 08:07:21 +0000 Received: from localhost ([127.0.0.1]:58833 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1vc8-0003M4-Q0 for submit@debbugs.gnu.org; Mon, 27 Feb 2012 03:07:21 -0500 Received: from mail-ww0-f46.google.com ([74.125.82.46]:54961) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1vc6-0003Lx-JZ for 10489@debbugs.gnu.org; Mon, 27 Feb 2012 03:07:20 -0500 Received: by wgbdq11 with SMTP id dq11so561267wgb.15 for <10489@debbugs.gnu.org>; Mon, 27 Feb 2012 00:04:28 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.83.97 as permitted sender) client-ip=10.180.83.97; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.83.97 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.180.83.97]) by 10.180.83.97 with SMTP id p1mr25188367wiy.19.1330329868206 (num_hops = 1); Mon, 27 Feb 2012 00:04:28 -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=g0AGFuqFda04tBgLuiAP7k2365ouxkCkJ8b6J3zv5hg=; b=K0F5a1qwGANhpZx6Vic5aqHxDVxkpO7nTNT12ust7181RzM0kvMu1IYIpOwiozxwDr bRM0lYSTyz5LIK5Y3AvzWqf5AhSeNd/j9JPti8Id4Q2CjuAG2hmmREpmJE8Zh0uIntcC km6/rL4BBElSnTyYx2vUBvo+0VpLsJ4x0T5ro= Received: by 10.180.83.97 with SMTP id p1mr20003183wiy.19.1330329868128; Mon, 27 Feb 2012 00:04:28 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id s4sm43973017wiy.5.2012.02.27.00.04.26 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 27 Feb 2012 00:04:27 -0800 (PST) From: Thierry Volpiatto To: Stefan Monnier Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <87aa47rj6z.fsf@gmail.com> <878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> <87k439gyu5.fsf@gmail.com> <87fwdwhizm.fsf@gmail.com> Date: Mon, 27 Feb 2012 09:04:24 +0100 In-Reply-To: (Stefan Monnier's message of "Mon, 27 Feb 2012 02:45:58 -0500") Message-ID: <87bookhfcn.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Stefan Monnier writes: >> I have modified files-equal-p and file-subdir-of-p to work with >> non--existing files, > > Calling files-equal-p on non-existing files makes no sense, so I don't > think we should support it (at least not until we have concrete > evidence that it is needed, at which point we can decide what we intend > it to mean). It is useful to handle e.g (copy-directory "~/test" "~/test/test1") where test1 is a non--existing directory. Actually a check is done once test1 is build and stop the loop, so this would avoid creating an unuseful new directory. We could give an optional arg noexist to files-equal-p. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 03:22:40 2012 Received: (at 10489) by debbugs.gnu.org; 27 Feb 2012 08:22:41 +0000 Received: from localhost ([127.0.0.1]:58840 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1vqy-0003hM-Es for submit@debbugs.gnu.org; Mon, 27 Feb 2012 03:22:40 -0500 Received: from mailout-de.gmx.net ([213.165.64.23]:47277) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S1vqw-0003hE-5A for 10489@debbugs.gnu.org; Mon, 27 Feb 2012 03:22:39 -0500 Received: (qmail invoked by alias); 27 Feb 2012 08:19:46 -0000 Received: from p57BB9732.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.151.50] by mail.gmx.net (mp071) with SMTP; 27 Feb 2012 09:19:46 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1/W1upsaf7WkoQt6QbqIfjAwlnKa3olbT5Ze4pi/+ KkyGwpgZbkYVo6 From: Michael Albinus To: Stefan Monnier Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <83k43bs89t.fsf@gnu.org> <87sjhyx6v1.fsf@gmx.de> <87obsmnc3v.fsf@gmail.com> <87mx86vtjt.fsf@gmx.de> Date: Mon, 27 Feb 2012 09:19:37 +0100 In-Reply-To: (Stefan Monnier's message of "Sun, 26 Feb 2012 16:38:41 -0500") Message-ID: <87aa44elie.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Stefan Monnier writes: > Tramp's knowledge of the semantics of "/sudo::" lets it simply turn > (file-equal-p "/sudo::/foo" "file:///foo") into (file-equal-p "/foo" > "file:///foo"), after which the url-handler-mode can do the same kind of > trivial reasoning. Hmm. Yes. How simple :-) > Stefan Thanks, and best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 03:42:21 2012 Received: (at 10489) by debbugs.gnu.org; 27 Feb 2012 08:42:21 +0000 Received: from localhost ([127.0.0.1]:58862 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1wA0-000495-Hd for submit@debbugs.gnu.org; Mon, 27 Feb 2012 03:42:21 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:40866) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S1w9x-00048w-Pc for 10489@debbugs.gnu.org; Mon, 27 Feb 2012 03:42:18 -0500 Received: (qmail invoked by alias); 27 Feb 2012 08:39:25 -0000 Received: from p57BB9732.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.151.50] by mail.gmx.net (mp038) with SMTP; 27 Feb 2012 09:39:25 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1/rSZYxABTrVfzMlVmQR9CHU5waXOquuJYKWkYLQR +dGt/0P6smcmbQ From: Michael Albinus To: Eli Zaretskii Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.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> <87haygie87.fsf@gmx.de> <83wr7cs3l7.fsf@gnu.org> <8762ewi7im.fsf@gmx.de> <83r4xkrpal.fsf@gnu.org> <87d394x957.fsf@gmx.de> <83obsnsaa4.fsf@gnu.org> Date: Mon, 27 Feb 2012 09:39:16 +0100 In-Reply-To: <83obsnsaa4.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 25 Feb 2012 08:21:39 +0200") Message-ID: <8762esekln.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, thierry.volpiatto@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Eli Zaretskii writes: >> >> Disconnected R: \\ASLSDA0\ZENTRAL Microsoft Windows Network >> >> OK U: \\DESTGSFILN2\lb01177$ Microsoft Windows Network >> >> OK Y: \\sambager1\albinus Microsoft Windows Network >> >> The command completed successfully. >> >> --8<---------------cut here---------------end--------------->8--- >> > >> > And all of the \\server\share\foo directories, and also those below >> > them, return zero inodes? >> >> I haven't checked. If it's important, I could do on Monday. Just tell me. > > I'd like to know the extent of the problem. Specifically, does _any_ > networked drive trigger this problem, or just some of them? If the > latter, is it perhaps limited to Samba (which seems to be the type of > the mount there), or anyway to the specific kind of software that > manages the mounted volume? OK, here we are. The active network drives are DESTGSFILN2, which says Domain=[RES1] OS=[Windows Server 2003 3790 Service Pack 2] Server=[Windows Server 2003 5.2] and sambager1, claiming Domain=[RES1] OS=[Unix] Server=[Samba 3.4.9] My local machine, running Emacs 24.0.91, says Domain=[EMEA] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager] It seems to run Windows XP Pro Service Pack 3. I'm not aware of a special program mounting network drives. The test results are: --8<---------------cut here---------------start------------->8--- (file-attributes "//DESTGSFILN2/lb01177$") (t 1 101567 513 (0 0) (0 0) (0 0) 0 "drwxrwxrwx" nil 0 (40652 . 16428)) (file-attributes "//DESTGSFILN2/lb01177$/.emacs.d") (t 1 101567 513 (20299 16187) (18667 19266) (18567 12095) 0 "drwxrwxrwx" nil 0 (40652 . 16428)) (file-attributes "//DESTGSFILN2/lb01177$/.emacs.d/tramp") (nil 1 101567 513 (19690 12422) (18667 19266) (18667 19266) 926 "-rw-rw-rw-" nil 0 (40652 . 16428)) (file-attributes "//sambager1/albinus") (t 1 101567 513 (0 0) (0 0) (0 0) 0 "drwxrwxrwx" nil 0 (47631 . 5881)) (file-attributes "//sambager1/albinus/.emacs.d") (t 1 101567 513 (20299 15958) (20295 47753) (20295 47753) 0 "drwxrwxrwx" nil 0 (47631 . 5881)) (file-attributes "//sambager1/albinus/.emacs.d/tramp") (nil 1 101567 513 (20299 14091) (20295 47753) (20295 47753) 14769 "-rw-rw-rw-" nil 0 (47631 . 5881)) --8<---------------cut here---------------end--------------->8--- I would say, that a zero inode is returned in any case of a network drive located file. > TIA Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 05:37:19 2012 Received: (at 10489) by debbugs.gnu.org; 27 Feb 2012 10:37:19 +0000 Received: from localhost ([127.0.0.1]:59044 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1xxH-0008Tz-EU for submit@debbugs.gnu.org; Mon, 27 Feb 2012 05:37:19 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.183]:65370) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1xxF-0008Tr-Hq for 10489@debbugs.gnu.org; Mon, 27 Feb 2012 05:37:18 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AicFAKU/KE9FxJvl/2dsb2JhbACBX5x7eYhwnhmGGQSGUJRJhAs X-IronPort-AV: E=Sophos;i="4.73,1,1325480400"; d="scan'208";a="164785123" Received: from 69-196-155-229.dsl.teksavvy.com (HELO pastel.home) ([69.196.155.229]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 27 Feb 2012 05:34:26 -0500 Received: by pastel.home (Postfix, from userid 20848) id 9737F58AB7; Mon, 27 Feb 2012 05:34:25 -0500 (EST) From: Stefan Monnier To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Message-ID: References: <87mx9su32g.fsf@web.de> <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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <87aa47rj6z.fsf@gmail.com> <878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> <87k439gyu5.fsf@gmail.com> <87fwdwhizm.fsf@gmail.com> <87bookhfcn.fsf@gmail.com> Date: Mon, 27 Feb 2012 05:34:25 -0500 In-Reply-To: <87bookhfcn.fsf@gmail.com> (Thierry Volpiatto's message of "Mon, 27 Feb 2012 09:04:24 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >>> I have modified files-equal-p and file-subdir-of-p to work with >>> non--existing files, >> Calling files-equal-p on non-existing files makes no sense, so I don't >> think we should support it (at least not until we have concrete >> evidence that it is needed, at which point we can decide what we intend >> it to mean). > It is useful to handle e.g > (copy-directory "~/test" "~/test/test1") > where test1 is a non--existing directory. I see why we might want to signal an error to the user when she does (copy-directory "~/test" "~/test/test1"), but I don't see why that implies that we need files-equal-p to handle non-existent files. Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 05:42:23 2012 Received: (at 10489) by debbugs.gnu.org; 27 Feb 2012 10:42:23 +0000 Received: from localhost ([127.0.0.1]:59048 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1y2B-00009F-1x for submit@debbugs.gnu.org; Mon, 27 Feb 2012 05:42:23 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:16156) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1y29-000099-GT for 10489@debbugs.gnu.org; Mon, 27 Feb 2012 05:42:21 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AicFAKU/KE9FxJvl/2dsb2JhbACBX5x7eYhwnhmGGQSGUJRJhAs X-IronPort-AV: E=Sophos;i="4.73,1,1325480400"; d="scan'208";a="164785194" Received: from 69-196-155-229.dsl.teksavvy.com (HELO pastel.home) ([69.196.155.229]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 27 Feb 2012 05:39:30 -0500 Received: by pastel.home (Postfix, from userid 20848) id 4519F58AB7; Mon, 27 Feb 2012 05:39:30 -0500 (EST) From: Stefan Monnier To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Message-ID: References: <87mx9su32g.fsf@web.de> <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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <83k43bs89t.fsf@gnu.org> <87sjhyx6v1.fsf@gmx.de> <87obsmnc3v.fsf@gmail.com> <87mx86vtjt.fsf@gmx.de> <87aa44elie.fsf@gmx.de> Date: Mon, 27 Feb 2012 05:39:30 -0500 In-Reply-To: <87aa44elie.fsf@gmx.de> (Michael Albinus's message of "Mon, 27 Feb 2012 09:19:37 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >> Tramp's knowledge of the semantics of "/sudo::" lets it simply turn >> (file-equal-p "/sudo::/foo" "file:///foo") into (file-equal-p "/foo" >> "file:///foo"), after which the url-handler-mode can do the same kind of >> trivial reasoning. > Hmm. Yes. How simple :-) I suspect this simple approach wouldn't quite work in various corner cases (e.g. when testing (file-equal-p "/sudo::/foo/bar" "file:///baz") and where /foo/bar is a symlink to /baz, but where /foo is only accessible to root ;-) Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 05:43:37 2012 Received: (at 10489) by debbugs.gnu.org; 27 Feb 2012 10:43:37 +0000 Received: from localhost ([127.0.0.1]:59052 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1y3N-0000Az-An for submit@debbugs.gnu.org; Mon, 27 Feb 2012 05:43:37 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:61215) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1y3K-0000Ar-PW for 10489@debbugs.gnu.org; Mon, 27 Feb 2012 05:43:35 -0500 Received: by wicr5 with SMTP id r5so609017wic.3 for <10489@debbugs.gnu.org>; Mon, 27 Feb 2012 02:40:43 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.107.99 as permitted sender) client-ip=10.180.107.99; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.107.99 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.180.107.99]) by 10.180.107.99 with SMTP id hb3mr26809847wib.5.1330339243868 (num_hops = 1); Mon, 27 Feb 2012 02:40:43 -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=dvp/+nlgt90IxzLfegy0rexhOduz02FjqgVtk7MMEQ4=; b=b2+gm7qKLHRR88d5Ofw8D0yU4xCJuLg4miMJMqy09UYF/+FUb4EVpYbxdLUHzy02Go ZfHZX++Rof+FsO3CzRrKVo1M5nvCdFQqbD3TFFf4KdCPk4fkC6uzgf4Q55aobiC7sYxW FxOwSVk2eok6BFtta7hyiKkEY36mpDCjWw40w= Received: by 10.180.107.99 with SMTP id hb3mr21282825wib.5.1330339243731; Mon, 27 Feb 2012 02:40:43 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id m8sm53229315wia.11.2012.02.27.02.40.41 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 27 Feb 2012 02:40:42 -0800 (PST) From: Thierry Volpiatto To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <87aa47rj6z.fsf@gmail.com> <878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> Date: Mon, 27 Feb 2012 11:40:40 +0100 In-Reply-To: <87ipiuvsbw.fsf@gmx.de> (Michael Albinus's message of "Sun, 26 Feb 2012 10:48:03 +0100") Message-ID: <87ehtgo8yf.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Michael Albinus writes: > Thierry Volpiatto writes: > >>> Btw, it might be useful if you could add documentation about >>> `files-equal-p' and `file-subdir-of-p' in doc/lispref/files.texi. >> I will have a look. > > Thanks. > > The implementation of `files-equal-p' returns t, if both FILE1 and FILE2 > do not exist. Either it is a bug, or it must be documented. > > Best regards, Michael. To finish this thread, I would like to say I am not happy with the last changes made to file-subdir-of-p by Chong Yidong without ANY notifications. Even after discussion about CL integration in Emacs, it seem it is not for tomorrow. i.e what is your problem with loop? You will see that files.el contain this code at beginning of file: (eval-when-compile (require 'cl)) -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 06:06:11 2012 Received: (at 10489) by debbugs.gnu.org; 27 Feb 2012 11:06:11 +0000 Received: from localhost ([127.0.0.1]:59058 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1yPD-0000hF-82 for submit@debbugs.gnu.org; Mon, 27 Feb 2012 06:06:11 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:51916) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S1yPA-0000h6-Qq for 10489@debbugs.gnu.org; Mon, 27 Feb 2012 06:06:10 -0500 Received: (qmail invoked by alias); 27 Feb 2012 11:03:16 -0000 Received: from p57BB9732.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.151.50] by mail.gmx.net (mp038) with SMTP; 27 Feb 2012 12:03:16 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX18g2XZ/Y04gZRGcD3e0mGY7pWu54cP07iZNIBeHMK jxaEnwTxpht5EU From: Michael Albinus To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <87aa47rj6z.fsf@gmail.com> <878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> <87ehtgo8yf.fsf@gmail.com> Date: Mon, 27 Feb 2012 12:03:06 +0100 In-Reply-To: <87ehtgo8yf.fsf@gmail.com> (Thierry Volpiatto's message of "Mon, 27 Feb 2012 11:40:40 +0100") Message-ID: <87pqd0pmhh.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Thierry Volpiatto writes: > To finish this thread, I would like to say I am not happy with the last > changes made to file-subdir-of-p by Chong Yidong without ANY > notifications. > Even after discussion about CL integration in Emacs, it seem it is not > for tomorrow. > i.e what is your problem with loop? I cannot speak for Chong, but personally I dislike CL's loop. It isn't readable, and so it decreases maintanability of such a basic package like files.el. From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 06:09:53 2012 Received: (at 10489) by debbugs.gnu.org; 27 Feb 2012 11:09:53 +0000 Received: from localhost ([127.0.0.1]:59078 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1ySm-0000me-7Y for submit@debbugs.gnu.org; Mon, 27 Feb 2012 06:09:53 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:52750) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1ySj-0000mT-ME for 10489@debbugs.gnu.org; Mon, 27 Feb 2012 06:09:51 -0500 Received: by wicr5 with SMTP id r5so623764wic.3 for <10489@debbugs.gnu.org>; Mon, 27 Feb 2012 03:06:58 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.103.97 as permitted sender) client-ip=10.180.103.97; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.103.97 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.180.103.97]) by 10.180.103.97 with SMTP id fv1mr26775091wib.17.1330340818677 (num_hops = 1); Mon, 27 Feb 2012 03:06:58 -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=CbwtsED5qDzBMSNawga3me/aI9tf6q+Zy8AdKon9XYs=; b=BgEE9c15gJNfsc9v1/h5EkbokOUizlv5qTv0cXn+PAHV0BnStRHcPtzX1XgotxsvST vTjhcbVaiG0phxEkuxpARAzvkNahZs0NsaxRyteJHdGOszD2HLdpgsjyny5ekNo9r3Ol hkmfXyxYy57y1UOSkLkNtm2xzyt0uzJU1gPO0= Received: by 10.180.103.97 with SMTP id fv1mr21271339wib.17.1330340818614; Mon, 27 Feb 2012 03:06:58 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id fw5sm21191215wib.0.2012.02.27.03.06.56 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 27 Feb 2012 03:06:57 -0800 (PST) From: Thierry Volpiatto To: Stefan Monnier Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <87aa47rj6z.fsf@gmail.com> <878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> <87k439gyu5.fsf@gmail.com> <87fwdwhizm.fsf@gmail.com> <87bookhfcn.fsf@gmail.com> Date: Mon, 27 Feb 2012 12:06:55 +0100 In-Reply-To: (Stefan Monnier's message of "Mon, 27 Feb 2012 05:34:25 -0500") Message-ID: <87aa44o7qo.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Stefan Monnier writes: >>>> I have modified files-equal-p and file-subdir-of-p to work with >>>> non--existing files, >>> Calling files-equal-p on non-existing files makes no sense, so I don't >>> think we should support it (at least not until we have concrete >>> evidence that it is needed, at which point we can decide what we intend >>> it to mean). >> It is useful to handle e.g >> (copy-directory "~/test" "~/test/test1") >> where test1 is a non--existing directory. > > I see why we might want to signal an error to the user when she does > (copy-directory "~/test" "~/test/test1"), but I don't see why that > implies that we need files-equal-p to handle non-existent files. Because if we don't do that, we have to create new directory Test1 and then test if Test1 is a subdir of Test. This just to avoid that. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 06:14:03 2012 Received: (at 10489) by debbugs.gnu.org; 27 Feb 2012 11:14:03 +0000 Received: from localhost ([127.0.0.1]:59083 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1yWn-0000st-BQ for submit@debbugs.gnu.org; Mon, 27 Feb 2012 06:14:02 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:44891) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S1yWl-0000sZ-P4 for 10489@debbugs.gnu.org; Mon, 27 Feb 2012 06:14:00 -0500 Received: (qmail invoked by alias); 27 Feb 2012 11:11:07 -0000 Received: from p57BB9732.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.151.50] by mail.gmx.net (mp034) with SMTP; 27 Feb 2012 12:11:07 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX192gBs9Zn92zH0L1C03cR9x5mKNaekTdYKPessre5 9fiCbaVsmVkJL+ From: Michael Albinus To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87vcmwwvk7.fsf@gmail.com> <834nugtwqf.fsf@gnu.org> <87r4xkwhky.fsf@gmail.com> <83vcmws3bs.fsf@gnu.org> <87ehtkwaiz.fsf@gmail.com> <87wr7cgsm3.fsf@gmx.de> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <87aa47rj6z.fsf@gmail.com> <878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> <87k439gyu5.fsf@gmail.com> <87fwdwhizm.fsf@gmail.com> <87bookhfcn.fsf@gmail.com> <87aa44o7qo.fsf@gmail.com> Date: Mon, 27 Feb 2012 12:10:57 +0100 In-Reply-To: <87aa44o7qo.fsf@gmail.com> (Thierry Volpiatto's message of "Mon, 27 Feb 2012 12:06:55 +0100") Message-ID: <87linopm4e.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Thierry Volpiatto writes: >> I see why we might want to signal an error to the user when she does >> (copy-directory "~/test" "~/test/test1"), but I don't see why that >> implies that we need files-equal-p to handle non-existent files. > Because if we don't do that, we have to create new directory Test1 and > then test if Test1 is a subdir of Test. > This just to avoid that. This has to be handled in copy-directory. files-equal-p can (will!) be used also somewhere else. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 06:32:06 2012 Received: (at 10489) by debbugs.gnu.org; 27 Feb 2012 11:32:06 +0000 Received: from localhost ([127.0.0.1]:59124 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1yoH-0001M2-Ja for submit@debbugs.gnu.org; Mon, 27 Feb 2012 06:32:05 -0500 Received: from mail-ww0-f46.google.com ([74.125.82.46]:40347) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1yoF-0001Lv-G3 for 10489@debbugs.gnu.org; Mon, 27 Feb 2012 06:32:04 -0500 Received: by wgbdq11 with SMTP id dq11so705152wgb.15 for <10489@debbugs.gnu.org>; Mon, 27 Feb 2012 03:29:12 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.86.134 as permitted sender) client-ip=10.180.86.134; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.86.134 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.180.86.134]) by 10.180.86.134 with SMTP id p6mr26858023wiz.0.1330342152203 (num_hops = 1); Mon, 27 Feb 2012 03:29:12 -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=cj9Mc36z7W6MNoHGbxqj6IhGo2465lbzSOIE6RWP/tg=; b=h/HgkeijobMbBEjOnCN43ty+1SWIEId0xDeOqd3TnxCvJlmLVCqhSH945Ys/rwRLz3 6G0bLU7dKfhDE8zOCHe6JVPuBx7MbuimaYyQYKgaKJsZQhPfl78r+EmH25fx68QB1Vh6 hc/qwODhCEDVvX+1SpxjIIoNUz8xLw4rMdTwM= Received: by 10.180.86.134 with SMTP id p6mr21338334wiz.0.1330342152052; Mon, 27 Feb 2012 03:29:12 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id s2sm53858970wix.3.2012.02.27.03.29.09 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 27 Feb 2012 03:29:11 -0800 (PST) From: Thierry Volpiatto To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <87aa47rj6z.fsf@gmail.com> <878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> <87ehtgo8yf.fsf@gmail.com> <87pqd0pmhh.fsf@gmx.de> Date: Mon, 27 Feb 2012 12:29:08 +0100 In-Reply-To: <87pqd0pmhh.fsf@gmx.de> (Michael Albinus's message of "Mon, 27 Feb 2012 12:03:06 +0100") Message-ID: <8762eso6pn.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Michael Albinus writes: > Thierry Volpiatto writes: > >> To finish this thread, I would like to say I am not happy with the last >> changes made to file-subdir-of-p by Chong Yidong without ANY >> notifications. >> Even after discussion about CL integration in Emacs, it seem it is not >> for tomorrow. >> i.e what is your problem with loop? > > I cannot speak for Chong, but personally I dislike CL's loop. Like many Emacs maintainers unfortunately. > It isn't readable, and so it decreases maintanability of such a basic > package like files.el. I disagree. Once you are used to it, it is more readable and easier to maintain. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 06:37:37 2012 Received: (at 10489) by debbugs.gnu.org; 27 Feb 2012 11:37:37 +0000 Received: from localhost ([127.0.0.1]:59129 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1ytd-0001TZ-Ct for submit@debbugs.gnu.org; Mon, 27 Feb 2012 06:37:37 -0500 Received: from mail-ww0-f46.google.com ([74.125.82.46]:59433) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S1yta-0001TS-T6 for 10489@debbugs.gnu.org; Mon, 27 Feb 2012 06:37:36 -0500 Received: by wgbdq11 with SMTP id dq11so709420wgb.15 for <10489@debbugs.gnu.org>; Mon, 27 Feb 2012 03:34:43 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.92.73 as permitted sender) client-ip=10.180.92.73; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.92.73 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.180.92.73]) by 10.180.92.73 with SMTP id ck9mr27183918wib.2.1330342483741 (num_hops = 1); Mon, 27 Feb 2012 03:34:43 -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=jQRzS/2+9KPwre15CmuAYJD3DveSWnX9Wa8uirt4rpU=; b=iUnbkM+hka2Jg1ZMiEqfADVW6Sq9qbF0B7XTWMErfWrtFgT3LO5CXih2k/tgxCTpzD H+bfzwoKY5nX3L8OP8Leq4d11HCrj56Kx7K3sGZ3BFjmQWEBhMVmDUa3YZD2O+gwIdye NNXI8joIluCCI+liLItF6rvKyLByER0EOH7Ng= Received: by 10.180.92.73 with SMTP id ck9mr21570261wib.2.1330342483703; Mon, 27 Feb 2012 03:34:43 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id p10sm21706633wic.0.2012.02.27.03.34.41 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 27 Feb 2012 03:34:42 -0800 (PST) From: Thierry Volpiatto To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <834nugtwqf.fsf@gnu.org> <87r4xkwhky.fsf@gmail.com> <83vcmws3bs.fsf@gnu.org> <87ehtkwaiz.fsf@gmail.com> <87wr7cgsm3.fsf@gmx.de> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <87aa47rj6z.fsf@gmail.com> <878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> <87k439gyu5.fsf@gmail.com> <87fwdwhizm.fsf@gmail.com> <87bookhfcn.fsf@gmail.com> <87aa44o7qo.fsf@gmail.com> <87linopm4e.fsf@gmx.de> Date: Mon, 27 Feb 2012 12:34:40 +0100 In-Reply-To: <87linopm4e.fsf@gmx.de> (Michael Albinus's message of "Mon, 27 Feb 2012 12:10:57 +0100") Message-ID: <871upgo6gf.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Michael Albinus writes: > Thierry Volpiatto writes: > >>> I see why we might want to signal an error to the user when she does >>> (copy-directory "~/test" "~/test/test1"), but I don't see why that >>> implies that we need files-equal-p to handle non-existent files. >> Because if we don't do that, we have to create new directory Test1 and >> then test if Test1 is a subdir of Test. >> This just to avoid that. > > This has to be handled in copy-directory. It is actually handled in copy-directory. > files-equal-p can (will!) be used also somewhere else. It's why I propose a new optional arg for it. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 08:27:39 2012 Received: (at 10489) by debbugs.gnu.org; 27 Feb 2012 13:27:39 +0000 Received: from localhost ([127.0.0.1]:59236 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S20c7-0004np-4m for submit@debbugs.gnu.org; Mon, 27 Feb 2012 08:27:39 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.183]:25217) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S20c5-0004nj-Q8 for 10489@debbugs.gnu.org; Mon, 27 Feb 2012 08:27:38 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AicFAKU/KE9FxJvl/2dsb2JhbACBX5x7eYhwnhmGGQSGUJRJhAs X-IronPort-AV: E=Sophos;i="4.73,1,1325480400"; d="scan'208";a="164791982" Received: from 69-196-155-229.dsl.teksavvy.com (HELO pastel.home) ([69.196.155.229]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 27 Feb 2012 08:24:45 -0500 Received: by pastel.home (Postfix, from userid 20848) id 9A9615922E; Mon, 27 Feb 2012 08:24:44 -0500 (EST) From: Stefan Monnier To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Message-ID: References: <87mx9su32g.fsf@web.de> <87vcmwwvk7.fsf@gmail.com> <834nugtwqf.fsf@gnu.org> <87r4xkwhky.fsf@gmail.com> <83vcmws3bs.fsf@gnu.org> <87ehtkwaiz.fsf@gmail.com> <87wr7cgsm3.fsf@gmx.de> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <87aa47rj6z.fsf@gmail.com> <878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> <87k439gyu5.fsf@gmail.com> <87fwdwhizm.fsf@gmail.com> <87bookhfcn.fsf@gmail.com> <87aa44o7qo.fsf@gmail.com> Date: Mon, 27 Feb 2012 08:24:44 -0500 In-Reply-To: <87aa44o7qo.fsf@gmail.com> (Thierry Volpiatto's message of "Mon, 27 Feb 2012 12:06:55 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > Because if we don't do that, we have to create new directory Test1 and > then test if Test1 is a subdir of Test. No we don't have to do that. We can do the extra work in copy-directory (so we call file-equal-p on "~/test" rather than on "~/test/test1" when "~/test/test1" doesn't exist yet). Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 08:57:50 2012 Received: (at 10489) by debbugs.gnu.org; 27 Feb 2012 13:57:50 +0000 Received: from localhost ([127.0.0.1]:59251 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S215K-0006Ii-Es for submit@debbugs.gnu.org; Mon, 27 Feb 2012 08:57:50 -0500 Received: from fencepost.gnu.org ([208.118.235.10]:48388) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S215G-0006IY-IF for 10489@debbugs.gnu.org; Mon, 27 Feb 2012 08:57:47 -0500 Received: from bb116-14-103-36.singnet.com.sg ([116.14.103.36]:33359 helo=furball) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1S212U-0001WM-05; Mon, 27 Feb 2012 08:54:54 -0500 From: Chong Yidong To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <87aa47rj6z.fsf@gmail.com> <878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> <87ehtgo8yf.fsf@gmail.com> Date: Mon, 27 Feb 2012 21:54:43 +0800 In-Reply-To: <87ehtgo8yf.fsf@gmail.com> (Thierry Volpiatto's message of "Mon, 27 Feb 2012 11:40:40 +0100") Message-ID: <87mx84mlek.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.8 (/) Thierry Volpiatto writes: > To finish this thread, I would like to say I am not happy with the > last changes made to file-subdir-of-p by Chong Yidong without ANY > notifications. Even after discussion about CL integration in Emacs, > it seem it is not for tomorrow. i.e what is your problem with loop? Sorry, I would have brought it up in this thread except that I thought the discussion was over. I generally have no problem with Common Lisp, but I'm not sure we want to have loop macros in a core Emacs file yet. Since that code was easily translatable from Loop into Lisp, I went ahead and did it. From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 09:23:07 2012 Received: (at 10489) by debbugs.gnu.org; 27 Feb 2012 14:23:07 +0000 Received: from localhost ([127.0.0.1]:59267 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S21Tm-0006sb-Of for submit@debbugs.gnu.org; Mon, 27 Feb 2012 09:23:07 -0500 Received: from rcsinet15.oracle.com ([148.87.113.117]:26658) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S21Tk-0006sS-UL for 10489@debbugs.gnu.org; Mon, 27 Feb 2012 09:23:05 -0500 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by rcsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q1REKBai015986 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 27 Feb 2012 14:20:12 GMT Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q1REK85t001029 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 27 Feb 2012 14:20:08 GMT Received: from abhmt102.oracle.com (abhmt102.oracle.com [141.146.116.54]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q1REK7Ll019058; Mon, 27 Feb 2012 08:20:08 -0600 Received: from dradamslap1 (/10.159.34.90) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 27 Feb 2012 06:20:07 -0800 From: "Drew Adams" To: "'Thierry Volpiatto'" , "'Michael Albinus'" References: <87mx9su32g.fsf@web.de> <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><8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org><87haygx97t.fsf@gmx.de> <87aa47rj6z.fsf@gmail.com><878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com><87ipiuvsbw.fsf@gmx.de> <87ehtgo8yf.fsf@gmail.com><87pqd0pmhh.fsf@gmx.de> <8762eso6pn.fsf@gmail.com> Subject: RE: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Date: Mon, 27 Feb 2012 06:19:55 -0800 Message-ID: <159F2D3F07C047AA9E63E27B32EDC589@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <8762eso6pn.fsf@gmail.com> Thread-Index: Acz1QzbsXax2zXM9RNunUMURbFFJjAAF3mtg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-CT-RefId: str=0001.0A090208.4F4B911C.0144,ss=1,re=0.000,fgs=0 X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) > > I cannot speak for Chong, but personally I dislike CL's loop. > Like many Emacs maintainers unfortunately. > > > It isn't readable, and so it decreases maintanability of > > such a basic package like files.el. > I disagree. > Once you are used to it, it is more readable and easier to maintain. AFAIK, `loop' is a macro, so its use in Emacs source code is not a no-no. There is no need to require cl.el at runtime, in order to use `loop'. (I personally am not a big fan of `loop', but I do use it sometimes.) From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 10:02:38 2012 Received: (at 10489) by debbugs.gnu.org; 27 Feb 2012 15:02:38 +0000 Received: from localhost ([127.0.0.1]:59910 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S225z-0008TY-Li for submit@debbugs.gnu.org; Mon, 27 Feb 2012 10:02:38 -0500 Received: from mail-we0-f172.google.com ([74.125.82.172]:48529) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S225w-0008TQ-He for 10489@debbugs.gnu.org; Mon, 27 Feb 2012 10:02:33 -0500 Received: by werb10 with SMTP id b10so1042448wer.3 for <10489@debbugs.gnu.org>; Mon, 27 Feb 2012 06:59:40 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.80.35 as permitted sender) client-ip=10.180.80.35; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.80.35 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.180.80.35]) by 10.180.80.35 with SMTP id o3mr29207963wix.5.1330354780353 (num_hops = 1); Mon, 27 Feb 2012 06:59:40 -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=cEL8HHFnSQ+8zhrlHW7+XwcODuJSrKm5PmBIYSFXx10=; b=gWI+TQgraw14eSX8aY5ojcZah6B6uRUFNi2kFDD4exmoa1JnoL8C9wlROQPnT6z5AK PiTg1iYZjOVO4Q/lbOFhM6dKQUsL+1sExSWW7yJsYM/NIRQnZRvByAm7jY2g1xOdlpBq s3d9EwFVK6s1e3c9LLTX1w+yEd6g6uIiYknUE= Received: by 10.180.80.35 with SMTP id o3mr23147725wix.5.1330354780311; Mon, 27 Feb 2012 06:59:40 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id hb10sm56096531wib.10.2012.02.27.06.59.38 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 27 Feb 2012 06:59:39 -0800 (PST) From: Thierry Volpiatto To: Stefan Monnier Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <834nugtwqf.fsf@gnu.org> <87r4xkwhky.fsf@gmail.com> <83vcmws3bs.fsf@gnu.org> <87ehtkwaiz.fsf@gmail.com> <87wr7cgsm3.fsf@gmx.de> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <87aa47rj6z.fsf@gmail.com> <878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> <87k439gyu5.fsf@gmail.com> <87fwdwhizm.fsf@gmail.com> <87bookhfcn.fsf@gmail.com> <87aa44o7qo.fsf@gmail.com> Date: Mon, 27 Feb 2012 15:59:36 +0100 In-Reply-To: (Stefan Monnier's message of "Mon, 27 Feb 2012 08:24:44 -0500") Message-ID: <87ty2c490n.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Stefan Monnier writes: >> Because if we don't do that, we have to create new directory Test1 and >> then test if Test1 is a subdir of Test. > > No we don't have to do that. We can do the extra work in copy-directory > (so we call file-equal-p on "~/test" rather than on "~/test/test1" when > "~/test/test1" doesn't exist yet). If you don't create test1, you will never have a value of file-attributes for it, and file-directory-p will return always nil on test1. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 10:18:49 2012 Received: (at 10489) by debbugs.gnu.org; 27 Feb 2012 15:18:49 +0000 Received: from localhost ([127.0.0.1]:59933 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S22Lg-0000PB-Hb for submit@debbugs.gnu.org; Mon, 27 Feb 2012 10:18:49 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:62575) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S22Le-0000P4-QJ for 10489@debbugs.gnu.org; Mon, 27 Feb 2012 10:18:47 -0500 Received: by wicr5 with SMTP id r5so780256wic.3 for <10489@debbugs.gnu.org>; Mon, 27 Feb 2012 07:15:54 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.93.232 as permitted sender) client-ip=10.180.93.232; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.93.232 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.180.93.232]) by 10.180.93.232 with SMTP id cx8mr19814763wib.14.1330355754741 (num_hops = 1); Mon, 27 Feb 2012 07:15:54 -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=tZdgLdD6GRxd5Xnn2DojOJsacrqygB0RNGdq18k0xE8=; b=stXLdalJfbEl5BQFgcwDAUfSdrgXLNvV2lm7LIckm0nc2yvoRngw7pNL9NUoNQVjus Gayy8VnsNX6CXTjohpUIanM3D+J9ctmR7/Ea2Yap3mvn6npiT4uu7Z2zGB9s0kHANtVX EsJPXobyp3bBzLuY7atl1PuEKpvQ5zzcfME50= Received: by 10.180.93.232 with SMTP id cx8mr15652028wib.14.1330355754646; Mon, 27 Feb 2012 07:15:54 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id h19sm22484773wiw.9.2012.02.27.07.15.52 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 27 Feb 2012 07:15:53 -0800 (PST) From: Thierry Volpiatto To: Chong Yidong Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <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> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <87aa47rj6z.fsf@gmail.com> <878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> <87ehtgo8yf.fsf@gmail.com> <87mx84mlek.fsf@gnu.org> Date: Mon, 27 Feb 2012 16:15:50 +0100 In-Reply-To: <87mx84mlek.fsf@gnu.org> (Chong Yidong's message of "Mon, 27 Feb 2012 21:54:43 +0800") Message-ID: <87mx84489l.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Chong Yidong writes: > Thierry Volpiatto writes: > >> To finish this thread, I would like to say I am not happy with the >> last changes made to file-subdir-of-p by Chong Yidong without ANY >> notifications. Even after discussion about CL integration in Emacs, >> it seem it is not for tomorrow. i.e what is your problem with loop? > > Sorry, I would have brought it up in this thread except that I thought > the discussion was over. > I generally have no problem with Common Lisp, but I'm not sure we want > to have loop macros in a core Emacs file yet. Note that "(eval-when-compile (require 'cl))" is at start of files.el. > Since that code was easily translatable from Loop into Lisp, I went > ahead and did it. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 12:41:12 2012 Received: (at 10489) by debbugs.gnu.org; 27 Feb 2012 17:41:12 +0000 Received: from localhost ([127.0.0.1]:60010 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S24ZT-0003nO-TU for submit@debbugs.gnu.org; Mon, 27 Feb 2012 12:41:12 -0500 Received: from pruche.dit.umontreal.ca ([132.204.246.22]:46430) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S24ZQ-0003nD-F8 for 10489@debbugs.gnu.org; Mon, 27 Feb 2012 12:41:09 -0500 Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id q1RHcFt3013372; Mon, 27 Feb 2012 12:38:15 -0500 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 23B0BB4471; Mon, 27 Feb 2012 12:38:15 -0500 (EST) From: Stefan Monnier To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Message-ID: References: <87mx9su32g.fsf@web.de> <87r4xkwhky.fsf@gmail.com> <83vcmws3bs.fsf@gnu.org> <87ehtkwaiz.fsf@gmail.com> <87wr7cgsm3.fsf@gmx.de> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <87aa47rj6z.fsf@gmail.com> <878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> <87k439gyu5.fsf@gmail.com> <87fwdwhizm.fsf@gmail.com> <87bookhfcn.fsf@gmail.com> <87aa44o7qo.fsf@gmail.com> <87ty2c490n.fsf@gmail.com> Date: Mon, 27 Feb 2012 12:38:14 -0500 In-Reply-To: <87ty2c490n.fsf@gmail.com> (Thierry Volpiatto's message of "Mon, 27 Feb 2012 15:59:36 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4145=0 X-NAI-Spam-Version: 2.2.0.9309 : core <4145> : streams <732745> : uri <1073124> X-Spam-Score: -3.5 (---) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.5 (---) >>> Because if we don't do that, we have to create new directory Test1 and >>> then test if Test1 is a subdir of Test. >> No we don't have to do that. We can do the extra work in copy-directory >> (so we call file-equal-p on "~/test" rather than on "~/test/test1" when >> "~/test/test1" doesn't exist yet). > If you don't create test1, you will never have a value of > file-attributes for it, and file-directory-p will return always nil on > test1. I don't understand why you think that's a problem. Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 12:41:42 2012 Received: (at 10489) by debbugs.gnu.org; 27 Feb 2012 17:41:42 +0000 Received: from localhost ([127.0.0.1]:60013 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S24Zy-0003o1-JB for submit@debbugs.gnu.org; Mon, 27 Feb 2012 12:41:42 -0500 Received: from mtaout23.012.net.il ([80.179.55.175]:52651) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S24Zw-0003ns-3M for 10489@debbugs.gnu.org; Mon, 27 Feb 2012 12:41:41 -0500 Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0M0200500BM3D800@a-mtaout23.012.net.il> for 10489@debbugs.gnu.org; Mon, 27 Feb 2012 19:38:41 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.124.119.92]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0M0200556BOGBJ40@a-mtaout23.012.net.il>; Mon, 27 Feb 2012 19:38:40 +0200 (IST) Date: Mon, 27 Feb 2012 19:40:46 +0200 From: Eli Zaretskii Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy In-reply-to: <8762esekln.fsf@gmx.de> X-012-Sender: halo1@inter.net.il To: Michael Albinus Message-id: <837gz8kwdd.fsf@gnu.org> References: <87mx9su32g.fsf@web.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> <87haygie87.fsf@gmx.de> <83wr7cs3l7.fsf@gnu.org> <8762ewi7im.fsf@gmx.de> <83r4xkrpal.fsf@gnu.org> <87d394x957.fsf@gmx.de> <83obsnsaa4.fsf@gnu.org> <8762esekln.fsf@gmx.de> X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, thierry.volpiatto@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) > From: Michael Albinus > Cc: thierry.volpiatto@gmail.com, 10489@debbugs.gnu.org > Date: Mon, 27 Feb 2012 09:39:16 +0100 > > I would say, that a zero inode is returned in any case of a network drive > located file. Thanks for the data. From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 13:55:12 2012 Received: (at 10489) by debbugs.gnu.org; 27 Feb 2012 18:55:12 +0000 Received: from localhost ([127.0.0.1]:60104 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S25j6-0005Wi-Hc for submit@debbugs.gnu.org; Mon, 27 Feb 2012 13:55:12 -0500 Received: from mail-we0-f172.google.com ([74.125.82.172]:52476) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S25j3-0005WW-Ng for 10489@debbugs.gnu.org; Mon, 27 Feb 2012 13:55:11 -0500 Received: by werb10 with SMTP id b10so1203806wer.3 for <10489@debbugs.gnu.org>; Mon, 27 Feb 2012 10:52:16 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.216.134.5 as permitted sender) client-ip=10.216.134.5; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.216.134.5 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.216.134.5]) by 10.216.134.5 with SMTP id r5mr7740614wei.39.1330368736224 (num_hops = 1); Mon, 27 Feb 2012 10:52:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:in-reply-to:date:references:user-agent :message-id:mime-version:content-type; bh=XtUZXHlwGJTsc1pztP/bHxj0CPliNrQ2+VCae5U+f2Y=; b=q/r7NSQMM9K+/rGWb1DRPasjL/9N7VeO674uUBo+BYrjOIheJi1rqJ71LY9fWoXV78 RtUxiqklW+2k8Of7rmUbEGoPrPuqKloJvDE2reQuoBtnxQAm4fNr6C5oHS/+I7jnWUGE XqOBfnGE5Ze7gWFyN+AJO9KEBdx9XG+1UDj1M= Received: by 10.216.134.5 with SMTP id r5mr6146334wei.39.1330368736079; Mon, 27 Feb 2012 10:52:16 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id er8sm58927498wib.1.2012.02.27.10.52.14 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 27 Feb 2012 10:52:15 -0800 (PST) From: Thierry Volpiatto To: Stefan Monnier Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy In-Reply-To: (Stefan Monnier's message of "Mon, 27 Feb 2012 12:38:14 -0500") Date: Mon, 27 Feb 2012 19:34:21 +0100 References: <87mx9su32g.fsf@web.de> <83vcmws3bs.fsf@gnu.org> <87ehtkwaiz.fsf@gmail.com> <87wr7cgsm3.fsf@gmx.de> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <87aa47rj6z.fsf@gmail.com> <878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> <87k439gyu5.fsf@gmail.com> <87fwdwhizm.fsf@gmail.com> <87bookhfcn.fsf@gmail.com> <87aa44o7qo.fsf@gmail.com> <87ty2c490n.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) Message-ID: <87r4xgkt2b.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Stefan Monnier writes: >>>> Because if we don't do that, we have to create new directory Test1 and >>>> then test if Test1 is a subdir of Test. >>> No we don't have to do that. We can do the extra work in copy-directory >>> (so we call file-equal-p on "~/test" rather than on "~/test/test1" when >>> "~/test/test1" doesn't exist yet). >> If you don't create test1, you will never have a value of >> file-attributes for it, and file-directory-p will return always nil on >> test1. > > I don't understand why you think that's a problem. It's me who don't understand you, sorry. We want to do: (copy-directory "~/test" "~/test/test1") "~/test/test1" is a non--existing directory. Actually in copy-directory, I create "~/test/test1", and after doing this, I check if this newly created directory is a subdir or "~/test" in which case I exit with error. 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. It's so simple to do at start of function: (file-subdir-of-p "~/test/test1" "~/test" 'noexist) Where the NOEXIST arg allow file-subdir-of-p to bypass the file-directory-p check (who will return nil on "test1"). -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 14:12:06 2012 Received: (at 10489) by debbugs.gnu.org; 27 Feb 2012 19:12:06 +0000 Received: from localhost ([127.0.0.1]:60134 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S25zR-0005vW-Mv for submit@debbugs.gnu.org; Mon, 27 Feb 2012 14:12:06 -0500 Received: from mailout-de.gmx.net ([213.165.64.23]:58772) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S25zP-0005vN-DO for 10489@debbugs.gnu.org; Mon, 27 Feb 2012 14:12:04 -0500 Received: (qmail invoked by alias); 27 Feb 2012 19:09:09 -0000 Received: from p57BB9732.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.151.50] by mail.gmx.net (mp017) with SMTP; 27 Feb 2012 20:09:09 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1/vIwN+eA7v05IhMicrDkuZFi/6edpLI292zR/j9r pMMCtrC3QHUvOP From: Michael Albinus To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87ehtkwaiz.fsf@gmail.com> <87wr7cgsm3.fsf@gmx.de> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <87aa47rj6z.fsf@gmail.com> <878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> <87k439gyu5.fsf@gmail.com> <87fwdwhizm.fsf@gmail.com> <87bookhfcn.fsf@gmail.com> <87aa44o7qo.fsf@gmail.com> <87ty2c490n.fsf@gmail.com> <87r4xgkt2b.fsf@gmail.com> Date: Mon, 27 Feb 2012 20:08:57 +0100 In-Reply-To: <87r4xgkt2b.fsf@gmail.com> (Thierry Volpiatto's message of "Mon, 27 Feb 2012 19:34:21 +0100") Message-ID: <87obskum9i.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Thierry Volpiatto 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. I haven't spoken about file-subdir-of-p. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 14:36:47 2012 Received: (at 10489) by debbugs.gnu.org; 27 Feb 2012 19:36:47 +0000 Received: from localhost ([127.0.0.1]:60171 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S26NL-0006Xp-Ir for submit@debbugs.gnu.org; Mon, 27 Feb 2012 14:36:47 -0500 Received: from mail-ww0-f46.google.com ([74.125.82.46]:49452) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S26NI-0006Xh-GS for 10489@debbugs.gnu.org; Mon, 27 Feb 2012 14:36:45 -0500 Received: by wgbdq11 with SMTP id dq11so1123863wgb.15 for <10489@debbugs.gnu.org>; Mon, 27 Feb 2012 11:33:51 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.95.34 as permitted sender) client-ip=10.180.95.34; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.95.34 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.180.95.34]) by 10.180.95.34 with SMTP id dh2mr14408608wib.15.1330371231356 (num_hops = 1); Mon, 27 Feb 2012 11:33:51 -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=ifS5MnmgaRbclIp3RvmNaQ5CII975bKlJugohpBl1QY=; b=Gp1B78wCVayrLLE7SdiqPTiPBMMyxzLHrTNIzdwMQv03jy6osxs/MHC6bhyUmFEOCj RtpYGuGh/LxjCFxF4o86T1Ahybxgkx9jM5KsrIO8u8eTjH97fM3lV+sxGLRPo5iPuhVA jQEK0LI2zKvtKIS5DOwtOI2Whj09zrW4jcUO8= Received: by 10.180.95.34 with SMTP id dh2mr11356774wib.15.1330371231298; Mon, 27 Feb 2012 11:33:51 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id gp8sm23976328wib.5.2012.02.27.11.33.49 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 27 Feb 2012 11:33:50 -0800 (PST) From: Thierry Volpiatto To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87wr7cgsm3.fsf@gmx.de> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <87aa47rj6z.fsf@gmail.com> <878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> <87k439gyu5.fsf@gmail.com> <87fwdwhizm.fsf@gmail.com> <87bookhfcn.fsf@gmail.com> <87aa44o7qo.fsf@gmail.com> <87ty2c490n.fsf@gmail.com> <87r4xgkt2b.fsf@gmail.com> <87obskum9i.fsf@gmx.de> Date: Mon, 27 Feb 2012 20:33:47 +0100 In-Reply-To: <87obskum9i.fsf@gmx.de> (Michael Albinus's message of "Mon, 27 Feb 2012 20:08:57 +0100") Message-ID: <87mx84kr50.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Michael Albinus writes: > Thierry Volpiatto 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 From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 14:53:05 2012 Received: (at 10489) by debbugs.gnu.org; 27 Feb 2012 19:53:05 +0000 Received: from localhost ([127.0.0.1]:60190 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S26d6-0007lU-Aw for submit@debbugs.gnu.org; Mon, 27 Feb 2012 14:53:04 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:52934) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S26d4-0007l5-6O for 10489@debbugs.gnu.org; Mon, 27 Feb 2012 14:53:03 -0500 Received: (qmail invoked by alias); 27 Feb 2012 19:50:06 -0000 Received: from p57BB9732.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.151.50] by mail.gmx.net (mp024) with SMTP; 27 Feb 2012 20:50:06 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1+3kn0CpTO3Cnovgj6n88FjhzPERB46BjykthI5Fx DjIA6W9dm21EBv From: Michael Albinus To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <87aa47rj6z.fsf@gmail.com> <878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> <87k439gyu5.fsf@gmail.com> <87fwdwhizm.fsf@gmail.com> <87bookhfcn.fsf@gmail.com> <87aa44o7qo.fsf@gmail.com> <87ty2c490n.fsf@gmail.com> <87r4xgkt2b.fsf@gmail.com> <87obskum9i.fsf@gmx.de> <87mx84kr50.fsf@gmail.com> Date: Mon, 27 Feb 2012 20:49:56 +0100 In-Reply-To: <87mx84kr50.fsf@gmail.com> (Thierry Volpiatto's message of "Mon, 27 Feb 2012 20:33:47 +0100") Message-ID: <87aa44ukd7.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Thierry Volpiatto writes: > In this case this version return nil even if noexist is not provided. > > (defun files-equal-p (file1 file2 &optional noexist) We can continue to discuss, whether NOEXIST is needed. I believe it isn't, people could use `file-exists-p'. But I'm not (one of) the Emacs maintainer(s), who decide. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 17:02:23 2012 Received: (at 10489) by debbugs.gnu.org; 27 Feb 2012 22:02:23 +0000 Received: from localhost ([127.0.0.1]:60268 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S28e5-0002GI-BX for submit@debbugs.gnu.org; Mon, 27 Feb 2012 17:02:23 -0500 Received: from chene.dit.umontreal.ca ([132.204.246.20]:44490) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S28dr-0002Fc-Uo for 10489@debbugs.gnu.org; Mon, 27 Feb 2012 17:02:01 -0500 Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id q1RLwpex001205; Mon, 27 Feb 2012 16:58:51 -0500 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id D9658B4471; Mon, 27 Feb 2012 16:58:50 -0500 (EST) From: Stefan Monnier To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Message-ID: References: <87mx9su32g.fsf@web.de> <87wr7cgsm3.fsf@gmx.de> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <87aa47rj6z.fsf@gmail.com> <878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> <87k439gyu5.fsf@gmail.com> <87fwdwhizm.fsf@gmail.com> <87bookhfcn.fsf@gmail.com> <87aa44o7qo.fsf@gmail.com> <87ty2c490n.fsf@gmail.com> <87r4xgkt2b.fsf@gmail.com> <87obskum9i.fsf@gmx.de> Date: Mon, 27 Feb 2012 16:58:50 -0500 In-Reply-To: <87obskum9i.fsf@gmx.de> (Michael Albinus's message of "Mon, 27 Feb 2012 20:08:57 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4145=0 X-NAI-Spam-Version: 2.2.0.9309 : core <4145> : streams <732810> : uri <1073242> X-Spam-Score: -3.5 (---) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.5 (---) >> 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. I haven't spoken about file-subdir-of-p. Exactly. I don't think noexist is needed for subdir-p (it should accept a non-existing dir for the `dir1' argument, without any need for a noexist arg and it should reject a non-existing dir2), but I can live with it, but file-equal-p only makes sense for existing files and should not have a `noexist' argument. Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 17:15:02 2012 Received: (at 10489) by debbugs.gnu.org; 27 Feb 2012 22:15:02 +0000 Received: from localhost ([127.0.0.1]:60292 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S28qO-0002Yy-GT for submit@debbugs.gnu.org; Mon, 27 Feb 2012 17:15:02 -0500 Received: from mail-we0-f172.google.com ([74.125.82.172]:65250) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S28q7-0002YV-Ar for 10489@debbugs.gnu.org; Mon, 27 Feb 2012 17:14:45 -0500 Received: by werb10 with SMTP id b10so1316204wer.3 for <10489@debbugs.gnu.org>; Mon, 27 Feb 2012 14:11:30 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.84.36 as permitted sender) client-ip=10.180.84.36; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.84.36 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.180.84.36]) by 10.180.84.36 with SMTP id v4mr131577wiy.0.1330380690411 (num_hops = 1); Mon, 27 Feb 2012 14:11:30 -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=57qNk1JgOpihCZPWcDUBAYo2ITVqRvndW+7AHPaHQ/8=; b=WschaHEzdDnmqQkSg4uol6fu/WkbPf0pRN2dBMA4DNXrv1qwnMOEwnztggnus/uAIA w5yYlv1vJXKTmIlXvGKG9yZ2tmD+MmEWULBRIJo3pAgUOeM3cSws8xYyW5CiniIJEJfI SH3fSVAh7/ooZVHPGA454zqZtTncAV1h4r0Do= Received: by 10.180.84.36 with SMTP id v4mr99996wiy.0.1330380690275; Mon, 27 Feb 2012 14:11:30 -0800 (PST) Received: from thierry-MS-7309 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id by4sm18897086wib.3.2012.02.27.14.11.28 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 27 Feb 2012 14:11:29 -0800 (PST) From: Thierry Volpiatto To: Stefan Monnier Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <8762eww77b.fsf@gmail.com> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <87aa47rj6z.fsf@gmail.com> <878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> <87k439gyu5.fsf@gmail.com> <87fwdwhizm.fsf@gmail.com> <87bookhfcn.fsf@gmail.com> <87aa44o7qo.fsf@gmail.com> <87ty2c490n.fsf@gmail.com> <87r4xgkt2b.fsf@gmail.com> <87obskum9i.fsf@gmx.de> Date: Mon, 27 Feb 2012 23:11:27 +0100 In-Reply-To: (Stefan Monnier's message of "Mon, 27 Feb 2012 16:58:50 -0500") Message-ID: <874nuc9bao.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Stefan Monnier 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. I haven't spoken about file-subdir-of-p. > > Exactly. I don't think noexist is needed for subdir-p (it should accept > a non-existing dir for the `dir1' argument, without any need for > a noexist arg and it should reject a non-existing dir2), but I can live > with it, but file-equal-p only makes sense for existing files and should > not have a `noexist' argument. Ah! yes, thats sound good. Just need to remove check of file-directory-p for dir1 in f-subdir-of-p. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 28 01:16:47 2012 Received: (at submit) by debbugs.gnu.org; 28 Feb 2012 06:16:47 +0000 Received: from localhost ([127.0.0.1]:60626 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2GMf-0005hQ-DK for submit@debbugs.gnu.org; Tue, 28 Feb 2012 01:16:46 -0500 Received: from eggs.gnu.org ([208.118.235.92]:37371) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2GMI-0005gr-JP for submit@debbugs.gnu.org; Tue, 28 Feb 2012 01:16:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S2GJC-0004D0-M1 for submit@debbugs.gnu.org; Tue, 28 Feb 2012 01:13:11 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:35477) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2GJC-0004Cs-Iu for submit@debbugs.gnu.org; Tue, 28 Feb 2012 01:13:10 -0500 Received: from eggs.gnu.org ([208.118.235.92]:55579) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2GJA-0005pM-PM for bug-gnu-emacs@gnu.org; Tue, 28 Feb 2012 01:13:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S2GJ8-0004CD-Aj for bug-gnu-emacs@gnu.org; Tue, 28 Feb 2012 01:13:08 -0500 Received: from plane.gmane.org ([80.91.229.3]:56355) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2GJ8-0004Bw-4e for bug-gnu-emacs@gnu.org; Tue, 28 Feb 2012 01:13:06 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1S2GJ3-0005i0-Fj for bug-gnu-emacs@gnu.org; Tue, 28 Feb 2012 07:13:01 +0100 Received: from lbe83-2-78-243-104-167.fbx.proxad.net ([78.243.104.167]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 28 Feb 2012 07:13:01 +0100 Received: from thierry.volpiatto by lbe83-2-78-243-104-167.fbx.proxad.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 28 Feb 2012 07:13:01 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Date: Tue, 28 Feb 2012 07:12:49 +0100 Lines: 26 Message-ID: <874nubzdsu.fsf@gmail.com> References: <87mx9su32g.fsf@web.de> <83pqd4roav.fsf@gnu.org> <87haygx97t.fsf@gmx.de> <87aa47rj6z.fsf@gmail.com> <878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> <87k439gyu5.fsf@gmail.com> <87fwdwhizm.fsf@gmail.com> <87bookhfcn.fsf@gmail.com> <87aa44o7qo.fsf@gmail.com> <87ty2c490n.fsf@gmail.com> <87r4xgkt2b.fsf@gmail.com> <87obskum9i.fsf@gmx.de> <874nuc9bao.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: lbe83-2-78-243-104-167.fbx.proxad.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) Cancel-Lock: sha1:rtTAUHRflAQR+sKeKZnvsFQLot8= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.8 (/) Thierry Volpiatto writes: > Stefan Monnier 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. I haven't spoken about file-subdir-of-p. >> >> Exactly. I don't think noexist is needed for subdir-p (it should accept >> a non-existing dir for the `dir1' argument, without any need for >> a noexist arg and it should reject a non-existing dir2), but I can live >> with it, but file-equal-p only makes sense for existing files and should >> not have a `noexist' argument. > Ah! yes, thats sound good. > Just need to remove check of file-directory-p for dir1 in f-subdir-of-p. Note that the last check: (files-equal-p (file-truename root) dir2) can be: (files-equal-p root dir2) file-truename is not needed here. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 28 02:18:18 2012 Received: (at submit) by debbugs.gnu.org; 28 Feb 2012 07:18:18 +0000 Received: from localhost ([127.0.0.1]:60650 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2HKD-00075s-Dj for submit@debbugs.gnu.org; Tue, 28 Feb 2012 02:18:17 -0500 Received: from eggs.gnu.org ([208.118.235.92]:45108) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2HK1-00075C-Rg for submit@debbugs.gnu.org; Tue, 28 Feb 2012 02:18:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S2HGu-00054w-N9 for submit@debbugs.gnu.org; Tue, 28 Feb 2012 02:14:54 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:47710) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2HGu-00054s-Jn for submit@debbugs.gnu.org; Tue, 28 Feb 2012 02:14:52 -0500 Received: from eggs.gnu.org ([208.118.235.92]:41624) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2HGs-00020f-Ot for bug-gnu-emacs@gnu.org; Tue, 28 Feb 2012 02:14:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S2HGq-00054W-E4 for bug-gnu-emacs@gnu.org; Tue, 28 Feb 2012 02:14:50 -0500 Received: from plane.gmane.org ([80.91.229.3]:34353) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2HGq-00054P-3b for bug-gnu-emacs@gnu.org; Tue, 28 Feb 2012 02:14:48 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1S2HGl-00037l-LU for bug-gnu-emacs@gnu.org; Tue, 28 Feb 2012 08:14:43 +0100 Received: from lbe83-2-78-243-104-167.fbx.proxad.net ([78.243.104.167]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 28 Feb 2012 08:14:43 +0100 Received: from thierry.volpiatto by lbe83-2-78-243-104-167.fbx.proxad.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 28 Feb 2012 08:14:43 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Date: Tue, 28 Feb 2012 08:14:28 +0100 Lines: 74 Message-ID: <87zkc3xwdn.fsf@gmail.com> References: <87mx9su32g.fsf@web.de> <87haygx97t.fsf@gmx.de> <87aa47rj6z.fsf@gmail.com> <878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> <87k439gyu5.fsf@gmail.com> <87fwdwhizm.fsf@gmail.com> <87bookhfcn.fsf@gmail.com> <87aa44o7qo.fsf@gmail.com> <87ty2c490n.fsf@gmail.com> <87r4xgkt2b.fsf@gmail.com> <87obskum9i.fsf@gmx.de> <874nuc9bao.fsf@gmail.com> <874nubzdsu.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: lbe83-2-78-243-104-167.fbx.proxad.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) Cancel-Lock: sha1:4/Hrz8GG9aQbQyhr/WlKel6EQi4= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.8 (/) Thierry Volpiatto writes: > Thierry Volpiatto writes: > >> Stefan Monnier 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. I haven't spoken about file-subdir-of-p. >>> >>> Exactly. I don't think noexist is needed for subdir-p (it should accept >>> a non-existing dir for the `dir1' argument, without any need for >>> a noexist arg and it should reject a non-existing dir2), but I can live >>> with it, but file-equal-p only makes sense for existing files and should >>> not have a `noexist' argument. >> Ah! yes, thats sound good. >> Just need to remove check of file-directory-p for dir1 in f-subdir-of-p. > Note that the last check: > (files-equal-p (file-truename root) dir2) > can be: > (files-equal-p root dir2) > file-truename is not needed here. Here the patch: --8<---------------cut here---------------start------------->8--- diff --git a/lisp/files.el b/lisp/files.el --- a/lisp/files.el +++ b/lisp/files.el @@ -4999,13 +4999,12 @@ (defun file-subdir-of-p (dir1 dir2) "Return non-nil if DIR1 is a subdirectory of DIR2. A directory is considered to be a subdirectory of itself. -Return nil if DIR1 or DIR2 are not existing directories." +Return nil if top directory DIR2 is not an existing directory." (let ((handler (or (find-file-name-handler dir1 'file-subdir-of-p) (find-file-name-handler dir2 'file-subdir-of-p)))) (if handler (funcall handler 'file-subdir-of-p dir1 dir2) - (when (and (file-directory-p dir1) - (file-directory-p dir2)) + (when (file-directory-p dir2) ; Top dir must exist. (setq dir1 (file-truename dir1) dir2 (file-truename dir2)) (let ((ls1 (or (split-string dir1 "/" t) '("/"))) @@ -5019,7 +5018,7 @@ (setq ls1 (cdr ls1) ls2 (cdr ls2))) (unless mismatch - (files-equal-p (file-truename root) dir2))))))) + (files-equal-p root dir2))))))) (defun copy-directory (directory newname &optional keep-time parents copy-contents) "Copy DIRECTORY to NEWNAME. Both args must be strings. @@ -5065,12 +5064,7 @@ (cond ((not (file-directory-p newname)) ;; If NEWNAME is not an existing directory, create it; ;; that is where we will copy the files of DIRECTORY. - (make-directory newname parents) - ;; `file-subdir-of-p' doesn't handle non--existing directories, - ;; so double check now if NEWNAME is not a subdir of DIRECTORY. - (and (file-subdir-of-p newname directory) - (error "Cannot copy `%s' into its subdirectory `%s'" - directory newname))) + (make-directory newname parents)) ;; If NEWNAME is an existing directory and COPY-CONTENTS ;; is nil, copy into NEWNAME/[DIRECTORY-BASENAME]. ((not copy-contents) --8<---------------cut here---------------end--------------->8--- -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 28 02:37:59 2012 Received: (at 10489) by debbugs.gnu.org; 28 Feb 2012 07:37:59 +0000 Received: from localhost ([127.0.0.1]:60659 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2HdE-0007Xe-O5 for submit@debbugs.gnu.org; Tue, 28 Feb 2012 02:37:59 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:33480) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S2Hcs-0007X4-Sl for 10489@debbugs.gnu.org; Tue, 28 Feb 2012 02:37:45 -0500 Received: (qmail invoked by alias); 28 Feb 2012 07:34:23 -0000 Received: from p57BB9CC6.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.156.198] by mail.gmx.net (mp030) with SMTP; 28 Feb 2012 08:34:23 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1+x2eZtqmSxnUn3DOKG65x8JCBGSwSNmzy9Q+Q8CA LtxTTQCmhEYIXS From: Michael Albinus To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87aa47rj6z.fsf@gmail.com> <878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> <87k439gyu5.fsf@gmail.com> <87fwdwhizm.fsf@gmail.com> <87bookhfcn.fsf@gmail.com> <87aa44o7qo.fsf@gmail.com> <87ty2c490n.fsf@gmail.com> <87r4xgkt2b.fsf@gmail.com> <87obskum9i.fsf@gmx.de> <874nuc9bao.fsf@gmail.com> <874nubzdsu.fsf@gmail.com> <87zkc3xwdn.fsf@gmail.com> Date: Tue, 28 Feb 2012 08:34:13 +0100 In-Reply-To: <87zkc3xwdn.fsf@gmail.com> (Thierry Volpiatto's message of "Tue, 28 Feb 2012 08:14:28 +0100") Message-ID: <87k437o1hm.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Thierry Volpiatto writes: > Here the patch: `files-equal-p' still returns t for two non-existing files. Shall be fixed too. Btw, this is the only primitive function which has the prefix "files-", all other start with prefix "file-". Is this necessary? (No it is not important, but if we want change it, we must do it before the 24.1 release). Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 28 03:19:34 2012 Received: (at 10489) by debbugs.gnu.org; 28 Feb 2012 08:19:34 +0000 Received: from localhost ([127.0.0.1]:60704 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2IHR-0008Vq-24 for submit@debbugs.gnu.org; Tue, 28 Feb 2012 03:19:34 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:41604) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2IGf-0008U6-84 for 10489@debbugs.gnu.org; Tue, 28 Feb 2012 03:18:47 -0500 Received: by wicr5 with SMTP id r5so1239673wic.3 for <10489@debbugs.gnu.org>; Tue, 28 Feb 2012 00:15:29 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.14.37 as permitted sender) client-ip=10.180.14.37; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.14.37 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.180.14.37]) by 10.180.14.37 with SMTP id m5mr24506126wic.19.1330416929970 (num_hops = 1); Tue, 28 Feb 2012 00:15:29 -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=9cwc4L8mjTTDqeQmasO7u3f2siz8+SH+Z74zsZ7oYe0=; b=xtrs9jzWyiw5HMT+E/uGaJhRN815gET23E8QZg28Fxoh76sSs6BlSJJdtsuBHgSoW6 yjhkvUTzY0ONfv+2f4DRFVN1zX9KewFoFXtax0tNRa/qd1hXxoi/22XHMhU7762OuUi7 ktXM8pmJCBqTz4Z+zEtZq6W0QB0q7thY+ytPc= Received: by 10.180.14.37 with SMTP id m5mr19263678wic.19.1330416929874; Tue, 28 Feb 2012 00:15:29 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id d7sm67479880wiz.6.2012.02.28.00.15.27 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 28 Feb 2012 00:15:28 -0800 (PST) From: Thierry Volpiatto To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> <87k439gyu5.fsf@gmail.com> <87fwdwhizm.fsf@gmail.com> <87bookhfcn.fsf@gmail.com> <87aa44o7qo.fsf@gmail.com> <87ty2c490n.fsf@gmail.com> <87r4xgkt2b.fsf@gmail.com> <87obskum9i.fsf@gmx.de> <874nuc9bao.fsf@gmail.com> <874nubzdsu.fsf@gmail.com> <87zkc3xwdn.fsf@gmail.com> <87k437o1hm.fsf@gmx.de> Date: Tue, 28 Feb 2012 09:15:25 +0100 In-Reply-To: <87k437o1hm.fsf@gmx.de> (Michael Albinus's message of "Tue, 28 Feb 2012 08:34:13 +0100") Message-ID: <87vcmrxtk2.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Hi Michael, Michael Albinus writes: > Thierry Volpiatto writes: > >> Here the patch: > > `files-equal-p' still returns t for two non-existing files. Shall be > fixed too. Fixed. > Btw, this is the only primitive function which has the prefix "files-", > all other start with prefix "file-". Is this necessary? I wrote files because comparing two files, but I don't care of this, just rename it to file- > (No it is not important, but if we want change it, we must do it before > the 24.1 release). --8<---------------cut here---------------start------------->8--- diff --git a/lisp/files.el b/lisp/files.el --- a/lisp/files.el +++ b/lisp/files.el @@ -4985,27 +4985,27 @@ directory 'full directory-files-no-dot-files-regexp))) (delete-directory-internal directory))))) -(defun files-equal-p (file1 file2) +(defun file-equal-p (file1 file2) "Return non-nil if FILE1 and FILE2 name the same file. Ordinary files are considered to be the same if `file-attributes' returns `equal' values for them." - (let ((handler (or (find-file-name-handler file1 'files-equal-p) - (find-file-name-handler file2 'files-equal-p)))) + (let ((handler (or (find-file-name-handler file1 'file-equal-p) + (find-file-name-handler file2 'file-equal-p)))) (if handler - (funcall handler 'files-equal-p file1 file2) - (equal (file-attributes (file-truename file1)) - (file-attributes (file-truename file2)))))) + (funcall handler 'file-equal-p file1 file2) + (let ((f1-attr (file-attributes (file-truename file1))) + (f2-attr (file-attributes (file-truename file2)))) + (and f1-attr f2-attr (equal f1-attr f2-attr)))))) (defun file-subdir-of-p (dir1 dir2) "Return non-nil if DIR1 is a subdirectory of DIR2. A directory is considered to be a subdirectory of itself. -Return nil if DIR1 or DIR2 are not existing directories." +Return nil if top directory DIR2 is not an existing directory." (let ((handler (or (find-file-name-handler dir1 'file-subdir-of-p) (find-file-name-handler dir2 'file-subdir-of-p)))) (if handler (funcall handler 'file-subdir-of-p dir1 dir2) - (when (and (file-directory-p dir1) - (file-directory-p dir2)) + (when (file-directory-p dir2) ; Top dir must exist. (setq dir1 (file-truename dir1) dir2 (file-truename dir2)) (let ((ls1 (or (split-string dir1 "/" t) '("/"))) @@ -5019,7 +5019,7 @@ (setq ls1 (cdr ls1) ls2 (cdr ls2))) (unless mismatch - (files-equal-p (file-truename root) dir2))))))) + (file-equal-p root dir2))))))) (defun copy-directory (directory newname &optional keep-time parents copy-contents) "Copy DIRECTORY to NEWNAME. Both args must be strings. @@ -5065,12 +5065,7 @@ (cond ((not (file-directory-p newname)) ;; If NEWNAME is not an existing directory, create it; ;; that is where we will copy the files of DIRECTORY. - (make-directory newname parents) - ;; `file-subdir-of-p' doesn't handle non--existing directories, - ;; so double check now if NEWNAME is not a subdir of DIRECTORY. - (and (file-subdir-of-p newname directory) - (error "Cannot copy `%s' into its subdirectory `%s'" - directory newname))) + (make-directory newname parents)) ;; If NEWNAME is an existing directory and COPY-CONTENTS ;; is nil, copy into NEWNAME/[DIRECTORY-BASENAME]. ((not copy-contents) --8<---------------cut here---------------end--------------->8--- -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 28 03:34:38 2012 Received: (at 10489) by debbugs.gnu.org; 28 Feb 2012 08:34:38 +0000 Received: from localhost ([127.0.0.1]:60741 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2IW6-0000R8-BN for submit@debbugs.gnu.org; Tue, 28 Feb 2012 03:34:38 -0500 Received: from mailout-de.gmx.net ([213.165.64.23]:52616) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S2IVu-0000Qk-K8 for 10489@debbugs.gnu.org; Tue, 28 Feb 2012 03:34:27 -0500 Received: (qmail invoked by alias); 28 Feb 2012 08:31:14 -0000 Received: from p57BB9CC6.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.156.198] by mail.gmx.net (mp033) with SMTP; 28 Feb 2012 09:31:14 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX18KFVlCWcQKqVssLM9QM9nbXcIfFwDNKOQq8ZaJ8z ejoQMcmm4Jw9E7 From: Michael Albinus To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> <87k439gyu5.fsf@gmail.com> <87fwdwhizm.fsf@gmail.com> <87bookhfcn.fsf@gmail.com> <87aa44o7qo.fsf@gmail.com> <87ty2c490n.fsf@gmail.com> <87r4xgkt2b.fsf@gmail.com> <87obskum9i.fsf@gmx.de> <874nuc9bao.fsf@gmail.com> <874nubzdsu.fsf@gmail.com> <87zkc3xwdn.fsf@gmail.com> <87k437o1hm.fsf@gmx.de> <87vcmrxtk2.fsf@gmail.com> Date: Tue, 28 Feb 2012 09:31:03 +0100 In-Reply-To: <87vcmrxtk2.fsf@gmail.com> (Thierry Volpiatto's message of "Tue, 28 Feb 2012 09:15:25 +0100") Message-ID: <87pqczxsu0.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Thierry Volpiatto writes: > Hi Michael, Hi Thierry, >> `files-equal-p' still returns t for two non-existing files. Shall be >> fixed too. > Fixed. Looks good to me. Thanks! >> Btw, this is the only primitive function which has the prefix "files-", >> all other start with prefix "file-". Is this necessary? > I wrote files because comparing two files, but I don't care of this, > just rename it to file- Thanks as well. I will change the name in Tramp once you have committed your patch (or, even better, you do it in tramp.el when committing your patch). Still some nit-picking :-) > -(defun files-equal-p (file1 file2) > +(defun file-equal-p (file1 file2) > "Return non-nil if FILE1 and FILE2 name the same file. > Ordinary files are considered to be the same if `file-attributes' > returns `equal' values for them." The file name handler implementation might not use `file-attributes' (that's why we call the handler). Better, you don't say it such strictly in the doc-string. Furthermore, I would like to see the phrase "... existing files ..." somewhere. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 28 04:38:33 2012 Received: (at 10489) by debbugs.gnu.org; 28 Feb 2012 09:38:33 +0000 Received: from localhost ([127.0.0.1]:60760 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2JVr-0001qC-Ex for submit@debbugs.gnu.org; Tue, 28 Feb 2012 04:38:33 -0500 Received: from mail-we0-f172.google.com ([74.125.82.172]:40277) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2JVZ-0001pP-GL for 10489@debbugs.gnu.org; Tue, 28 Feb 2012 04:38:15 -0500 Received: by werb10 with SMTP id b10so1557582wer.3 for <10489@debbugs.gnu.org>; Tue, 28 Feb 2012 01:34:58 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.92.73 as permitted sender) client-ip=10.180.92.73; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.92.73 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.180.92.73]) by 10.180.92.73 with SMTP id ck9mr36674209wib.2.1330421698079 (num_hops = 1); Tue, 28 Feb 2012 01:34:58 -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=/3ld4Ck2IeaPr0nCd1QEKqhxVKDGXAiT3IIbYn7DzLg=; b=d3pfuVQz7gAYi+A5WDRHOOqlVxiDDynVGufz4sp1oAOijbYWZw1+emExp75rCCqHMH gdfsc6jiVaUhdDYD+7/SHIl8w7pLn0XAP8PirjIFgzy7lGPYSQVrUgSyznsZ0iFamciq 9QgT8W3ej5w1U0CBlohH5PrRQZaMbwdREeqJE= Received: by 10.180.92.73 with SMTP id ck9mr29012813wib.2.1330421698016; Tue, 28 Feb 2012 01:34:58 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id gf3sm27589552wib.6.2012.02.28.01.34.55 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 28 Feb 2012 01:34:56 -0800 (PST) From: Thierry Volpiatto To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87ipiuvsbw.fsf@gmx.de> <87k439gyu5.fsf@gmail.com> <87fwdwhizm.fsf@gmail.com> <87bookhfcn.fsf@gmail.com> <87aa44o7qo.fsf@gmail.com> <87ty2c490n.fsf@gmail.com> <87r4xgkt2b.fsf@gmail.com> <87obskum9i.fsf@gmx.de> <874nuc9bao.fsf@gmail.com> <874nubzdsu.fsf@gmail.com> <87zkc3xwdn.fsf@gmail.com> <87k437o1hm.fsf@gmx.de> <87vcmrxtk2.fsf@gmail.com> <87pqczxsu0.fsf@gmx.de> Date: Tue, 28 Feb 2012 10:34:54 +0100 In-Reply-To: <87pqczxsu0.fsf@gmx.de> (Michael Albinus's message of "Tue, 28 Feb 2012 09:31:03 +0100") Message-ID: <87fwdvmhc1.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Michael Albinus writes: > Thierry Volpiatto writes: > >> Hi Michael, > > Hi Thierry, > >>> `files-equal-p' still returns t for two non-existing files. Shall be >>> fixed too. >> Fixed. > > Looks good to me. Thanks! > >>> Btw, this is the only primitive function which has the prefix "files-", >>> all other start with prefix "file-". Is this necessary? >> I wrote files because comparing two files, but I don't care of this, >> just rename it to file- > > Thanks as well. I will change the name in Tramp once you have committed > your patch (or, even better, you do it in tramp.el when committing your > patch). Done (in tramp.el too) > Still some nit-picking :-) > >> -(defun files-equal-p (file1 file2) >> +(defun file-equal-p (file1 file2) >> "Return non-nil if FILE1 and FILE2 name the same file. >> Ordinary files are considered to be the same if `file-attributes' >> returns `equal' values for them." > > The file name handler implementation might not use `file-attributes' > (that's why we call the handler). Better, you don't say it such strictly > in the doc-string. Furthermore, I would like to see the phrase > "... existing files ..." somewhere. Done for "existing files", I have removed mention of `files-attributes' comparison, as I really don't know what to put there. I have fixed basically files.texi accordingly. I leave more sophisticated documentation about tramp handler to you. ;-) -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 28 05:18:55 2012 Received: (at 10489) by debbugs.gnu.org; 28 Feb 2012 10:18:55 +0000 Received: from localhost ([127.0.0.1]:60789 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2K91-0002oN-Fe for submit@debbugs.gnu.org; Tue, 28 Feb 2012 05:18:55 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:53142) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S2K8p-0002o0-8j for 10489@debbugs.gnu.org; Tue, 28 Feb 2012 05:18:44 -0500 Received: (qmail invoked by alias); 28 Feb 2012 10:15:30 -0000 Received: from p57BB9CC6.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.156.198] by mail.gmx.net (mp020) with SMTP; 28 Feb 2012 11:15:30 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1++jS8kiUu+qSrNHo45vNu4tCo6WIjFWjnpXkM/DB 38cEhKX7O13ddY From: Michael Albinus To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87k439gyu5.fsf@gmail.com> <87fwdwhizm.fsf@gmail.com> <87bookhfcn.fsf@gmail.com> <87aa44o7qo.fsf@gmail.com> <87ty2c490n.fsf@gmail.com> <87r4xgkt2b.fsf@gmail.com> <87obskum9i.fsf@gmx.de> <874nuc9bao.fsf@gmail.com> <874nubzdsu.fsf@gmail.com> <87zkc3xwdn.fsf@gmail.com> <87k437o1hm.fsf@gmx.de> <87vcmrxtk2.fsf@gmail.com> <87pqczxsu0.fsf@gmx.de> <87fwdvmhc1.fsf@gmail.com> Date: Tue, 28 Feb 2012 11:15:20 +0100 In-Reply-To: <87fwdvmhc1.fsf@gmail.com> (Thierry Volpiatto's message of "Tue, 28 Feb 2012 10:34:54 +0100") Message-ID: <87y5rngt6v.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Thierry Volpiatto writes: >> Thanks as well. I will change the name in Tramp once you have committed >> your patch (or, even better, you do it in tramp.el when committing your >> patch). > Done (in tramp.el too) >> The file name handler implementation might not use `file-attributes' >> (that's why we call the handler). Better, you don't say it such strictly >> in the doc-string. Furthermore, I would like to see the phrase >> "... existing files ..." somewhere. > Done for "existing files", I have removed mention of `files-attributes' > comparison, as I really don't know what to put there. > I have fixed basically files.texi accordingly. Thanks! > I leave more sophisticated documentation about tramp handler to you. ;-) This could wait, until there are file name handler implementations. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 28 16:53:36 2012 Received: (at 10489) by debbugs.gnu.org; 28 Feb 2012 21:53:36 +0000 Received: from localhost ([127.0.0.1]:54676 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2UzI-0000Mu-71 for submit@debbugs.gnu.org; Tue, 28 Feb 2012 16:53:36 -0500 Received: from chene.dit.umontreal.ca ([132.204.246.20]:58199) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2Uz6-0000MW-6d for 10489@debbugs.gnu.org; Tue, 28 Feb 2012 16:53:25 -0500 Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id q1SJTlfC014153; Tue, 28 Feb 2012 14:29:47 -0500 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 277CFB4166; Tue, 28 Feb 2012 14:29:47 -0500 (EST) From: Stefan Monnier To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Message-ID: References: <87mx9su32g.fsf@web.de> <878vjrxpej.fsf@gmx.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> <87k439gyu5.fsf@gmail.com> <87fwdwhizm.fsf@gmail.com> <87bookhfcn.fsf@gmail.com> <87aa44o7qo.fsf@gmail.com> <87ty2c490n.fsf@gmail.com> <87r4xgkt2b.fsf@gmail.com> <87obskum9i.fsf@gmx.de> <874nuc9bao.fsf@gmail.com> <874nubzdsu.fsf@gmail.com> <87zkc3xwdn.fsf@gmail.com> <87k437o1hm.fsf@gmx.de> Date: Tue, 28 Feb 2012 14:29:47 -0500 In-Reply-To: <87k437o1hm.fsf@gmx.de> (Michael Albinus's message of "Tue, 28 Feb 2012 08:34:13 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4146=0 X-NAI-Spam-Version: 2.2.0.9309 : core <4146> : streams <733154> : uri <1073869> X-Spam-Score: -3.5 (---) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.5 (---) > `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. > Btw, this is the only primitive function which has the prefix "files-", > all other start with prefix "file-". Is this necessary? Agreed, using "file-" would be better. Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 28 17:41:04 2012 Received: (at 10489) by debbugs.gnu.org; 28 Feb 2012 22:41:04 +0000 Received: from localhost ([127.0.0.1]:54774 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2VjD-0001Vh-P9 for submit@debbugs.gnu.org; Tue, 28 Feb 2012 17:41:04 -0500 Received: from mailout-de.gmx.net ([213.165.64.23]:40229) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S2Vj1-0001VD-MC for 10489@debbugs.gnu.org; Tue, 28 Feb 2012 17:40:52 -0500 Received: (qmail invoked by alias); 28 Feb 2012 19:53:49 -0000 Received: from p57BB9CC6.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.156.198] by mail.gmx.net (mp029) with SMTP; 28 Feb 2012 20:53:49 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1+HaKZE0DSHvKcJFC7hI6ZELQxDqFO+FdoLoCwZN9 0kbffAiADTOxmZ From: Michael Albinus To: Stefan Monnier Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87pqd3i8ky.fsf@gmail.com> <87ipiuvsbw.fsf@gmx.de> <87k439gyu5.fsf@gmail.com> <87fwdwhizm.fsf@gmail.com> <87bookhfcn.fsf@gmail.com> <87aa44o7qo.fsf@gmail.com> <87ty2c490n.fsf@gmail.com> <87r4xgkt2b.fsf@gmail.com> <87obskum9i.fsf@gmx.de> <874nuc9bao.fsf@gmail.com> <874nubzdsu.fsf@gmail.com> <87zkc3xwdn.fsf@gmail.com> <87k437o1hm.fsf@gmx.de> Date: Tue, 28 Feb 2012 20:53:38 +0100 In-Reply-To: (Stefan Monnier's message of "Tue, 28 Feb 2012 14:29:47 -0500") Message-ID: <87booiu43h.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Stefan Monnier 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)? Because it doesn't matter? > Stefan Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 28 21:01:50 2012 Received: (at 10489) by debbugs.gnu.org; 29 Feb 2012 02:01:50 +0000 Received: from localhost ([127.0.0.1]:54938 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2YrV-00068F-Ld for submit@debbugs.gnu.org; Tue, 28 Feb 2012 21:01:50 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.183]:56129) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2Yr9-00067f-2e for 10489@debbugs.gnu.org; Tue, 28 Feb 2012 21:01:37 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AicFAKU/KE9FxJvl/2dsb2JhbACBX5x7eYhwnhmGGQSGUJRJhAs X-IronPort-AV: E=Sophos;i="4.73,1,1325480400"; d="scan'208";a="165064357" Received: from 69-196-155-229.dsl.teksavvy.com (HELO pastel.home) ([69.196.155.229]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 28 Feb 2012 21:01:10 -0500 Received: by pastel.home (Postfix, from userid 20848) id D671358F5C; Tue, 28 Feb 2012 21:01:09 -0500 (EST) From: Stefan Monnier To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Message-ID: References: <87mx9su32g.fsf@web.de> <87ipiuvsbw.fsf@gmx.de> <87k439gyu5.fsf@gmail.com> <87fwdwhizm.fsf@gmail.com> <87bookhfcn.fsf@gmail.com> <87aa44o7qo.fsf@gmail.com> <87ty2c490n.fsf@gmail.com> <87r4xgkt2b.fsf@gmail.com> <87obskum9i.fsf@gmx.de> <874nuc9bao.fsf@gmail.com> <874nubzdsu.fsf@gmail.com> <87zkc3xwdn.fsf@gmail.com> <87k437o1hm.fsf@gmx.de> <87booiu43h.fsf@gmx.de> Date: Tue, 28 Feb 2012 21:01:09 -0500 In-Reply-To: <87booiu43h.fsf@gmx.de> (Michael Albinus's message of "Tue, 28 Feb 2012 20:53:38 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >>> `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. > Because it doesn't matter? Yup, Stefan From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 29 06:05:34 2012 Received: (at 10489) by debbugs.gnu.org; 29 Feb 2012 11:05:34 +0000 Received: from localhost ([127.0.0.1]:55212 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2hLh-0003Ml-47 for submit@debbugs.gnu.org; Wed, 29 Feb 2012 06:05:34 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:33456) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S2hLL-0003Lx-Iz for 10489@debbugs.gnu.org; Wed, 29 Feb 2012 06:05:21 -0500 Received: (qmail invoked by alias); 29 Feb 2012 11:04:51 -0000 Received: from p57BB9B37.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.155.55] by mail.gmx.net (mp032) with SMTP; 29 Feb 2012 12:04:51 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX19awIQVjpRanMM+xLZPwGfi3QEOTAP8PiAq3rZLr9 l1wT64H19UwqxG From: Michael Albinus To: Stefan Monnier Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87k439gyu5.fsf@gmail.com> <87fwdwhizm.fsf@gmail.com> <87bookhfcn.fsf@gmail.com> <87aa44o7qo.fsf@gmail.com> <87ty2c490n.fsf@gmail.com> <87r4xgkt2b.fsf@gmail.com> <87obskum9i.fsf@gmx.de> <874nuc9bao.fsf@gmail.com> <874nubzdsu.fsf@gmail.com> <87zkc3xwdn.fsf@gmail.com> <87k437o1hm.fsf@gmx.de> <87booiu43h.fsf@gmx.de> Date: Wed, 29 Feb 2012 12:04:39 +0100 In-Reply-To: (Stefan Monnier's message of "Tue, 28 Feb 2012 21:01:09 -0500") Message-ID: <87linl529k.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Stefan Monnier 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. From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 29 11:48:51 2012 Received: (at 10489) by debbugs.gnu.org; 29 Feb 2012 16:48:51 +0000 Received: from localhost ([127.0.0.1]:56270 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2mhv-0003rG-9a for submit@debbugs.gnu.org; Wed, 29 Feb 2012 11:48:51 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:11215) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2mha-0003qm-T2 for 10489@debbugs.gnu.org; Wed, 29 Feb 2012 11:48:40 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AicFAKU/KE9FxJvl/2dsb2JhbACBX5x7eYhwnhmGGQSGUJRJhAs X-IronPort-AV: E=Sophos;i="4.73,1,1325480400"; d="scan'208";a="165173410" Received: from 69-196-155-229.dsl.teksavvy.com (HELO pastel.home) ([69.196.155.229]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 29 Feb 2012 11:48:10 -0500 Received: by pastel.home (Postfix, from userid 20848) id BBD9758F5C; Wed, 29 Feb 2012 11:48:09 -0500 (EST) From: Stefan Monnier To: Michael Albinus Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Message-ID: References: <87mx9su32g.fsf@web.de> <87fwdwhizm.fsf@gmail.com> <87bookhfcn.fsf@gmail.com> <87aa44o7qo.fsf@gmail.com> <87ty2c490n.fsf@gmail.com> <87r4xgkt2b.fsf@gmail.com> <87obskum9i.fsf@gmx.de> <874nuc9bao.fsf@gmail.com> <874nubzdsu.fsf@gmail.com> <87zkc3xwdn.fsf@gmail.com> <87k437o1hm.fsf@gmx.de> <87booiu43h.fsf@gmx.de> <87linl529k.fsf@gmx.de> Date: Wed, 29 Feb 2012 11:48:09 -0500 In-Reply-To: <87linl529k.fsf@gmx.de> (Michael Albinus's message of "Wed, 29 Feb 2012 12:04:39 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > Maybe we could change the entry in files.texi like this: [...] > @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. That looks good. > ! 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}) I'd rather not get into such issues in the doc. Stefan From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 29 12:53:45 2012 Received: (at 10489) by debbugs.gnu.org; 29 Feb 2012 17:53:45 +0000 Received: from localhost ([127.0.0.1]:56320 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2nid-0005Lb-CS for submit@debbugs.gnu.org; Wed, 29 Feb 2012 12:53:45 -0500 Received: from mail-we0-f172.google.com ([74.125.82.172]:56431) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2niL-0005L5-Ot for 10489@debbugs.gnu.org; Wed, 29 Feb 2012 12:53:28 -0500 Received: by werb10 with SMTP id b10so2600250wer.3 for <10489@debbugs.gnu.org>; Wed, 29 Feb 2012 09:53:01 -0800 (PST) Received-SPF: pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.107.169 as permitted sender) client-ip=10.180.107.169; Authentication-Results: mr.google.com; spf=pass (google.com: domain of thierry.volpiatto@gmail.com designates 10.180.107.169 as permitted sender) smtp.mail=thierry.volpiatto@gmail.com; dkim=pass header.i=thierry.volpiatto@gmail.com Received: from mr.google.com ([10.180.107.169]) by 10.180.107.169 with SMTP id hd9mr3076964wib.0.1330537981326 (num_hops = 1); Wed, 29 Feb 2012 09:53:01 -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=1lL8BqgKHHNnjxUVyV5YPGQa/+85mignsYSPpsF577Y=; b=tZR0LqrFoBaiOZXkj02pIn4L2OxVV11Q7SiSbiHFjVIP4ANituwGqSK8Wph77mlKSx kqw6tCeDXRkz/OsJ58AwrOCFhsAtq4gwZIHyRalnQCL5eoNkQzYzhNFR5ry5SAWJE54e DwLrzdgIHIp6yJw+mJpvFLwh0uhpWJuXinMOE= Received: by 10.180.107.169 with SMTP id hd9mr2471437wib.0.1330537981284; Wed, 29 Feb 2012 09:53:01 -0800 (PST) Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id gp8sm36568088wib.5.2012.02.29.09.52.58 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 29 Feb 2012 09:53:00 -0800 (PST) From: Thierry Volpiatto To: Stefan Monnier Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87fwdwhizm.fsf@gmail.com> <87bookhfcn.fsf@gmail.com> <87aa44o7qo.fsf@gmail.com> <87ty2c490n.fsf@gmail.com> <87r4xgkt2b.fsf@gmail.com> <87obskum9i.fsf@gmx.de> <874nuc9bao.fsf@gmail.com> <874nubzdsu.fsf@gmail.com> <87zkc3xwdn.fsf@gmail.com> <87k437o1hm.fsf@gmx.de> <87booiu43h.fsf@gmx.de> <87linl529k.fsf@gmx.de> Date: Wed, 29 Feb 2012 18:52:56 +0100 In-Reply-To: (Stefan Monnier's message of "Wed, 29 Feb 2012 11:48:09 -0500") Message-ID: <871updil1j.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Stefan Monnier writes: >> Maybe we could change the entry in files.texi like this: > [...] >> @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. > > That looks good. What can be done also is to return a string in this case. So possible return values could be e.g: "unspecified" => mean one of the files doesn't exists. nil => files exist and are not equal t => files exist and are equal. >> ! 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}) > > I'd rather not get into such issues in the doc. > > > Stefan -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 29 21:34:43 2012 Received: (at 10489) by debbugs.gnu.org; 1 Mar 2012 02:34:43 +0000 Received: from localhost ([127.0.0.1]:56559 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2vqs-0001pL-H0 for submit@debbugs.gnu.org; Wed, 29 Feb 2012 21:34:43 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.183]:13297) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2vqW-0001oq-Mv for 10489@debbugs.gnu.org; Wed, 29 Feb 2012 21:34:30 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AicFAKU/KE9FxJvl/2dsb2JhbACBX5x7eYhwnhmGGQSGUJRJhAs X-IronPort-AV: E=Sophos;i="4.73,1,1325480400"; d="scan'208";a="165302886" Received: from 69-196-155-229.dsl.teksavvy.com (HELO pastel.home) ([69.196.155.229]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 29 Feb 2012 21:33:56 -0500 Received: by pastel.home (Postfix, from userid 20848) id 2BF0558F5C; Wed, 29 Feb 2012 21:33:56 -0500 (EST) From: Stefan Monnier To: Thierry Volpiatto Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Message-ID: References: <87mx9su32g.fsf@web.de> <87bookhfcn.fsf@gmail.com> <87aa44o7qo.fsf@gmail.com> <87ty2c490n.fsf@gmail.com> <87r4xgkt2b.fsf@gmail.com> <87obskum9i.fsf@gmx.de> <874nuc9bao.fsf@gmail.com> <874nubzdsu.fsf@gmail.com> <87zkc3xwdn.fsf@gmail.com> <87k437o1hm.fsf@gmx.de> <87booiu43h.fsf@gmx.de> <87linl529k.fsf@gmx.de> <871updil1j.fsf@gmail.com> Date: Wed, 29 Feb 2012 21:33:56 -0500 In-Reply-To: <871updil1j.fsf@gmail.com> (Thierry Volpiatto's message of "Wed, 29 Feb 2012 18:52:56 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Michael Albinus X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >>> Maybe we could change the entry in files.texi like this: >> [...] >>> @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. >> >> That looks good. > What can be done also is to return a string in this case. > So possible return values could be e.g: > "unspecified" => mean one of the files doesn't exists. > nil => files exist and are not equal > t => files exist and are equal. No, we may decide in the future to return a particular value (maybe not always the same one), but we don't know yet what might be useful, so instead we say it's not specified. Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 01 03:38:32 2012 Received: (at 10489) by debbugs.gnu.org; 1 Mar 2012 08:38:32 +0000 Received: from localhost ([127.0.0.1]:56704 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S31Wx-0001fx-Kk for submit@debbugs.gnu.org; Thu, 01 Mar 2012 03:38:32 -0500 Received: from mailout-de.gmx.net ([213.165.64.22]:35797) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1S31Wa-0001f7-PZ for 10489@debbugs.gnu.org; Thu, 01 Mar 2012 03:38:19 -0500 Received: (qmail invoked by alias); 01 Mar 2012 08:37:43 -0000 Received: from p57BB9B17.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.155.23] by mail.gmx.net (mp030) with SMTP; 01 Mar 2012 09:37:43 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1+r9EF0YsKrcEInhH1GZq8d/ggbo+qX3sPtah7sO7 aNl54rJYpMFHCi From: Michael Albinus To: Stefan Monnier Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy References: <87mx9su32g.fsf@web.de> <87fwdwhizm.fsf@gmail.com> <87bookhfcn.fsf@gmail.com> <87aa44o7qo.fsf@gmail.com> <87ty2c490n.fsf@gmail.com> <87r4xgkt2b.fsf@gmail.com> <87obskum9i.fsf@gmx.de> <874nuc9bao.fsf@gmail.com> <874nubzdsu.fsf@gmail.com> <87zkc3xwdn.fsf@gmail.com> <87k437o1hm.fsf@gmx.de> <87booiu43h.fsf@gmx.de> <87linl529k.fsf@gmx.de> Date: Thu, 01 Mar 2012 09:37:31 +0100 In-Reply-To: (Stefan Monnier's message of "Wed, 29 Feb 2012 11:48:09 -0500") Message-ID: <87mx80af90.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10489 Cc: 10489@debbugs.gnu.org, Thierry Volpiatto X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Stefan Monnier writes: >> Maybe we could change the entry in files.texi like this: > [...] >> @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. > > That looks good. Committed to files.texi and files.el. > Stefan Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 09 23:52:55 2012 Received: (at control) by debbugs.gnu.org; 10 Mar 2012 04:52:55 +0000 Received: from localhost ([127.0.0.1]:41591 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S6EIY-0005iY-M2 for submit@debbugs.gnu.org; Fri, 09 Mar 2012 23:52:55 -0500 Received: from fencepost.gnu.org ([208.118.235.10]:43487) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S6EIV-0005iR-Nu for control@debbugs.gnu.org; Fri, 09 Mar 2012 23:52:52 -0500 Received: from bb116-14-103-36.singnet.com.sg ([116.14.103.36]:54562 helo=ulysses) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1S6Dpp-0004Q9-Aj for control@debbugs.gnu.org; Fri, 09 Mar 2012 23:23:14 -0500 From: Chong Yidong To: control@debbugs.gnu.org Subject: close 10489 Date: Sat, 10 Mar 2012 12:23:05 +0800 Message-ID: <87haxx5bkm.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) close 10489 thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 21 22:47:54 2012 Received: (at submit) by debbugs.gnu.org; 22 Mar 2012 02:47:54 +0000 Received: from localhost ([127.0.0.1]:60353 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SAY4A-00036A-5L for submit@debbugs.gnu.org; Wed, 21 Mar 2012 22:47:54 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34479) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SAY46-000362-S0 for submit@debbugs.gnu.org; Wed, 21 Mar 2012 22:47:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SAXaK-0002rb-Fd for submit@debbugs.gnu.org; Wed, 21 Mar 2012 22:17:05 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_WEB,RCVD_IN_XBL autolearn=ham version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:41374) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAXaK-0002rN-C1 for submit@debbugs.gnu.org; Wed, 21 Mar 2012 22:17:04 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57383) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAXaI-0007ap-Ku for bug-gnu-emacs@gnu.org; Wed, 21 Mar 2012 22:17:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SAXaG-0002nJ-Kk for bug-gnu-emacs@gnu.org; Wed, 21 Mar 2012 22:17:01 -0400 Received: from fmmailgate04.web.de ([217.72.192.242]:49639) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAXaG-0002ku-Ci for bug-gnu-emacs@gnu.org; Wed, 21 Mar 2012 22:17:00 -0400 Received: from moweb002.kundenserver.de (moweb002.kundenserver.de [172.19.20.108]) by fmmailgate04.web.de (Postfix) with ESMTP id E1EA87425F05 for ; Thu, 22 Mar 2012 03:16:58 +0100 (CET) Received: from snow.dragon ([80.226.24.13]) by smtp.web.de (mrweb001) with ESMTPA (Nemesis) id 0LhvUI-1SehTJ313C-00n0hQ; Thu, 22 Mar 2012 03:16:58 +0100 From: Michael Heerdegen To: bug-gnu-emacs@gnu.org Subject: Re: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy In-Reply-To: <87mx9su32g.fsf@web.de> (Michael Heerdegen's message of "Thu, 12 Jan 2012 20:35:19 +0100") References: <87mx9su32g.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) Date: Thu, 22 Mar 2012 03:18:44 +0100 Message-ID: <87mx798jjv.fsf@web.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V02:K0:11cCcUoPmn0nMM2n32DWxYS7FBPcRBVXssEm5o6G0LV 5euCkBqD8gDHc/zovyItHe3A9cOqcySxc2KH+97FsPm/SlaZl7 IUwEq0t218mRmkhEITq57YGc1JsaAM+m3UtP33pbSH/urJIJ7n R2OPY9U8NJctWkdWiZH5MVu8ey8YdxyuEvGQ9mLaE/ZP55cFH8 sHEs/T979Uk1dQ+YSXJ2+pnyS4Bhs1In0Ey3/dOR4s= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -4.8 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.8 (----) Hello again, I'm afraid there are still problems. I encountered these two: 1. Creating symlinks to parent directories doesn't work anymore. E.g. if you have a directory "~/test/dir1/", open a dired for "~", go to "test/", hit S, enter "~/test/dir1/" and hit RET. You get the error dired-create-files: Cannot copy `/home/micha/test' into its subdirectory = `/home/micha/test/dir1/test' But I only wanted a symlink... This worked in Emacs 23. 2. Symlinks to parent directories (still) lead to ininite loops when copying containing dir. To use the above example: just create this symlink from outside Emacs, so you get e.g. this: /home/micha/test/dir1: total used in directory 8,0K available 94267456 drwxr-xr-x 2 micha users 4,0K M=C3=A4r 22 02:32 . drwxr-xr-x 3 micha users 4,0K M=C3=A4r 22 02:33 .. lrwxrwxrwx 1 micha users 22 M=C3=A4r 22 02:32 test -> /home/micha/test Now dired "~", and copy "~/test" to "~/test2". You get a hierarchy ~/test2/dir1/test/dir1/test/... again (the command terminates without error, btw). And all these are real directories, and _not_ symlinks! I also wonder why dired doesn't copy the symlink itself, but copies the target instead? This seems to be the case also in other examples. If I copy a directory containing any symlinks with dired, copying always copies the targets of the symlinks. Michael From unknown Sun Jun 22 11:38:44 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: Did not alter fixed versions and reopened. Date: Thu, 29 Mar 2012 04:34:01 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # Did not alter fixed versions and reopened. thanks # This fakemail brought to you by your local debbugs # administrator From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 30 03:28:13 2012 Received: (at control) by debbugs.gnu.org; 30 Mar 2012 07:28:13 +0000 Received: from localhost ([127.0.0.1]:45905 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SDWFo-00085r-Uh for submit@debbugs.gnu.org; Fri, 30 Mar 2012 03:28:13 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:41447) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SDWFn-00085k-3l for control@debbugs.gnu.org; Fri, 30 Mar 2012 03:28:11 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1SDVlH-0006ll-Ou for control@debbugs.gnu.org; Fri, 30 Mar 2012 02:56:39 -0400 Date: Fri, 30 Mar 2012 02:56:39 -0400 Message-Id: Subject: control message for bug 11130 To: X-Mailer: mail (GNU Mailutils 2.1) From: Glenn Morris X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) forcemerge 10489 11130 From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 30 13:27:07 2012 Received: (at control) by debbugs.gnu.org; 30 Mar 2012 17:27:08 +0000 Received: from localhost ([127.0.0.1]:47264 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SDfbP-0007l6-GI for submit@debbugs.gnu.org; Fri, 30 Mar 2012 13:27:07 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:57507) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SDfbO-0007ky-Je for control@debbugs.gnu.org; Fri, 30 Mar 2012 13:27:06 -0400 Received: from bb121-6-72-34.singnet.com.sg ([121.6.72.34]:57206 helo=ulysses) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1SDf6q-0001fj-7u for control@debbugs.gnu.org; Fri, 30 Mar 2012 12:55:32 -0400 From: Chong Yidong To: control@debbugs.gnu.org Subject: close 10489 Date: Sat, 31 Mar 2012 00:55:26 +0800 Message-ID: <87pqbujaf5.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) close 10489 thanks From unknown Sun Jun 22 11:38:44 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 28 Apr 2012 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator