unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ken Brown <kbrown@cornell.edu>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: 32246@debbugs.gnu.org
Subject: bug#32246: 27.0.50; files-tests failure on Cygwin
Date: Fri, 27 Jul 2018 14:34:41 -0400	[thread overview]
Message-ID: <9fcfb90b-a018-4f2e-2d94-245469320bdc@cornell.edu> (raw)
In-Reply-To: <87a7qevy1u.fsf@gmx.de>

[-- Attachment #1: Type: text/plain, Size: 357 bytes --]

On 7/26/2018 11:03 AM, Michael Albinus wrote:
> The doc speaks from "the underlying filesystem". So I believe *this*
> must be checked. For non-existing files, the respective directory (up to
> the part which exist) should be checked. In case of
> "/non-existing-dir/non-existing-file", "/" must be checked.

Thanks, that makes sense.  Patch attached.

Ken

[-- Attachment #2: 0001-Fix-file-name-case-insensitive-p-on-non-existent-fil.patch --]
[-- Type: text/plain, Size: 1412 bytes --]

From 8f8c1050509f88f38f6c2b1681c969b1e9922413 Mon Sep 17 00:00:00 2001
From: Ken Brown <kbrown@cornell.edu>
Date: Fri, 27 Jul 2018 14:24:01 -0400
Subject: [PATCH] Fix file-name-case-insensitive-p on non-existent files

* src/fileio.c (Ffile_name_case_insensitive_p): If the file
doesn't exist, move up the filesystem tree until an existing
directory is found.  Then test that directory for
case-insensitivity.  (Bug#32246)
---
 src/fileio.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/fileio.c b/src/fileio.c
index b92492c93a..2dcfb73b0d 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2296,6 +2296,21 @@ The arg must be a string.  */)
   if (!NILP (handler))
     return call2 (handler, Qfile_name_case_insensitive_p, filename);
 
+  /* If the file doesn't exist, move up the filesystem tree until we
+     reach an existing directory or the root.  */
+  if (NILP (Ffile_exists_p (filename)))
+    {
+      filename = Ffile_name_directory (filename);
+      while (NILP (Ffile_exists_p (filename)))
+	{
+	  Lisp_Object newname = expand_and_dir_to_file (filename);
+	  /* Avoid infinite loop if the root is reported as non-existing
+	     (impossible?).  */
+	  if (!NILP (Fstring_equal (newname, filename)))
+	    break;
+	  filename = newname;
+	}
+    }
   filename = ENCODE_FILE (filename);
   return file_name_case_insensitive_p (SSDATA (filename)) ? Qt : Qnil;
 }
-- 
2.17.0


  reply	other threads:[~2018-07-27 18:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-22 18:10 bug#32246: 27.0.50; files-tests failure on Cygwin Ken Brown
2018-07-22 18:23 ` Michael Albinus
2018-07-23 17:01   ` Ken Brown
2018-07-25 12:00     ` Michael Albinus
2018-07-25 13:37       ` Ken Brown
2018-07-25 16:46         ` Michael Albinus
2018-07-25 16:56           ` Ken Brown
2018-07-25 17:33             ` Michael Albinus
2018-07-26 13:56               ` Michael Albinus
2018-07-26 14:54                 ` Ken Brown
2018-07-26 15:03                   ` Michael Albinus
2018-07-27 18:34                     ` Ken Brown [this message]
2018-07-27 19:30                       ` Michael Albinus
2018-07-27 20:30                         ` Ken Brown
2018-07-27 21:10                         ` Eli Zaretskii
2018-07-27 21:32                           ` Ken Brown
2018-07-27 21:34                             ` Ken Brown
2018-07-26 17:38                   ` Eli Zaretskii
2018-07-27 15:27                     ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9fcfb90b-a018-4f2e-2d94-245469320bdc@cornell.edu \
    --to=kbrown@cornell.edu \
    --cc=32246@debbugs.gnu.org \
    --cc=michael.albinus@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).