Bug 246574 - Modify man page to include warning about sign extension on 64 bit hosts.
Modify man page to include warning about sign extension on 64 bit hosts.
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: man-pages (Show other bugs)
4.5
All Linux
low Severity low
: ---
: ---
Assigned To: Ivana Varekova
:
Depends On:
Blocks: 253671 402181
  Show dependency treegraph
 
Reported: 2007-07-03 02:46 EDT by Wade Mealing
Modified: 2010-10-22 12:03 EDT (History)
1 user (show)

See Also:
Fixed In Version: RHBA-2008-0111
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-02-13 16:20:04 EST
Type: ---
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 Wade Mealing 2007-07-03 02:46:39 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;

===========
Comment 1 Wade Mealing 2007-07-03 02:47:28 EDT
The discussion on why this is not fixed in the code is documented at :

http://sources.redhat.com/bugzilla/show_bug.cgi?id=1017
Comment 2 RHEL Product and Program Management 2007-07-03 02:54:14 EDT
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
release.
Comment 4 Wade Mealing 2007-07-16 23:05:53 EDT
Sure.
Comment 5 Daniel Riek 2007-10-03 15:58:03 EDT
This is a RHEL 4 request! Removing rhel5.2 flag.

Please clone if you want to request this for 5.2
Comment 7 Wade Mealing 2007-10-26 22:35:11 EDT
Gday Ivana,

I'm just wondering why is this needinfo, I'm not sure what I can give.
Comment 8 Ivana Varekova 2007-11-02 08:36:33 EDT
The needinfo was set by Daniel when he attach comment #5. 
Comment 13 errata-xmlrpc 2008-02-13 16:20:04 EST
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.

http://rhn.redhat.com/errata/RHBA-2008-0111.html

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