From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.bugs Subject: 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> 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> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1326473862 23768 80.91.229.12 (13 Jan 2012 16:57:42 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 13 Jan 2012 16:57:42 +0000 (UTC) Cc: 10489@debbugs.gnu.org, michael.albinus@gmx.de To: "'Eli Zaretskii'" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jan 13 17:57:37 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RlkRa-0002ZI-TM for geb-bug-gnu-emacs@m.gmane.org; Fri, 13 Jan 2012 17:57:35 +0100 Original-Received: from localhost ([::1]:51510 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlkRa-0002RJ-Hs for geb-bug-gnu-emacs@m.gmane.org; Fri, 13 Jan 2012 11:57:34 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:40675) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlkRW-0002Qb-Qf for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2012 11:57:31 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RlkRQ-000223-RG for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2012 11:57:30 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:33733) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlkRQ-00021z-PL for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2012 11:57:24 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1RlkS2-0007XZ-9B for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2012 11:58:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: "Drew Adams" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 13 Jan 2012 16:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10489 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 10489-submit@debbugs.gnu.org id=B10489.132647386228956 (code B ref 10489); Fri, 13 Jan 2012 16:58:02 +0000 Original-Received: (at 10489) by debbugs.gnu.org; 13 Jan 2012 16:57:42 +0000 Original-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 Original-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 Original-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 Original-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 Original-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 Original-Received: from dradamslap1 (/10.159.36.36) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 13 Jan 2012 08:56:52 -0800 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-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:55701 Archived-At: > > 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?