Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Fix Version/s: OpenVZ-legacy
-
Component/s: Containers::Userspace
-
Security Level: Public
-
Environment:Operating System: All
Platform: All
-
External issue URL:
-
External issue ID:1087
Description
According to hosts(5), the first word after the IP address in an /etc/hosts entry should be an FQDN.
On the other hand. according to hostname(1), the contents of /etc/hostname on Debian systems should NOT be an FQDN (but just the part before the dot).
However they are both taken from the --hostname parameter of vzctl.
A fix for that would be simple, something like this:
--- a/etc/dists/scripts/debian-set_hostname.sh
+++ b/etc/dists/scripts/debian-set_hostname.sh
@@ -24,7 +24,7 @@ function set_hostname()
local hostname=$2
[ -z "${hostname}" ] && return 0
- echo "${hostname}" > ${cfgfile}
+ echo "${hostname%%.*}" > ${cfgfile}
hostname ${hostname}
}
That strips the domain when creating /etc/hostname.
However this would probably need to be tweaked a little unless the fix for #1035 is reverted. Therefore I'm setting this bug to depend on 1035.
If I'm reading the source correctly, then the only other place that --hostname value is used is vzlist, which should not care much whether it lists a simple hostname or the whole FQDN.
Also, while I'm only speaking for Debian systems, it's possible that other distro's scripts have a similar problem.
On the other hand. according to hostname(1), the contents of /etc/hostname on Debian systems should NOT be an FQDN (but just the part before the dot).
However they are both taken from the --hostname parameter of vzctl.
A fix for that would be simple, something like this:
--- a/etc/dists/scripts/debian-set_hostname.sh
+++ b/etc/dists/scripts/debian-set_hostname.sh
@@ -24,7 +24,7 @@ function set_hostname()
local hostname=$2
[ -z "${hostname}" ] && return 0
- echo "${hostname}" > ${cfgfile}
+ echo "${hostname%%.*}" > ${cfgfile}
hostname ${hostname}
}
That strips the domain when creating /etc/hostname.
However this would probably need to be tweaked a little unless the fix for #1035 is reverted. Therefore I'm setting this bug to depend on 1035.
If I'm reading the source correctly, then the only other place that --hostname value is used is vzlist, which should not care much whether it lists a simple hostname or the whole FQDN.
Also, while I'm only speaking for Debian systems, it's possible that other distro's scripts have a similar problem.