From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Date: Wed, 22 Feb 2012 17:00:08 -0500 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> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1329948048 2305 80.91.229.3 (22 Feb 2012 22:00:48 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 22 Feb 2012 22:00:48 +0000 (UTC) Cc: 10489@debbugs.gnu.org, Michael Albinus To: Thierry Volpiatto Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Feb 22 23:00:47 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1S0KEs-0007O9-7F for geb-bug-gnu-emacs@m.gmane.org; Wed, 22 Feb 2012 23:00:42 +0100 Original-Received: from localhost ([::1]:39062 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0KEr-0000ll-Kf for geb-bug-gnu-emacs@m.gmane.org; Wed, 22 Feb 2012 17:00:41 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:37909) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0KEp-0000lM-2h for bug-gnu-emacs@gnu.org; Wed, 22 Feb 2012 17:00:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S0KEo-0000RO-0c for bug-gnu-emacs@gnu.org; Wed, 22 Feb 2012 17:00:38 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:47885) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0KEn-0000RK-S7 for bug-gnu-emacs@gnu.org; Wed, 22 Feb 2012 17:00:37 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1S0KH7-0003zu-H4 for bug-gnu-emacs@gnu.org; Wed, 22 Feb 2012 17:03:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Feb 2012 22:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10489 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 10489-submit@debbugs.gnu.org id=B10489.132994816415340 (code B ref 10489); Wed, 22 Feb 2012 22:03:01 +0000 Original-Received: (at 10489) by debbugs.gnu.org; 22 Feb 2012 22:02:44 +0000 Original-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 Original-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" Original-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 Original-Received: by pastel.home (Postfix, from userid 20848) id B62BB59173; Wed, 22 Feb 2012 17:00:08 -0500 (EST) 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) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:57114 Archived-At: > 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