GNU bug report logs - #66534
30.0.50; [PATCH] Expand file-name of ~/.emacs before attempt to load it

Previous Next

Package: emacs;

Reported by: Christoph <just.mychris <at> googlemail.com>

Date: Sat, 14 Oct 2023 01:07:02 UTC

Severity: normal

Tags: patch

Found in version 30.0.50

Full log


View this message in rfc822 format

From: Christoph <just.mychris <at> googlemail.com>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: 66534 <at> debbugs.gnu.org
Subject: bug#66534: 30.0.50; [PATCH] Expand file-name of ~/.emacs before attempt to load it
Date: Sat, 14 Oct 2023 11:05:42 +0200
On Sat, Oct 14, 2023 at 9:25 AM Andreas Schwab <schwab <at> linux-m68k.org> wrote:
>
> On Okt 13 2023, Christoph via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wrote:
>
> > I noticed that during startup, emacs tries to load ~/.emacs (with
> > different extensions) many times over.  You can see this by using
> > strace and tracing the openat syscall.  The problem is, that `load'
> > does not expand the ~/ in the filename passed to it.  So it does not
> > recognize the file as being absolute and tries to resolve it using
> > the load-path.
>
> That's probably a bug in complete_filename_p.
>

I am not so sure if complete_filename_p should be able to recognize
these kinds of paths, or if `load' should expand the filename before
using it.  I am not familiar with all supported platforms, but it might
be tricky to check if a filename is absolute, without expanding it
beforehand.

For instance, what about filenames that start with a series of "../".
I guess they should be considered to be absolute, if the path goes up
to the root.

On the other hand, the documentation of `load' does not mention
absolute paths at all and states, This function searches the
directories on `load-path'.  So I can't say what the expected behaviour
of load is with paths that aren't expanded, but are absolute.

I am hesitant with changing the C code, because I am not very familiar
with it and just started to get into it, so I thought it might be more
appropriate to change it on the Lisp side, since all the other paths
to init files are fully expanded before passing them to load.

But yes, as I wrote before, I think this behaviour of load could be
considered a bug as well.

-- Christoph




This bug report was last modified 1 year and 236 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.