[Bug 1276796] Re: bash fails to provide FQDN for PS1 with \H
Rodney Beede
1276796 at bugs.launchpad.net
Tue Feb 18 15:29:41 UTC 2014
Rebooted. No change to hostname. No DHCP. Problem still exists.
Should see a prompt of:
[rbeede at okdev1381.example.org:/home/rbeede] $
but instead I only get:
[rbeede at okdev1381:/home/rbeede] $
[rbeede at okdev1383:/home/rbeede] $ echo $PS1
[\u@\H:/home/rbeede] $
[rbeede at okdev1383:/home/rbeede] $ cat /etc/os-release
NAME="Ubuntu"
VERSION="13.10, Saucy Salamander"
The bash man page states:
\h
The hostname, up to the first ‘.’.
\H
The hostname.
This would imply that the difference between \h and \H is
\h is only the hostname
\H is the FQDN
The source code however shows:
case 'h':
case 'H':
temp = savestring (current_host_name);
if (c == 'h' && (t = (char *)strchr (temp, '.')))
*t = '\0';
goto add_string;
This shows that \h is always the short form of the hostname while \H may be the FQDN. In most cases, however, \H just resolves so the short form hostname and not the FQDN (aka domain name).
This is an ambiguity in the bash man page documentation. The bash man page should be updated to say:
\h
The hostname, up to the first ‘.’.
\H
The hostname possibly with the parts after the '.' (domain name or FQDN but usually not)
** Changed in: bash (Ubuntu)
Status: Invalid => Incomplete
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to bash in Ubuntu.
https://bugs.launchpad.net/bugs/1276796
Title:
bash fails to provide FQDN for PS1 with \H
Status in “bash” package in Ubuntu:
Incomplete
Bug description:
When using "\H" in the PS1 prompt value bash is not displaying the
FQDN but instead only the short form hostname. This is the same as
"\h".
Issue has also been noted at
http://serverfault.com/questions/296970/bash-prompt-on-ubuntu-fqdn-h-same-as-hostname-h
https://answers.launchpad.net/ubuntu/+source/bash/+question/200900
This appears related to /etc/hostname only having the host and not the
FQDN.
Bash should obtain the \H value from somewhere other than /etc/hostname.
---
ApportVersion: 2.12.5-0ubuntu2.2
Architecture: amd64
DistroRelease: Ubuntu 13.10
InstallationDate: Installed on 2014-01-16 (20 days ago)
InstallationMedia: Ubuntu-Server 13.10 "Saucy Salamander" - Release amd64 (20131016)
MarkForUpload: True
Package: bash 4.2-5ubuntu3
PackageArchitecture: amd64
ProcEnviron:
TERM=xterm
PATH=(custom, no user)
XDG_RUNTIME_DIR=<set>
LANG=en_US.UTF-8
SHELL=/bin/bash
ProcVersionSignature: Ubuntu 3.11.0-15.23-generic 3.11.10
Tags: saucy
Uname: Linux 3.11.0-15-generic x86_64
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm cdrom dip lpadmin plugdev sambashare sudo
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1276796/+subscriptions
More information about the foundations-bugs
mailing list