bug-gnu-emacs
[Top][All Lists]
Advanced

[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: Paul Eggert
Subject: bug#33255: 27.0.50; expand-file-name: default directory expanded twice if relative
Date: Tue, 27 Nov 2018 10:11:34 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1

On 11/26/18 9:42 PM, Glenn Morris wrote:
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

Yes, and there's a similar confusion in ordinary POSIX shells:

$ cd /tmp
$ mkdir foo
$ echo hi > foo/bar
$ HOME=foo sh
$ cat ~/bar
hi
$ cd
$ cat ~/bar
cat: foo/bar: No such file or directory

The moral of this story in POSIX is "Don't set HOME to a relative file name, as it's trouble for any application that chdirs." In your example Emacs chdirs; in mine, sh chdirs.

The question is whether Emacs should attempt to insulate users from this trouble, presumably by replacing HOME with an absolute directory name when HOME's value is relative (or is absent or empty, for that matter). The POSIX shell doesn't do that, which is an argument for Emacs not doing it either.






reply via email to

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