[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#33255: 27.0.50; expand-file-name: default directory expanded twice i

From: Glenn Morris
Subject: bug#33255: 27.0.50; expand-file-name: default directory expanded twice if relative
Date: Tue, 27 Nov 2018 00:42:16 -0500
User-agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)

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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]