Subject: Re: bug#43735: 28.0.50; eshell: No such directory found via CDPATH environment variable

From: Stefan Kangas <[email-masked]>
Date: Wed, 10 Mar 2021 06:13:57 -0800

Lars Ingebrigtsen <[email-masked]> writes:

> Stefan Kangas <[email-masked]> writes:
>
>> BTW, the error message here should really not be talking about CDPATH in
>> this case, it is just confusing:
>>
>>     Welcome to the Emacs shell
>>
>>     ~/org/notes $ cd ~/wip/non-existent
>>     No such directory found via CDPATH environment variable
>>     ~/org/notes $ cd ~/wip/emacs
>>     ~/wip/emacs $
>>
>> But (getenv "CDPATH") => nil
>
> Yes, I agree completely.

I installed the following on master, but we still have to fix the bug in
this report:

diff --git a/lisp/files.el b/lisp/files.el
index e5fa1d8b22..2868be77f2 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -823,7 +823,9 @@ cd
          (expand-file-name dir))
     (locate-file dir cd-path nil
                  (lambda (f) (and (file-directory-p f) 'dir-ok)))
-    (error "No such directory found via CDPATH environment variable"))))
+    (if (getenv "CDPATH")
+        (error "No such directory found via CDPATH environment
variable: %s" dir)
+      (error "No such directory: %s" dir)))))

 (defun directory-files-recursively (dir regexp
                                         &optional include-directories predicate