unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Glenn Morris <rgm@gnu.org>
Cc: 33255@debbugs.gnu.org, immerrr again <immerrr@gmail.com>,
	Noam Postavsky <npostavs@gmail.com>
Subject: bug#33255: 27.0.50; expand-file-name: default directory expanded twice if relative
Date: Tue, 27 Nov 2018 10:11:34 -0800	[thread overview]
Message-ID: <7f6d9f6d-5aad-ddac-fef3-d6dce259e57c@cs.ucla.edu> (raw)
In-Reply-To: <o1mupv5b5z.fsf@fencepost.gnu.org>

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	other threads:[~2018-11-27 18:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-04 10:54 bug#33255: 27.0.50; expand-file-name: default directory expanded twice if relative immerrr again
2018-11-04 12:27 ` Noam Postavsky
2018-11-05  0:58   ` Glenn Morris
2018-11-13 18:26 ` Paul Eggert
2018-11-13 20:12   ` Eli Zaretskii
2018-11-14 18:10   ` Glenn Morris
2018-11-14 18:17     ` Paul Eggert
2018-11-14 19:52       ` Eli Zaretskii
2018-11-20 19:11         ` Glenn Morris
2018-11-20 19:26           ` Eli Zaretskii
2018-11-20 19:08       ` Glenn Morris
2018-11-20 20:44         ` Paul Eggert
2018-11-22 18:25           ` Glenn Morris
2018-11-23 20:22             ` Paul Eggert
2018-11-27  5:42               ` Glenn Morris
2018-11-27 18:11                 ` Paul Eggert [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7f6d9f6d-5aad-ddac-fef3-d6dce259e57c@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=33255@debbugs.gnu.org \
    --cc=immerrr@gmail.com \
    --cc=npostavs@gmail.com \
    --cc=rgm@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).