Subject: bug#74208: 31.0.50; minibuffer read-file-name-default mutates global value of default-directory incorrectly

From: Eli Zaretskii <[email-masked]>
Date: Sun, 10 Nov 2024 08:00:35 +0200

> Cc: [email-masked]
> Date: Sun, 10 Nov 2024 06:27:00 +0530 (IST)
> From: Madhu <[email-masked]>
> 
> --- a/lisp/minibuffer.el
> +++ b/lisp/minibuffer.el
> @@ -3668,10 +3668,11 @@ read-file-name-default
>                    ;; changing `default-directory' in the current buffer,
>                    ;; we don't let-bind it.
>                    (let ((dir (file-name-as-directory
> -                              (expand-file-name dir))))
> +                              (expand-file-name dir)))
> +                        (default-directory (if (file-name-absolute-p dir)
> +                                               dir default-directory)))

You probably meant to use let*, right?

But anyway, I don't understand the logic: expand-file-name always
returns an absolute file name, so the test will always succeed.  What
did I miss?