Bug 246574

Summary: Modify man page to include warning about sign extension on 64 bit hosts.
Product: Red Hat Enterprise Linux 4 Reporter: Wade Mealing <wmealing>
Component: man-pagesAssignee: Ivana Varekova <varekova>
Status: CLOSED ERRATA QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: 4.5CC: tao
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2008-0111 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-02-13 21:20:04 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 253671, 402181    

Description Wade Mealing 2007-07-03 06:46:39 UTC
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 06:47:28 UTC
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 Program Management 2007-07-03 06:54:14 UTC
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-17 03:05:53 UTC
Sure.

Comment 5 Daniel Riek 2007-10-03 19:58:03 UTC
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-27 02:35:11 UTC
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 12:36:33 UTC
The needinfo was set by Daniel when he attach comment #5. 

Comment 13 errata-xmlrpc 2008-02-13 21:20:04 UTC
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