From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Ken Brown Newsgroups: gmane.emacs.bugs Subject: bug#24441: 24.5; rename directory in dired to change case Date: Fri, 11 Nov 2016 16:42:13 -0500 Message-ID: <1b36666e-4754-b38a-f997-195e04e8a556@cornell.edu> References: < < <<3c49fbe5-9ae0-4ae2-8fa0-3c44fa85c981@default> <<83d1k56wwt.fsf@gnu.org> <7a1c7e15-4d84-400d-9735-a72a31408d6b@default> <834m5h6vg3.fsf@gnu.org> <5965f396-a65a-3d70-e67e-c3d680fe9e65@cornell.edu> <83zin95ddg.fsf@gnu.org> <8da158f4-21bb-8fb8-a56d-21d4cd967109@cornell.edu> <61dc70de-7dfc-269c-e974-839f8d138d33@cornell.edu> <83fumye808.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------B1E00EA6B7E3CF00664A9B2D" X-Trace: blaine.gmane.org 1478900620 26019 195.159.176.226 (11 Nov 2016 21:43:40 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 11 Nov 2016 21:43:40 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 Cc: 24441@debbugs.gnu.org, schwab@suse.de, brady@bradyt.com To: Eli Zaretskii , Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Nov 11 22:43:33 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c5JbP-0003bG-AV for geb-bug-gnu-emacs@m.gmane.org; Fri, 11 Nov 2016 22:43:15 +0100 Original-Received: from localhost ([::1]:55518 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c5JbS-0001tp-B3 for geb-bug-gnu-emacs@m.gmane.org; Fri, 11 Nov 2016 16:43:18 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45000) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c5JbG-0001qK-6x for bug-gnu-emacs@gnu.org; Fri, 11 Nov 2016 16:43:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c5JbB-0003oU-T6 for bug-gnu-emacs@gnu.org; Fri, 11 Nov 2016 16:43:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:38948) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c5JbB-0003oN-PR for bug-gnu-emacs@gnu.org; Fri, 11 Nov 2016 16:43:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1c5JbB-0002wt-J8 for bug-gnu-emacs@gnu.org; Fri, 11 Nov 2016 16:43:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ken Brown Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 11 Nov 2016 21:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24441 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24441-submit@debbugs.gnu.org id=B24441.147890054711290 (code B ref 24441); Fri, 11 Nov 2016 21:43:01 +0000 Original-Received: (at 24441) by debbugs.gnu.org; 11 Nov 2016 21:42:27 +0000 Original-Received: from localhost ([127.0.0.1]:54347 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c5Jac-0002w2-Mb for submit@debbugs.gnu.org; Fri, 11 Nov 2016 16:42:27 -0500 Original-Received: from limerock03.mail.cornell.edu ([128.84.13.243]:45730) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c5Jaa-0002vp-98 for 24441@debbugs.gnu.org; Fri, 11 Nov 2016 16:42:25 -0500 X-CornellRouted: This message has been Routed already. Original-Received: from authusersmtp.mail.cornell.edu (granite4.serverfarm.cornell.edu [10.16.197.9]) by limerock03.mail.cornell.edu (8.14.4/8.14.4_cu) with ESMTP id uABLgFZ3026685; Fri, 11 Nov 2016 16:42:16 -0500 Original-Received: from [10.128.130.82] (dhcp-gs-594.eduroam.cornell.edu [10.128.130.82]) (authenticated bits=0) by authusersmtp.mail.cornell.edu (8.14.4/8.12.10) with ESMTP id uABLgERm028226 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Fri, 11 Nov 2016 16:42:14 -0500 In-Reply-To: <83fumye808.fsf@gnu.org> X-PMX-Cornell-Gauge: Gauge=XX X-PMX-CORNELL-AUTH-RESULTS: dkim-out=none; X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:125637 Archived-At: This is a multi-part message in MIME format. --------------B1E00EA6B7E3CF00664A9B2D Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 11/11/2016 3:27 AM, Eli Zaretskii wrote: > Thanks, please see a few comments below. > >> + (if (and (file-name-case-insensitive-p >> + (expand-file-name (car fn-list))) > > You shouldn't need to expand-file-name here, as all primitives do that > internally. (Yours didn't, but that's a mistake, see below.) Fixed. > What about filesystems mounted on Posix hosts, like Samba, NFS-mounted > Windows volumes, etc. -- do those behave as case-sensitive or not? If > the latter, can that be detected? Just asking, this shouldn't hold > the patch, unless incorporating that is easy (or you feel like it even > if it isn't ;-). I don't have an immediate idea, but I added a "FIXME" comment and will think about it. >> +DEFUN ("file-name-case-insensitive-p", Ffile_name_case_insensitive_p, >> + Sfile_name_case_insensitive_p, 1, 1, 0, >> + doc: /* Return t if file FILENAME is on a case-insensitive filesystem. >> +The arg must be a string. */) >> + (Lisp_Object filename) >> +{ >> + CHECK_STRING (filename); >> + return file_name_case_insensitive_p (SSDATA (filename)) ? Qt : Qnil; >> +} > > This "needs work"™. First, it should call expand-file-name, as all > file-related primitives do. Second, it should see if there's a file > handler for this operation, and if so, call it instead (Michael, > please take note ;-). Finally, it should run the expanded file name > through ENCODE_FILE before it calls file_name_case_insensitive_p, and > pass to the latter the result of the encoding, otherwise the call to > getattrlist will most certainly fail in some cases. Fixed. >> DEFUN ("rename-file", Frename_file, Srename_file, 2, 3, >> "fRename file: \nGRename %s to file: \np", >> doc: /* Rename FILE as NEWNAME. Both args must be strings. >> @@ -2250,12 +2301,11 @@ This is what happens in interactive use with M-x. */) >> file = Fexpand_file_name (file, Qnil); >> >> if ((!NILP (Ffile_directory_p (newname))) >> -#ifdef DOS_NT >> - /* If the file names are identical but for the case, >> - don't attempt to move directory to itself. */ >> - && (NILP (Fstring_equal (Fdowncase (file), Fdowncase (newname)))) >> -#endif >> - ) >> + /* If the filesystem is case-insensitive and the file names are >> + identical but for the case, don't attempt to move directory >> + to itself. */ >> + && (NILP (Ffile_name_case_insensitive_p (file)) >> + || NILP (Fstring_equal (Fdowncase (file), Fdowncase (newname))))) > > This should call file_name_case_insensitive_p, and pass it the encoded > file names. That's because the file handlers for rename-file were > already called, so we are now sure the file doesn't have any handlers. Actually, the handlers haven't been called yet at this point in the code, so I left this one alone. >> @@ -2276,14 +2326,12 @@ This is what happens in interactive use with M-x. */) >> encoded_file = ENCODE_FILE (file); >> encoded_newname = ENCODE_FILE (newname); >> >> -#ifdef DOS_NT >> - /* If the file names are identical but for the case, don't ask for >> - confirmation: they simply want to change the letter-case of the >> - file name. */ >> - if (NILP (Fstring_equal (Fdowncase (file), Fdowncase (newname)))) >> -#endif >> - if (NILP (ok_if_already_exists) >> - || INTEGERP (ok_if_already_exists)) >> + /* If the filesystem is case-insensitive and the file names are >> + identical but for the case, don't ask for confirmation: they >> + simply want to change the letter-case of the file name. */ >> + if ((NILP (Ffile_name_case_insensitive_p (file)) > > Likewise here. Fixed. > Finally, please provide a NEWS entry for the new primitive and its > documentation in the ELisp manual. Done, but I'm not sure I found the best place for it in the manual. Thanks for the review. Revised patch attached. Ken --------------B1E00EA6B7E3CF00664A9B2D Content-Type: text/plain; charset=UTF-8; name="0001-Check-case-sensitivity-when-renaming-files.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="0001-Check-case-sensitivity-when-renaming-files.patch" RnJvbSAyMDllNDdkZjYzNGJjYmM3ZTQyMzliOWM3ZjdiNjJmMTc0MTllZGJmIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBLZW4gQnJvd24gPGticm93bkBjb3JuZWxsLmVkdT4K RGF0ZTogU2F0LCAyMiBPY3QgMjAxNiAxOToxMDoxOCAtMDQwMApTdWJqZWN0OiBbUEFUQ0hd IENoZWNrIGNhc2Utc2Vuc2l0aXZpdHkgd2hlbiByZW5hbWluZyBmaWxlcwoKKiBzcmMvZmls ZWlvLmMgKGZpbGVfbmFtZV9jYXNlX2luc2Vuc2l0aXZlX3ApCihGZmlsZV9uYW1lX2Nhc2Vf aW5zZW5zaXRpdmVfcCk6ICBOZXcgZnVuY3Rpb25zLgooRnJlbmFtZV9maWxlKTogQWxsb3cg cmVuYW1lcyB0aGF0IHNpbXBseSBjaGFuZ2UgY2FzZSB3aGVuIHRoZQpGSUxFIGFyZ3VtZW50 IGlzIG9uIGEgY2FzZS1pbnNlbnNpdGl2ZSBmaWxlc3lzdGVtLiAgKEJ1ZyMyNDQ0MSkKCiog bGlzcC9kaXJlZC1hdXguZWwgKGRpcmVk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