bugGNU Octave - Bugs: bug #43613, fread() with a vector size doesn't...

 
 

bug #43613: fread() with a vector size doesn't return a shortened matrix when it hits EOF

Submitted by:  None
Submitted on:  Fri 14 Nov 2014 03:59:39 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Regression
Status: FixedAssigned to: None
Originator Name: ziserOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 3.8.1
Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Fri 14 Nov 2014 09:45:11 PM UTC, comment #2:

Fixed in http://hg.savannah.gnu.org/hgweb/octave/rev/a791930c3bda on the stable branch because it's a regression and a small patch.

Closing bugreport as fixed.

Andreas Weber <andy1978>
Project Member
Fri 14 Nov 2014 08:52:42 PM UTC, comment #1:

I can confirm this behavior on the stable and default branch.

The problem is in oct-stream.cc around line 3451:
http://hg.savannah.gnu.org/hgweb/octave/file/8ba8f3d22189/libinterp/corefcn/oct-stream.cc#l3451

which should be

to my understanding. If someone can confirm that Matlab behaves the way described below, I'll prepare a patch and test for this issue.

Andreas Weber <andy1978>
Project Member
Fri 14 Nov 2014 03:59:39 PM UTC, original submission:

If I create a file with a few bytes, as in:

and then try to read a "too big" matrix from that file in Octave, as in:

then the result I get should be:

for compatibility with Matlab and previous versions of Octave (in particular, this seems to work fine with Octave 3.6.1). But instead, in 3.8.1, I get the following:

where the matrix has apparently been zero-padded to the size I requested rather than being short to indicate that not all the columns I requested were available in the file.

Note that this problem does not seem to occur when the size I pass Octave is a scalar, i.e. 6 instead of [2, 3]. In that case, Octave returns a short vector rather than zero-padding.

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by andy1978 (Posted a comment)
  • -unavailable- added by None (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 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 14 Nov 2014 09:45:11 PM UTCandy1978StatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Fri 14 Nov 2014 08:52:42 PM UTCandy1978StatusNone=>Confirmed

    Back to the top


    Powered by Savane 3.1-cleanup1