Bug 59311 - hostnamectl doesn't allow apostrophes in pretty hostname
Summary: hostnamectl doesn't allow apostrophes in pretty hostname
Status: RESOLVED FIXED
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: nchen
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-13 08:33 UTC by Philip Puryear
Modified: 2013-03-05 20:20 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Philip Puryear 2013-01-13 08:33:33 UTC
Overview:
hostnamectl set-hostname rejects pretty hostnames which contain apostrophes, despite the example in hostnamectl's manpage ("Lennart's Laptop") containing an apostrophe.

Steps to Reproduce:
# hostnamectl set-hostname --pretty "Phil's Laptop"

Actual Results:
The error "Failed to issue method call: Invalid argument" is printed.

Expected Results:
No error; /etc/machine-info should contain the supplied pretty name.

Build Date & Platform:
systemd-196, Arch Linux

Additional Information:
I believe this occurs because systemd-hostnamed calls string_is_safe() on the new pretty hostname (hostnamed.c:554), which rejects apostrophes (along with backslashes and double quotes) (util.c:5562).
Comment 1 nchen 2013-03-01 22:13:02 UTC
Just wanted to confirm this bug on Arch, systemd 197

$ hostnamectl set-hostname --pretty "Nathaniel's Desktop"
Failed to issue method call: Invalid argument

$ hostnamectl set-hostname --pretty "Nathaniels Desktop"
$ hostnamectl status
..
Pretty hostname: Nathaniels Desktop

Works without the apostrophe.
Comment 2 nchen 2013-03-05 20:17:31 UTC
fixed with commit "ebe5d6d..."


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.