From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.bugs Subject: bug#10489: 24.0.92; dired-do-copy may create infinite directory hierarchy Date: Thu, 23 Feb 2012 07:15:13 +0100 Message-ID: <87linuvzwu.fsf@gmail.com> 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> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1329977747 24267 80.91.229.3 (23 Feb 2012 06:15:47 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 23 Feb 2012 06:15:47 +0000 (UTC) Cc: 10489@debbugs.gnu.org, Michael Albinus To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Feb 23 07:15:46 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 1S0Rxt-00078C-H9 for geb-bug-gnu-emacs@m.gmane.org; Thu, 23 Feb 2012 07:15:41 +0100 Original-Received: from localhost ([::1]:56597 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0Rxs-0007WE-HU for geb-bug-gnu-emacs@m.gmane.org; Thu, 23 Feb 2012 01:15:40 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:41712) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0Rxq-0007W9-AL for bug-gnu-emacs@gnu.org; Thu, 23 Feb 2012 01:15:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S0Rxo-0005qN-OY for bug-gnu-emacs@gnu.org; Thu, 23 Feb 2012 01:15:38 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48177) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0Rxo-0005qH-7Y for bug-gnu-emacs@gnu.org; Thu, 23 Feb 2012 01:15:36 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1S0S0A-00083F-2C for bug-gnu-emacs@gnu.org; Thu, 23 Feb 2012 01:18:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Thierry Volpiatto Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 Feb 2012 06:18: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.132997787430933 (code B ref 10489); Thu, 23 Feb 2012 06:18:01 +0000 Original-Received: (at 10489) by debbugs.gnu.org; 23 Feb 2012 06:17:54 +0000 Original-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 Original-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 Original-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 Original-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= Original-Received: by 10.180.83.70 with SMTP id o6mr2307492wiy.19.1329977717689; Wed, 22 Feb 2012 22:15:17 -0800 (PST) Original-Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id ft8sm2123174wib.11.2012.02.22.22.15.15 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 22 Feb 2012 22:15:16 -0800 (PST) In-Reply-To: (Stefan Monnier's message of "Wed, 22 Feb 2012 17:00:08 -0500") 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:57125 Archived-At: 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