-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
As noted in docker, the hostname written to /etc/hostname does not include a new-line at the end.
As per debian's hostname (5) man page:
The file should contain a single newline-terminated hostname string. Comments (lines starting with a "#") are ignored. The hostname should be composed of up to 64 7-bit ASCII lower-case alphanumeric characters or hyphens forming a valid DNS domain name. It is recommended that this name contains only a single label, i.e. without any dots. Invalid characters will be filtered out in an attempt to make the name valid, but obviously it is recommended to use a valid name and not rely on this filtering.
The code in question: is here
podman/libpod/container_internal_linux.go
Line 667 in f7a3046
| hostnamePath, err := c.writeStringToRundir("hostname", c.Hostname()) |
This should be amended to read
hostnamePath, err := c.writeStringToRundir("hostname", fmt.Sprintf("%s\n", c.Hostname()))