From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#24441: 24.5; rename directory in dired to change case Date: Sat, 20 May 2017 23:17:25 -0700 Organization: UCLA Computer Science Department Message-ID: <65d38d1c-5b0e-a1b2-3113-34d450512633@cs.ucla.edu> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------4B35A970C6AA12DFC57CCE9B" X-Trace: blaine.gmane.org 1495347499 25096 195.159.176.226 (21 May 2017 06:18:19 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 21 May 2017 06:18:19 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 Cc: Brady Trainor To: 24441@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 21 08:18:11 2017 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 1dCKBr-0006H9-NW for geb-bug-gnu-emacs@m.gmane.org; Sun, 21 May 2017 08:18:07 +0200 Original-Received: from localhost ([::1]:36519 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dCKBx-0000N7-5A for geb-bug-gnu-emacs@m.gmane.org; Sun, 21 May 2017 02:18:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36903) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dCKBq-0000N2-7Q for bug-gnu-emacs@gnu.org; Sun, 21 May 2017 02:18:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dCKBm-0003jZ-UW for bug-gnu-emacs@gnu.org; Sun, 21 May 2017 02:18:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:54968) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dCKBm-0003ix-Qs for bug-gnu-emacs@gnu.org; Sun, 21 May 2017 02:18:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dCKBm-0004XX-EN for bug-gnu-emacs@gnu.org; Sun, 21 May 2017 02:18:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 21 May 2017 06:18:02 +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.149534745517418 (code B ref 24441); Sun, 21 May 2017 06:18:02 +0000 Original-Received: (at 24441) by debbugs.gnu.org; 21 May 2017 06:17:35 +0000 Original-Received: from localhost ([127.0.0.1]:57645 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCKBK-0004Ws-Sg for submit@debbugs.gnu.org; Sun, 21 May 2017 02:17:35 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:33300) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCKBI-0004Wf-TW for 24441@debbugs.gnu.org; Sun, 21 May 2017 02:17:33 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 5F79E160051; Sat, 20 May 2017 23:17:27 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id em4gYUE9fpjE; Sat, 20 May 2017 23:17:26 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id F288B16007F; Sat, 20 May 2017 23:17:25 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Kq_roPv--pBZ; Sat, 20 May 2017 23:17:25 -0700 (PDT) Original-Received: from [192.168.1.9] (unknown [47.153.188.248]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id CEAFE160051; Sat, 20 May 2017 23:17:25 -0700 (PDT) Content-Language: en-US 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:132694 Archived-At: This is a multi-part message in MIME format. --------------4B35A970C6AA12DFC57CCE9B Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable As mentioned in the thread containing this message: http://lists.gnu.org/archive/html/emacs-devel/2017-05/msg00521.html the DARWIN_OS_CASE_SENSITIVE_FIXME code was getting in the way of mainten= ance,=20 and doesn't seem to be working or needed or used. I attempted to get it t= o work=20 in the first attached patch (untested), and then removed it as described = in the=20 second attached patch. If that code ever turns out to be useful someone c= an=20 revert the second patch and give my attempt a whirl. As I understand it, the original bug was fixed last year; this email is m= erely=20 about trying to make the fix easier to maintain. --------------4B35A970C6AA12DFC57CCE9B Content-Type: text/x-patch; name="0001-Narrow-DARWIN_OS_CASE_SENSITIVE_FIXME-to-1-choice.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename*0="0001-Narrow-DARWIN_OS_CASE_SENSITIVE_FIXME-to-1-choice.patch" =46rom 075bd64609446e741a6efbcd6cd6e232db8d1df6 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 20 May 2017 22:51:32 -0700 Subject: [PATCH 1/2] Narrow DARWIN_OS_CASE_SENSITIVE_FIXME to 1 choice * etc/PROBLEMS: Document this (Bug#24441). * src/fileio.c (file_name_case_insensitive_p): Prefer pathconf with _PC_CASE_SENSITIVE, if it works, to DARWIN_OS_CASE_SENSITIVE_FIXME code. Support just one method for DARWIN_OS_CASE_SENSITIVE_FIXME, which matches the Apple documentation more precisely. --- etc/PROBLEMS | 5 ++--- src/fileio.c | 68 ++++++++++++++++++++----------------------------------= ------ 2 files changed, 24 insertions(+), 49 deletions(-) diff --git a/etc/PROBLEMS b/etc/PROBLEMS index e415887..ff88aa3 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS @@ -2486,9 +2486,8 @@ If you do, please send it to bug-gnu-emacs@gnu.org = so we can list it here. The implementation of that function on Mac OS X uses pathconf with the _PC_CASE_SENSITIVE flag. There have been reports that this use of pathconf does not work reliably. If you have a problem, please -recompile Emacs with -D DARWIN_OS_CASE_SENSITIVE_FIXME=3D1 or --D DARWIN_OS_CASE_SENSITIVE_FIXME=3D2, and file a bug report saying -whether this fixed your problem. +recompile Emacs with -D DARWIN_OS_CASE_SENSITIVE_FIXME, and file a bug +report saying whether this fixed your problem. =20 * Build-time problems =20 diff --git a/src/fileio.c b/src/fileio.c index e5e3505..17659b6 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2256,65 +2256,41 @@ static bool file_name_case_insensitive_p (const char *filename) { /* Use pathconf with _PC_CASE_INSENSITIVE or _PC_CASE_SENSITIVE if - those flags are available. As of this writing (2016-11-14), + those flags are available. As of this writing (2017-05-20), Cygwin is the only platform known to support the former (starting - with Cygwin-2.6.1), and Mac OS X is the only platform known to - support the latter. - - There have been reports that pathconf with _PC_CASE_SENSITIVE - does not work reliably on Mac OS X. If you have a problem, - please recompile Emacs with -D DARWIN_OS_CASE_SENSITIVE_FIXME=3D1 o= r - -D DARWIN_OS_CASE_SENSITIVE_FIXME=3D2, and file a bug report saying= - whether this fixed your problem. */ + with Cygwin-2.6.1), and macOS is the only platform known to + support the latter. */ =20 #ifdef _PC_CASE_INSENSITIVE int res =3D pathconf (filename, _PC_CASE_INSENSITIVE); if (res >=3D 0) return res > 0; -#elif defined _PC_CASE_SENSITIVE && !defined DARWIN_OS_CASE_SENSITIVE_FI= XME +#elif defined _PC_CASE_SENSITIVE int res =3D pathconf (filename, _PC_CASE_SENSITIVE); if (res >=3D 0) return res =3D=3D 0; #endif =20 -#ifdef DARWIN_OS -# ifndef DARWIN_OS_CASE_SENSITIVE_FIXME - int DARWIN_OS_CASE_SENSITIVE_FIXME =3D 0; -# endif + /* There have been reports that pathconf with _PC_CASE_SENSITIVE + does not work reliably on Mac OS X. If you have a problem, + please recompile Emacs with -D DARWIN_OS_CASE_SENSITIVE_FIXME=3D1 o= r + -D DARWIN_OS_CASE_SENSITIVE_FIXME=3D2, and file a bug report saying= + whether this fixed your problem. */ =20 - if (DARWIN_OS_CASE_SENSITIVE_FIXME =3D=3D 1) - { - /* This is based on developer.apple.com's getattrlist man page. *= / - struct attrlist alist =3D {.volattr =3D ATTR_VOL_CAPABILITIES}; - vol_capabilities_attr_t vcaps; - if (getattrlist (filename, &alist, &vcaps, sizeof vcaps, 0) =3D=3D= 0) - { - if (vcaps.valid[VOL_CAPABILITIES_FORMAT] & VOL_CAP_FMT_CASE_SENSITIVE= ) - return ! (vcaps.capabilities[VOL_CAPABILITIES_FORMAT] - & VOL_CAP_FMT_CASE_SENSITIVE); - } - } -# if DARWIN_OS_CASE_SENSITIVE_FIXME =3D=3D 2 - { - /* The following is based on - http://lists.apple.com/archives/darwin-dev/2007/Apr/msg00010.html. - It is normally not even compiled, since it runs afoul of - static checking. See: - http://lists.gnu.org/archive/html/emacs-devel/2017-05/msg00495.html - */ - struct attrlist alist; - unsigned char buffer[sizeof (vol_capabilities_attr_t) + sizeof (si= ze_t)]; - - memset (&alist, 0, sizeof (alist)); - alist.volattr =3D ATTR_VOL_CAPABILITIES; - if (getattrlist (filename, &alist, buffer, sizeof (buffer), 0) - || !(alist.volattr & ATTR_VOL_CAPABILITIES)) - return 0; - vol_capabilities_attr_t *vcaps =3D buffer; - return !(vcaps->capabilities[0] & VOL_CAP_FMT_CASE_SENSITIVE); - } +#ifdef DARWIN_OS_CASE_SENSITIVE_FIXME +# ifdef VOL_CAP_FMT_CASE_SENSITIVE + { + struct attrlist alist =3D {.bitmapcount =3D ATTR_BIT_MAP_COUNT, + .volattr =3D ATTR_VOL_INFO | ATTR_VOL_CAPABILITIES}; + struct { uint32_t len; vol_capabilities_attr_t caps; } vcaps + __attribute__ ((aligned (4), packed)); + int i =3D VOL_CAPABILITIES_FORMAT; + if (getattrlist (filename, &alist, &vcaps, sizeof vcaps, 0) =3D=3D 0= + && (vcaps.caps.valid[i] & VOL_CAP_FMT_CASE_SENSITIVE)) + return ! (vcaps.caps.capabilities[i] & VOL_CAP_FMT_CASE_SENSITIVE)= ; + } # endif -#endif /* DARWIN_OS */ +#endif =20 #if defined CYGWIN || defined DOS_NT return true; --=20 2.7.4 --------------4B35A970C6AA12DFC57CCE9B Content-Type: text/x-patch; name="0002-Remove-DARWIN_OS_CASE_SENSITIVE_FIXME-code.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0002-Remove-DARWIN_OS_CASE_SENSITIVE_FIXME-code.patch" =46rom b35293dfd0e9dd95a88ac01051655d0d2d105992 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 20 May 2017 22:55:17 -0700 Subject: [PATCH 2/2] Remove DARWIN_OS_CASE_SENSITIVE_FIXME code It does not appear to be needed (Bug#24441). * etc/PROBLEMS: Remove DARWIN_OS_CASE_SENSITIVE_FIXME stuff. * src/fileio.c (file_name_case_insensitive_p): Remove DARWIN_OS_CASE_SENSITIVE_FIXME code. --- etc/PROBLEMS | 10 ---------- src/fileio.c | 21 --------------------- 2 files changed, 31 deletions(-) diff --git a/etc/PROBLEMS b/etc/PROBLEMS index ff88aa3..593eb6b 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS @@ -2479,16 +2479,6 @@ please call support for your X-server and see if y= ou can get a fix. If you do, please send it to bug-gnu-emacs@gnu.org so we can list it her= e. =20 =20 -* Runtime problems specific to Mac OS X - -** On Mac OS X, file-name-case-insensitive-p may be unreliable - -The implementation of that function on Mac OS X uses pathconf with the -_PC_CASE_SENSITIVE flag. There have been reports that this use of -pathconf does not work reliably. If you have a problem, please -recompile Emacs with -D DARWIN_OS_CASE_SENSITIVE_FIXME, and file a bug -report saying whether this fixed your problem. - * Build-time problems =20 ** Configuration diff --git a/src/fileio.c b/src/fileio.c index 17659b6..c21056e 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2271,27 +2271,6 @@ file_name_case_insensitive_p (const char *filename= ) return res =3D=3D 0; #endif =20 - /* There have been reports that pathconf with _PC_CASE_SENSITIVE - does not work reliably on Mac OS X. If you have a problem, - please recompile Emacs with -D DARWIN_OS_CASE_SENSITIVE_FIXME=3D1 o= r - -D DARWIN_OS_CASE_SENSITIVE_FIXME=3D2, and file a bug report saying= - whether this fixed your problem. */ - -#ifdef DARWIN_OS_CASE_SENSITIVE_FIXME -# ifdef VOL_CAP_FMT_CASE_SENSITIVE - { - struct attrlist alist =3D {.bitmapcount =3D ATTR_BIT_MAP_COUNT, - .volattr =3D ATTR_VOL_INFO | ATTR_VOL_CAPABILITIES}; - struct { uint32_t len; vol_capabilities_attr_t caps; } vcaps - __attribute__ ((aligned (4), packed)); - int i =3D VOL_CAPABILITIES_FORMAT; - if (getattrlist (filename, &alist, &vcaps, sizeof vcaps, 0) =3D=3D 0= - && (vcaps.caps.valid[i] & VOL_CAP_FMT_CASE_SENSITIVE)) - return ! (vcaps.caps.capabilities[i] & VOL_CAP_FMT_CASE_SENSITIVE)= ; - } -# endif -#endif - #if defined CYGWIN || defined DOS_NT return true; #else --=20 2.7.4 --------------4B35A970C6AA12DFC57CCE9B--