Subject: bug#42836: 27.1; default-directory is set to "/" after startup

From: Alan Third <[email-masked]>
Date: Thu, 13 Aug 2020 16:52:41 +0200 (CEST)

On Thu, Aug 13, 2020 at 12:52:51AM +0200, Alan Third wrote:
> On Wed, Aug 12, 2020 at 05:17:28PM -0400, Sean Devlin wrote:
> > > When I open Emacs 27.1 by invoking the executable directly (i.e. the
> > > last method above), the default-directory in those buffers is "~/“.
> > 
> > Correction: the default directory is the working directory of the
> > parent process (i.e. the shell) in this case.
> 
> The code at line 1623 of emacs.c appears to be supposed to set the
> correct starting directory, however it doesn't matter what it does
> there. I've tried hard coding directories and all sorts, but it ALWAYS
> ends up starting in "/"... I think something somewhere else must be
> resetting it. I can't find where just now. I may have to do a git bisect,
> which I don't much fancy.

The commit in question is:

    900276502fbb4dcabdabc5d7d24b4bc5645f2cf3
    Act like POSIX sh if $HOME is relative

I suspect the best solution here is to move the code at line
emacs.c:1623 to before emacs_wd is set. What do you think, Paul?
-- 
Alan Third