Subject: bug#33255: 27.0.50; expand-file-name: default directory expanded twice if relative

From: Paul Eggert <[email-masked]>
Date: Tue, 20 Nov 2018 12:44:25 -0800

On 11/20/18 11:08 AM, Glenn Morris wrote:
>> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_01
> I had looked at that page before. Looking again, I still don't see
> anything as clear-cut as "POSIX says that sh treats ~/foo like $HOME/foo
> even when HOME is not absolute".

It needs to be read in context. Section 2.6.1 is about tilde expansion 
in the shell, e.g., how to treat commands like this:

cd ~eggert/xxx
cd ~/yyy

2.6.1 says "If the login name is null (that is, the tilde-prefix 
contains only the tilde), the tilde-prefix is replaced by the value of 
the variable /HOME."/ This is talking about the second "echo" example 
which uses a null login name, and it means that the second example is 
treated like this:

cd "$HOME"/yyy/
/

(The quotes are because of the last sentence in that section of the 
spec.) This occurs regardless of whether $HOME starts with /"/".//
/