bugGNU Octave - Bugs: bug #59591, Error when saving a MAT file with...

 
 

bug #59591: Error when saving a MAT file with -v6

Submitter:  Guillaume <gyom>
Submitted:  Tue 01 Dec 2020 10:59:47 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  Guillaume Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 03 Dec 2020 08:05:30 AM UTC, comment #5: 

Thanks for testing and providing the initial example.

Closing as fixed.

Markus Mützel <mmuetzel>
Group administrator
Wed 02 Dec 2020 11:06:07 PM UTC, comment #4: 

Many thanks Markus, I can confirm it now works fine.

Guillaume <gyom>
Wed 02 Dec 2020 07:11:12 PM UTC, comment #3: 

I pushed a patch to default here:
https://hg.savannah.gnu.org/hgweb/octave/rev/cdc2f3799c85

Marking as ready for test.

Markus Mützel <mmuetzel>
Group administrator
Wed 02 Dec 2020 05:21:35 PM UTC, comment #2: 

Thanks Markus. I confirm your shorter examples also reproduce the issue - as you might guess, I first observed the issue with much bigger MAT-files and was already quite happy to have reduced it to a few lines. You are quite right too that the issue is likely to be with string lengths in structs.

Guillaume <gyom>
Wed 02 Dec 2020 02:49:36 PM UTC, comment #1: 

Confirmed.

An example that is probably easier to reproduce (because it doesn't involve classes) is the following:

c.a = 'xx';
c.d = '';
save test_struct_oct7.mat c -v6
load test_struct_oct7.mat


The error message is the same as in the original report.

This also errors:

c.a = 'xx';
c.d = 1;
save test_struct2_oct7.mat c -v6
load test_struct2_oct7.mat


This does not:

c.a = 1;
c.d = 1;
save test_struct3_oct7.mat c -v6
load test_struct3_oct7.mat


It looks like there is an error if strings are saved in fields.

Might be related to this change:
https://hg.savannah.gnu.org/hgweb/octave/rev/d13ad9dc9348

I'll try to have a look at this soon.

Markus Mützel <mmuetzel>
Group administrator
Tue 01 Dec 2020 10:59:47 PM UTC, original submission:  

If I'm not mistaken, the following code creates a corrupted MAT-file with current dev. It works fine with 5.2 or 6.1.

@myclass/myclass.m


function a = myclass ()
a = struct ('a', 'xx');
a = class (a, 'myclass');


@myclass/loadobj.m


function a = loadobj (a)



a.a = myclass ();
a.b = '';
save test.mat a -v6
load test.mat
load: invalid element type = 48


Guillaume <gyom>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by gyom (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-12-03 mmuetzel StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2020-12-02 mmuetzel StatusConfirmed Ready For Test
    2020-12-02 mmuetzel StatusNone Confirmed
        Operating SystemGNU/Linux Any

    Back to the top

    Powered by Savane 3.13-bb6a.
    Corresponding source code