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 #52 received at 33255 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 33255 <at> debbugs.gnu.org, immerrr again <immerrr <at> gmail.com>,
 Noam Postavsky <npostavs <at> gmail.com>
Subject: Re: 27.0.50; expand-file-name: default directory expanded twice if
 relative
Date: Tue, 27 Nov 2018 10:11:34 -0800
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.





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.