Subject: bug#62004: 30.0.50; comp-run-async-workers failure when default-directory deleted

From: Andrea Corallo <[email-masked]>
Date: Tue, 07 Mar 2023 16:06:56 +0000

No Wayman <[email-masked]> writes:

> No Wayman <[email-masked]> writes:
>
>> Binding default-directory makes sense.
>> It's just a matter of what to bind it to.
>> I see that `comp-run-async-workers` calls `make-temp-file'
>> internally.
>> Binding default-directory to temporary-file-directory around the
>> call to
>> `make-process' will prevent this error and seems like a safe bet.
>
> The attached patch implements this and fixes the error on my end. >From fd33c2d58ac078ed53cdada5fa6e378e59247a3a Mon Sep 17 00:00:00 2001
> From: Nicholas Vollmer <[email-masked]>
> Date: Tue, 7 Mar 2023 10:44:17 -0500
> Subject: [PATCH] comp.el (comp-run-async-workers): bind default-directory
>
> Ensure default-directory exists prior to creating subprocess. (bug#62004)
> ---
>  lisp/emacs-lisp/comp.el | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
> index ce81680a226..97cfa27a1aa 100644
> --- a/lisp/emacs-lisp/comp.el
> +++ b/lisp/emacs-lisp/comp.el
> @@ -4023,6 +4023,7 @@ comp-run-async-workers
>                          (comp-log "\n")
>                          (mapc #'comp-log expr-strings)))
>                     (load1 load)
> +                   (default-directory temporary-file-directory)
>                     (process (make-process
>                               :name (concat "Compiling: " source-file)
>                               :buffer (with-current-buffer

If tested LGTM, another option (maybe safer?) would be to use
`invocation-directory'.

Thanks

  Andrea