[illumos-Developer] Ugh... xdr_{float,double} problems

Jason King jason.brian.king at gmail.com
Fri Jan 28 10:10:44 PST 2011


Ok, however things will still be broken, my fix just breaks (or more
precisely, breaks everyone's workarounds) faster.  I can probably have
a true fix later tonight as well.

On Fri, Jan 28, 2011 at 10:58 AM, Garrett D'Amore <garrett at nexenta.com> wrote:
> Ok, I'll backout the changes.  Can you please file a bug?  I probably won't
> get around to backing this change out until tonight as I'm traveling and on
> limited battery power.
>
>    - Garrett
>
> On 01/28/11 08:48 AM, Jason King wrote:
>>
>> After lengthy discussions, and even more digging... it looks like
>> there's a bit of a very-long standing mess with the C xdr API.
>>
>> The problem is, the OTW XDR format for 32&  64 bit doubles is
>> identical on x86, amd64, sparc, and sparcv9.  In theory, the code
>> should then just merely copy the values out unchanged.
>> However, that really happened was on little-endian platforms, the byte
>> values for fp values were being (incorrectly) byteswapped by the
>> library.  Instead of fixing the library, it appears the existing
>> software that actually uses fp with xdr workaround the bug on those
>> platforms.  Of course the recent putback broke the workaround.
>>
>> Essentially:
>>
>> 1. code is released with broken xdr_{float,double}
>> 2. code is written w/ workarounds
>> 3. code is updated, and __amd64 define is (incorrectly) changed to
>> amd64.  This causes xdr_{float,double} to revert to a slower, platform
>> independent version that correctly (minus rouding errors) writes the
>> value into the stream (without swapping).
>> 4. My fix correctly writes fp values unchanged to XDR stream, but also
>> breaks any software with workarounds.  The test cases were written to
>> the RFC&  man pages (since I couldn't really find anything out there
>> that uses
>>
>> Given the pervasiveness of this, we probably need to do something similar
>> to:
>>
>> 1. Revert the behavior to the traditional broken behavior
>> 2. Update the man pages to document this behavior
>> 3. Add a #define to the rpc/xdr.h header file (XDR_FLOAT_NO_SWAP ?) to
>> allow applications to select the correct behavior when defined (and
>> document this in the manpage).
>>
>> _______________________________________________
>> Developer mailing list
>> Developer at lists.illumos.org
>> http://lists.illumos.org/m/listinfo/developer
>>
>
>
> _______________________________________________
> Developer mailing list
> Developer at lists.illumos.org
> http://lists.illumos.org/m/listinfo/developer
>



More information about the Developer mailing list