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


View this message in rfc822 format

From: Glenn Morris <rgm <at> gnu.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 33255 <at> debbugs.gnu.org, immerrr again <immerrr <at> gmail.com>, Noam Postavsky <npostavs <at> gmail.com>
Subject: bug#33255: 27.0.50; expand-file-name: default directory expanded twice if relative
Date: Tue, 27 Nov 2018 00:42:16 -0500
Paul Eggert wrote:

> By not saying anything POSIX gives permission to the application to
> set HOME to a relative name. When POSIX intends the requirement that
> an environment variable's value must be absolute (e.g., PWD), it says
> so. When it doesn't intend such a requirement (e.g., HOME, PATH,
> SHELL, TMPDIR) it says nothing.

So the justification for implementing this is indeed "it's not
explicitly forbidden".

Here's an example of how this can be confusing:

cd /tmp
mkdir foo
echo hi > foo/bar
HOME=foo emacs
C-x C-f ~/bar   ; works
M-: (shell-command "ls ~/bar")  ; fails

So, Emacs and external processes it spawns interpret ~ differently;
ie external processes are likely to fail in odd ways. All this would be
avoided if the user had just said HOME=$PWD/foo to start with.

>> I am at this point looking for any documentation (not even from POSIX,
>> any shell or frankly any Unix utility will do) that says "HOME need
>> not be absolute, if not, here's how that is handled".

AFAICS Emacs is the only thing documenting this scenario.




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.