Bug 1308470 - hostname man page is not clear on FQDN and needs review
hostname man page is not clear on FQDN and needs review
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: net-tools (Show other bugs)
6.7
Unspecified Unspecified
low Severity low
: rc
: ---
Assigned To: Jiri Popelka
qe-baseos-daemons
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-02-15 05:00 EST by Stephen Wadeley
Modified: 2016-02-15 07:19 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-02-15 07:19:47 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Stephen Wadeley 2016-02-15 05:00:21 EST
Description of problem:

man hostname for RHEL6.7 says:

Technically: The FQDN is the name gethostbyname(2) returns for the host
       name returned by gethostname(2).  The DNS domain name is the part after
       the first dot.

This does not make sense so I checked in Fedora 22 and it says:

       Technically: The FQDN is the name getaddrinfo(3) returns for the host name returned by gethostname(2).  The DNS domain name is the part after the first dot.

Can you please check and update man page.

Version-Release number of selected component (if applicable):

[root@RHEL6-7-WS ~]# hostname -V
net-tools 1.60
hostname 1.100 (2001-04-14)


A review of other differences in the RHEL6.7 vs. Fedora hostname man page would be a welcome bonus.

Thank you
Comment 1 Stephen Wadeley 2016-02-15 05:02:38 EST
In RHEL6.7 hostname man page:

The difference in gethostname(2) and gethostbyname(3) is that  gethost-
       byname(3)  is  network  aware,  so  it  consults /etc/nsswitch.conf and
       /etc/host.conf   to   decide   whether   to   read    information    in
       /etc/sysconfig/network or /etc/hosts

Is /etc/hostname missing from that list? or does gethostbyname(3 not read /etc/hostname ?

Thank you
Comment 3 Jiri Popelka 2016-02-15 06:06:43 EST
(In reply to Stephen Wadeley from comment #0)
> man hostname for RHEL6.7 says:
> 
> Technically: The FQDN is the name gethostbyname(2) returns for the host name > returned by gethostname(2). The DNS domain name is the part after the first dot.

Just to be sure: have you noticed that gethostbyname(2) and gethostname(2) are different functions ?

It basically first calls gethostname() and then calls gethostbyname() on the result of the first one.
gethostname() = get hostname
gethostbyname() = get more info about a hostname

> This does not make sense so I checked in Fedora 22 and it says:
> 
>        Technically: The FQDN is the name getaddrinfo(3) returns for the host
> name returned by gethostname(2).  The DNS domain name is the part after the
> first dot.

Here getaddrinfo() is just a successor of gethostbyname().
Comment 4 Stephen Wadeley 2016-02-15 07:13:33 EST
(In reply to Jiri Popelka from comment #3)
> (In reply to Stephen Wadeley from comment #0)
> > man hostname for RHEL6.7 says:
> > 
> > Technically: The FQDN is the name gethostbyname(2) returns for the host name > returned by gethostname(2). The DNS domain name is the part after the first dot.
> 
> Just to be sure: have you noticed that gethostbyname(2) and gethostname(2)
> are different functions ?
Oh, no, sorry!

I was reading too many man pages at once I think (in RHEL6 VM and Fedora host). 

> 
> It basically first calls gethostname() and then calls gethostbyname() on the
> result of the first one.
> gethostname() = get hostname
> gethostbyname() = get more info about a hostname
> 
> > This does not make sense so I checked in Fedora 22 and it says:
> > 
> >        Technically: The FQDN is the name getaddrinfo(3) returns for the host
> > name returned by gethostname(2).  The DNS domain name is the part after the
> > first dot.
> 
> Here getaddrinfo() is just a successor of gethostbyname().

Thank you
Comment 5 Stephen Wadeley 2016-02-15 07:17:47 EST
(In reply to Stephen Wadeley from comment #1)
> In RHEL6.7 hostname man page:
> 
> The difference in gethostname(2) and gethostbyname(3) is that  gethost-
>        byname(3)  is  network  aware,  so  it  consults /etc/nsswitch.conf
> and
>        /etc/host.conf   to   decide   whether   to   read    information   
> in
>        /etc/sysconfig/network or /etc/hosts
> 
> Is /etc/hostname missing from that list? or does gethostbyname(3 not read
> /etc/hostname ?
> 
after checking I see there is no /etc/hostname file in RHEL6.7 by default.


So, we can close this as NOTABUG I think.

Note You need to log in before you can comment on or make changes to this bug.