-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
Submission type
- Bug report
systemd version the issue has been seen with
Version 233
Used distribution
Fedora 26, x86_64
$ dnf info systemd.x86_64
Installed Packages
Name : systemd
Version : 233
Release : 6.fc26
Arch : x86_64
Size : 9.1 M
Source : systemd-233-6.fc26.src.rpm
Repo : @System
From repo : anaconda
Summary : System and Service Manager
URL : http://www.freedesktop.org/wiki/Software/systemd
License : LGPLv2+ and MIT and GPLv2+
Description : systemd is a system and service manager that runs as PID 1 and
: starts the rest of the system...
Expected behaviour you didn't see
When using a fully qualified domain name (FQDN), the FQDN is discarded by systemd. A FQDN name ends in a dot (.
), and it indicates the top of the DNS tree. A great discussion of FQDN's is available in W. Richard Steven's TCP/IP Illustrated Volume I.
For a lone hostname, hostnamectl set-hostname --static --transient --pretty asus-f26-x64.
results in the following. Notice the FQDN is added as adornment to the pretty name, and discarded completely from the static name:
$ hostnamectl status
Static hostname: asus-f26-x64
Pretty hostname: asus-f26-x64.
Icon name: computer-desktop
Chassis: desktop
Deployment: production
...
And the same test for a network name using my internal network of home.pvt
. hostnamectl set-hostname --static --transient --pretty asus-f26-x64.home.pvt.
. Notice the FQDN is completely discarded from all names:
$ hostnamectl status
Static hostname: asus-f26-x64.home.pvt
Icon name: computer-desktop
Chassis: desktop
Deployment: production
...
In case of bug report: Steps to reproduce the problem
See command above for both a hostname and a network name.
Thanks to Rabban for looking into the issue, it appears to be due to the following in hostnamectl.c
:
if (!hostname_is_valid(name, false))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid static hostname '%s'", name);
...
Where hostname_is_valid
signature is:
bool hostname_is_valid(const char *s, bool allow_trailing_dot)