bugGNU Octave - Bugs: bug #47434, fwrite of integer types on Solaris...

 
 

bug #47434: fwrite of integer types on Solaris writes little-endian (should be big-endian)

Submitted by:  Mike Miller <mtmiller>
Submitted on:  Thu 17 Mar 2016 01:11:15 AM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: Mike Miller <mtmiller>
Originator Name: Open/Closed: Closed
Release: devOperating System: Solaris/SunOS

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 25 May 2016 10:13:34 PM UTC, comment #5:

Interesting timing, but otherwise unrelated I think.

In my testing there were no bugs on typical little-endian systems, either reading or writing, big or little endian data. The only bug was on big-endian systems, where only little-endian files could be written (but either could be read correctly).

Mike Miller <mtmiller>
Project AdministratorIn charge of this item.
Wed 25 May 2016 10:07:01 PM UTC, comment #4:

Possibly related on the read side, see bug #48018.

I've asked for details, but this may be a case where we are not reading big endian values correctly on a little endian system.

Rik <rik5>
Project Administrator
Wed 25 May 2016 07:33:45 PM UTC, comment #3:

The patch fixes the bug on the SPARC system I have access to, no additional errors seen on that, or on my standard x86_64 build. Pushed to stable and merged to default

http://hg.savannah.gnu.org/hgweb/octave/rev/1e81dd035639

Manual fixup was needed for merging to default because of the change from oct_mach_info to octave::mach_info.

Mike Miller <mtmiller>
Project AdministratorIn charge of this item.
Wed 25 May 2016 02:45:18 AM UTC, comment #2:

I think I have found the logic error here, attaching a diff I am currently testing. It takes a long time to rebuild on the Solaris test setup I have access to, but once I confirm that fwrite works as expected I'll push this to the stable branch.

(file #37253)

Mike Miller <mtmiller>
Project AdministratorIn charge of this item.
Thu 17 Mar 2016 01:12:33 AM UTC, comment #1:

And I didn't say explicitly, but this only applies to integer types. Floating point formats do write in the correct order, either native, big-endian, or little-endian as specified.

Mike Miller <mtmiller>
Project AdministratorIn charge of this item.
Thu 17 Mar 2016 01:11:15 AM UTC, original submission:

Writing multi-byte integers using fwrite writes them in little-endian format regardless of what ARCH parameter is given to fopen or fwrite. The default should be big-endian, and that is what Octave thinks it is internally, but the bytes are written in little-endian order.

Example:

The results are the same if either fopen or fwrite are given any of the possible ARCH values.

I've started looking into this but getting lost in the octave_stream::write templates and data conversion options.

Mike Miller <mtmiller>
Project AdministratorIn charge of this item.

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #37253:  big-endian.diff added by mtmiller (1KiB - text/x-diff)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by mtmiller (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 25 May 2016 07:33:45 PM UTCmtmillerStatusIn Progress=>Fixed
      Open/ClosedOpen=>Closed
    Wed 25 May 2016 02:45:18 AM UTCmtmillerAttached File-=>Added big-endian.diff, #37253
      Assigned toNone=>mtmiller

    Back to the top


    Powered by Savane 3.1-cleanup1