Subject: Re: bug#74208: 31.0.50; minibuffer read-file-name-default mutates global value of default-directory incorrectly
From: Michael Albinus <[email-masked]>
To: Madhu <[email-masked]>
Cc: [email-masked]
Date: Mon, 09 Dec 2024 09:17:20 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Version: 31.1

Madhu <[email-masked]> writes:

Hi Madhu,

> I meant the defaulting use in the call to get_current_directory in
> callproc.c

I see. But as said, it isn't a robust setting:

--8<---------------cut here---------------start------------->8---
# env HOME=/foo emacs -Q --batch --eval '(let ((default-directory (expand-file-name "~"))) (shell-command "ls"))'

Error: file-missing ("Setting current directory" "No such file or directory" "/foo")
  call-shell-region(1 1 "ls" nil #<buffer *Shell Command Output*>)
  shell-command-on-region(1 1 "ls" nil nil nil)
  shell-command("ls")
  (let ((default-directory (expand-file-name "~"))) (shell-command "ls"))
  eval((let ((default-directory (expand-file-name "~"))) (shell-command "ls")) t)
  command-line-1(("--eval" "(let ((default-directory (expand-file-name \"~\"))) (shell-command \"ls\"))"))
  command-line()
  normal-top-level()

(Shell command failed with error)
Setting current directory: No such file or directory, /foo
--8<---------------cut here---------------end--------------->8---

> Speaking for myself: no. I'm a bit dissapointed that the setq doesn't
> get fixed, but I think the main problem has been addressed.

Thanks, so I'm closing the bug.

Best regards, Michael.