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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 12023 in the body.
You can then email your comments to 12023 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#12023; Package coreutils. (Sun, 22 Jul 2012 06:39:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "enQQ" <55079536 <at> qq.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Sun, 22 Jul 2012 06:39:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "enQQ" <55079536 <at> qq.com>
To: "bug-coreutils" <bug-coreutils <at> gnu.org>
Subject: bug of hostid cmd ?
Date: Sun, 22 Jul 2012 11:44:48 +0800
[Message part 1 (text/plain, inline)]
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 ~]$
[Message part 2 (text/html, inline)]

Reply sent to Pdraig Brady <P <at> draigBrady.com>:
You have taken responsibility. (Sun, 22 Jul 2012 12:12:02 GMT) Full text and rfc822 format available.

Notification sent to "�e�nQQ��" <55079536 <at> qq.com>:
bug acknowledged by developer. (Sun, 22 Jul 2012 12:12:02 GMT) Full text and rfc822 format available.

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)





Information forwarded to bug-coreutils <at> gnu.org:
bug#12023; Package coreutils. (Mon, 23 Jul 2012 14:07:02 GMT) Full text and rfc822 format available.

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

From: "enQQ" <55079536 <at> qq.com>
To: "12023" <12023 <at> debbugs.gnu.org>
Subject: REbug#12023: closed (Re: bug#12023: bug of hostid cmd ?)
Date: Mon, 23 Jul 2012 22:00:10 +0800
[Message part 1 (text/plain, inline)]
HI, guy,

Thanks for your reply, I add the file /etc/hostid, and get a fixed hostid value.

But, can you please tell me why my hostid will change when there is not /etc/hostid.

Thx.



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 ~]$


------------------ ԭʼʼ ------------------
: "GNU bug Tracking System"<help-debbugs <at> gnu.org>;
ʱ: 2012722() 8:12
ռ: " e nQQ  "<55079536 <at> qq.com>; 

: bug#12023: closed (Re: bug#12023: bug of hostid cmd ?)



Your bug report

#12023: bug of hostid cmd ?

which was filed against the coreutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 12023 <at> debbugs.gnu.org.

-- 
12023: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12023
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (text/html, inline)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#12023; Package coreutils. (Mon, 23 Jul 2012 14:23:01 GMT) Full text and rfc822 format available.

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

From: Pdraig Brady <P <at> draigBrady.com>
To:  <55079536 <at> qq.com>
Cc: 12023 <12023 <at> debbugs.gnu.org>
Subject: Re: bug#12023:  closed (Re: bug#12023: bug of hostid cmd ?)
Date: Mon, 23 Jul 2012 15:16:00 +0100
On 07/23/2012 03:00 PM,  wrote:
> HI, guy,
> 
> Thanks for your reply, I add the file /etc/hostid, and get a fixed hostid value.
> 
> But, can you please tell me why my hostid will change when there is not /etc/hostid.
> 
> Thx.
> 
> 
> 
> 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 ~]$
> 
> 
> ------------------ ԭʼʼ ------------------
> : "GNU bug Tracking System"<help-debbugs <at> gnu.org>;
> ʱ: 2012722() 8:12
> ռ: " e nQQ  "<55079536 <at> qq.com>; 
> 
> : bug#12023: closed (Re: bug#12023: bug of hostid cmd ?)
> 
> 
> 
> Your bug report
> 
> #12023: bug of hostid cmd ?
> 
> which was filed against the coreutils package, has been closed.
> 
> The explanation is attached below, along with your original report.
> If you require more details, please reply to 12023 <at> debbugs.gnu.org.

glibc is operating like this shell script.
You can run it to check your system:

echo "
from socket import gethostname as hostname
from socket import gethostbyname as ip
for i in range(10):
    print ''.join('%02x' % int(x) for x in ip(hostname()).split('.'))
" | python | uniq -c

cheers,
Pdraig.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 21 Aug 2012 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 263 days ago.

Previous Next


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