Red Hat Bugzilla – Bug 246574
Modify man page to include warning about sign extension on 64 bit hosts.
Last modified: 2010-10-22 12:03:12 EDT
Description of problem:
The man page for gethostid says that " gethostid() returns the 32-bit identifier
for the current host as set by sethostid(2)."
The gethostid() function returns a long int, and on 64-bit platforms this can
mean that the 32-bit value becomes sign-extended.
As a result, 0x80000000 is converted into 0xffffffff80000000.
When an application wants to print a signed value where only lower 32 bits are
supposed to have the actual id as hexadecimal value, it should mask out all bits
but the lower 32 bits.
The customer believes that the man page should show a warning about this. In my
investigation I found the below example to be sufficient.
id = gethostid ();
/* This is a no-op unless unsigned int is wider than 32 bits. */
id &= 0xffffffff;
The discussion on why this is not fixed in the code is documented at :
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release. Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products. This request is not yet committed for inclusion in an Update
This is a RHEL 4 request! Removing rhel5.2 flag.
Please clone if you want to request this for 5.2
I'm just wondering why is this needinfo, I'm not sure what I can give.
The needinfo was set by Daniel when he attach comment #5.
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.