GNU bug report logs - #12023
bug of hostid cmd ?

Previous Next

Package: coreutils;

Reported by: "�e�nQQ��" <55079536 <at> qq.com>

Date: Sun, 22 Jul 2012 06:39:02 UTC

Severity: normal

Done: P��draig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


Message #10 received at 12023-done <at> debbugs.gnu.org (full text, mbox):

From: Pdraig Brady <P <at> draigBrady.com>
To:  <55079536 <at> qq.com>
Cc: 12023-done <at> debbugs.gnu.org
Subject: Re: bug#12023: bug of hostid cmd ?
Date: Sun, 22 Jul 2012 13:04:47 +0100
On 07/22/2012 04:44 AM,  wrote:
> HI, guy,
> 
> Can you tell me how the "hostid" command work? or how can I control my "hostid"?
> 
> Why my output from "hostid " switch around "0a799228", "0a799a28", "0a799328" randomly?
> 
> Here are lists of my "hostid" information, if any other information needed, please just mail me directly.
> 
> Hope to get you reply soon, thanks.
> 
> [lin <at> centos ~]$ hostid
> 0a799228
> [lin <at> centos ~]$ hostid
> 0a799a28
> [lin <at> centos ~]$ hostid
> 0a799328
> [lin <at> centos ~]$ rpm -q coreutils
> coreutils-8.4-19.el6.i686
> [lin <at> centos ~]$ rpm -q centos-release
> centos-release-6-3.el6.centos.9.i686
> [lin <at> centos ~]$ which hostid
> /usr/bin/hostid
> [lin <at> centos ~]$ ldd /usr/bin/hostid 
>     linux-gate.so.1 =>  (0x00dc0000)
>     libc.so.6 => /lib/libc.so.6 (0x00902000)
>     /lib/ld-linux.so.2 (0x008dc000)
> [lin <at> centos ~]$

hostid(1) is a thin wrapper around gethostid(3).
From that man page we have:

In  the  glibc implementation, if gethostid() cannot open the file con\
taining the host ID [/etc/hostid], then it obtains the hostname using gethostname(2),
passes  that  hostname  to  gethostbyname_r(3)  in  order to obtain the
host's IPv4 address, and returns a value obtained by bit-twiddling  the
IPv4 address.  (This value may not be unique.)

So I installed the following to reference that man page.

thanks,
Pdraig.

commit f93d5985a2bc468f9f92f3bb8dedb0d3bf0807d8
Author: Pdraig Brady <P <at> draigBrady.com>
Date:   Sun Jul 22 12:59:49 2012 +0100

    doc: mention gethostid(3) in hostid(1)

    * man/hostid.x: Add gethostid(3) to SEE ALSO section.
    Addresses http://bugs.gnu.org/12023

diff --git a/man/hostid.x b/man/hostid.x
index 1bba0a6..767a3e2 100644
--- a/man/hostid.x
+++ b/man/hostid.x
@@ -2,3 +2,5 @@
 hostid \- print the numeric identifier for the current host
 [DESCRIPTION]
 .\" Add any additional description here
+[SEE ALSO]
+gethostid(3)





This bug report was last modified 13 years and 23 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.