Re: Strange behaviour of hostid ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/12/05, Andrew Mather <mathera@xxxxxxxxx> wrote:
[snip]
> Anyway...I've just run up two more Opteron machines, using FC3 for
> x86_64 and have edited the hosts file as before.
> 
> Now, if I run hostid, I get unique values, however they look very
> different to those on any of my other machines (a mix of Rh 7, 9, FC2
> and FC3 on i386 and x86_64).
> 
> The latest lot have the form:  ffffffff809d3f8e, whereas previous ones
> were like: 809d288e
> 
> Looks like the last part of the number is correct, but what about all
> those leading f's ?
> 
> My question is, are these normal, valid values ?
> 
> If not, any idea what could be causing this ?
> 
> Thanks,
> Andrew

I don't have any idea about the hostid thing, but that value looks
like a sign extension problem.  The previous values like 809d288e are
32-bits wide, which corresponds to a long on a 32-bit platform.  A
long on a 64-bit platform is, however, 64-bits wide.  If interpreted
as a signed 32-bit number, 809d288e, is negative because the most
significant bit is a 1 (hex 8 = 1000 in binary), so this negative
value gets sign extended (meaning the sign bit (the leading 1) is
replicated through all the upper order bits) when it becomes a 64-bit
number.  This creates the leading 32-bits worth (8 hex digits) of
hexadecimal Fs that you see.
Now, I haven't looked at the code for hostid, but the behavior that
you are describing matches my explanation.  If this is what is
happening, it's the result of sloppy programming (using the "long"
variable type instead of "uint32") and is thus a bug.  It could also
be a problem with a format code, using %lx which interprets the number
as a long, 64-bit number (on 64-bit systems).
Does this happen on other x86_64 systems (running a 64-bit OS), or
just these new ones?  If it does not, is the ID not negative (ie, is
the first number 7 or less)?

Jonathan


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux