Bug 261005 - hostname -d is not resolved domain information correctly
Summary: hostname -d is not resolved domain information correctly
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 13.0-RELEASE
Hardware: arm64 Any
: --- Affects Many People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-01-07 15:10 UTC by 261005
Modified: 2023-05-05 15:03 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description 261005 2022-01-07 15:10:34 UTC
Description

hostname -d is not resolved domain information correctly when used a subdomain in the hostname


Steps to reproduce the issue

root@beastie:~ # grep hostname /etc/rc.conf
hostname="beastie.labs.example.com"

root@beastie:~ # hostname
beastie.labs.example.com

root@beastie:~ # hostname -s
beastie

root@beastie:~ # hostname -d
lple.commple.com

root@beastie:~ # hostname beastie.example.com

root@beastie:~ # hostname -d
example.com

root@beastie:~ # hostname beastie.labs.example.com

root@beastie:~ # hostname -d
lple.commple.com


Results received

root@beastie:~ # hostname -d
lple.commple.com


Results expected

root@beastie:~ # hostname -d
labs.example.com
Comment 1 261005 2022-01-07 15:19:58 UTC
More examples

root@beastie:~ # hostname beastie.my.labs.example.com
root@beastie:~ # hostname -d
my.lple.example.com

root@beastie:~ # hostname beastie.my.test.labs.example.com
root@beastie:~ # hostname -d
my.test.lple.commple.com
Comment 2 Kamille Kunde 2022-03-21 17:59:40 UTC
MARKED AS SPAM
Comment 3 redcu 2022-10-05 02:28:33 UTC
MARKED AS SPAM
Comment 4 Evan Marshall 2023-04-19 02:39:00 UTC
MARKED AS SPAM
Comment 5 Dag-Erling Smørgrav freebsd_committer freebsd_triage 2023-04-20 11:36:09 UTC
I suspect this bug was fixed by commit 33c1e7271ac2¹ which was merged to 13 before 13.1 and to 12 before 12.3.  Are you still able to reproduce it?

¹ https://cgit.freebsd.org/src/commit/?id=33c1e7271ac21a626829289780b88071ae46ec65