Package: bash
Version: 4.4-4+b1
Severity: normal
Usertags: home

The HOME environment variable does not have to be present, programs
must fall back to the value in the passwd file. bash does not do this
in the following two places. The documentation for both of these says
that the HOME shell variable is used but bash should still change that,
especially because the tilde expansion feature of bash already does.

When running cd without any argument:

> if dir is not supplied, the value of the HOME shell variable is the default.

POSIX leaves cd with $HOME unset as implementation defined:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cd.html

When expanding \w or \W in PS1:

> "with $HOME abbreviated with a tilde"

PS1 \w \W seem to be bash-specific features:

http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_05_03

pabs@chianamo:~$ export PS1='\u@\h \w \W \$ '
pabs@chianamo ~ ~ $ echo $PS1
\u@\h \w \W \$
pabs@chianamo ~ ~ $ unset HOME
pabs@chianamo /home/pabs pabs $ cd
-su: cd: HOME not set
pabs@chianamo /home/pabs pabs $ echo ~
/home/pabs
pabs@chianamo /home/pabs pabs $ getent passwd pabs | cut -d: -f6
/home/pabs

-- System Information:
Debian Release: 9.0
  APT prefers testing-debug
  APT policy: (900, 'testing-debug'), (900, 'testing'), (860, 
'testing-proposed-updates'), (800, 'unstable-debug'), (800, 'unstable'), (790, 
'buildd-unstable'), (700, 'experimental-debug'), (700, 'experimental'), (690, 
'buildd-experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_AU.utf8, LC_CTYPE=en_AU.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages bash depends on:
ii  base-files   9.8
ii  dash         0.5.8-2.4
ii  debianutils  4.8.1
ii  libc6        2.24-9
ii  libtinfo5    6.0+20161126-1

Versions of packages bash recommends:
ii  bash-completion  1:2.1-4.3

Versions of packages bash suggests:
pn  bash-doc  <none>

-- 
bye,
pabs

https://wiki.debian.org/PaulWise

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to