[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#36502: Fwd: bug#36502: 27.0.50; infinite loop in file-name-case-inse

From: Noam Postavsky
Subject: bug#36502: Fwd: bug#36502: 27.0.50; infinite loop in file-name-case-insensitive-p
Date: Sat, 06 Jul 2019 09:27:22 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux)

Daniel Sutton <address@hidden> writes:

> So the "bug" can be reproduced by the following, which was the important
> bits of the test:
> (let ((default-directory "made/up/project/location"))
>   (file-name-case-insensitive-p default-directory))
> * note this will freeze your emacs
> I believe your change caused the behavior here but it seems like a
> reasonable change and CIDER is definitely not honoring the assumptions in
> `default-directory`.

>> From: Ken Brown <address@hidden>
>> On 7/4/2019 11:05 PM, Daniel Sutton wrote:
>> > Sorry for the noise and thanks for your help
>> No problem.  I'm glad you solved it.
>> Closing.

Wouldn't it be better not to infloop in this case though?  E.g.,

--- i/src/fileio.c
+++ w/src/fileio.c
@@ -2408,7 +2408,10 @@ DEFUN ("file-name-case-insensitive-p", 
   /* 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)))
+  if (NILP (Ffile_exists_p (filename))
+      /* If default-directory is relative, expand-file-name can give
+         a relative name, in which case we can't move up.  */
+      && !NILP (Ffile_name_absolute_p (filename)))
       filename = Ffile_name_directory (filename);
       while (NILP (Ffile_exists_p (filename)))

Or maybe signal an error, either way seems better than just getting stuck.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]