GNU bug report logs - #33255
27.0.50; expand-file-name: default directory expanded twice if relative

Previous Next

Package: emacs;

Reported by: immerrr again <immerrr <at> gmail.com>

Date: Sun, 4 Nov 2018 10:56:02 UTC

Severity: minor

Fixed in version 27.0.50

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 33255 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: immerrr again <immerrr <at> gmail.com>
Cc: 33255 <at> debbugs.gnu.org
Subject: Re: bug#33255: 27.0.50;
 expand-file-name: default directory expanded twice if relative
Date: Sun, 04 Nov 2018 07:27:29 -0500
immerrr again <immerrr <at> gmail.com> writes:

> I have recently tried to play with a clean .emacs.d directory by setting
> HOME=clean/home/dir, but faced an error coming from deep inside
> package-install. The error boils down to the fact that
> `expand-file-name' for some reason doubles the `default-directory'
> prefix when it is relative:
[...]
> I couldn't find any requirement for DEFAULT-DIRECTORY parameter or
> `default-directory' variable to be absolute, so I would assume this is a
> bug in expand-file-name.

(elisp) File Name Expansion says:

 -- Variable: default-directory
     The value of this buffer-local variable is the default directory
     for the current buffer.  It should be an absolute directory name;
     it may start with `~'.[...]

And expand-file-name is supposed to expand file names relative to
default-directory, so if default-directory is itself relative I don't
see how it could possibly work.  So we should just mention the
absoluteness requirement in the docstring as well.

I think it would make sense for Emacs to expand HOME against the current
directory when it starts up, if HOME is relative.  That would let your
motivating example succeed without error.





This bug report was last modified 6 years and 261 days ago.

Previous Next


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