Subject: Re: bug#48579: 28.0.50; Spawning an emacs process using call-process results in inconsistent behavior between GNU/Linux and macOS

From: Alan Third <[email-masked]>
Date: Sat, 22 May 2021 11:26:16 +0100

On Sat, May 22, 2021 at 11:00:43AM +0530, Raj Krishnan wrote:
> Steps for reproduction:
> 1. Run =emacs -Q= in some directory outside the user's home directory
> 2. Check the value of the variable =default-directory=, and verify that
>    it matches the directory you started emacs in
> 3. Create an emacs child process using:
> 
> #+begin_src emacs_lisp
>   (call-process
>     (file-truename (expand-file-name invocation-name invocation-directory))
>     nil nil nil "-Q")
> #+end_src
> 
> 4. In the newly created frame, check the value of the default directory
> 
> 5. Behavior on GNU/Linux: The directory matches the value shown in (2)
>    Behavior on macOS: The default directory has changed to the user's
>    home directory
> 
> The behavior was spotted when we noticed inconsistent behavior in
> [[https://github.com/minad/affe][affe.el]], which was subsequently
> reproduced using =emacs -Q=

The NS port checks if it's connected to a TTY when it starts, and if
not assumes it's being run from finder and so sets the starting
directory to something useful ($HOME), instead of / or whatever it
defaults to.

-- 
Alan Third