bugGNU Octave - Bugs: bug #37087, empty struct not empty after being...

 
 

bug #37087: empty struct not empty after being saved in MATLAB binary data format.

Submitter:  Guillaume <gyom>
Submitted:  Mon 13 Aug 2012 07:14:00 PM UTC
   
 
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
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
   

Jump to the original submission

Tue 16 Oct 2012 07:39:32 PM UTC, comment #8: 

Fixed in this changeset (http://hg.savannah.gnu.org/hgweb/octave/rev/39fd2ad26fb7).  You will need to pull from the latest Mercurial sources and build from scratch in order to see the fix.

Rik <rik5>
Group administrator
Tue 16 Oct 2012 12:51:16 AM UTC, comment #7: 

I tested the patch and it works fine.  How would you like to be credited in the Mercurial ChangeLog?  Ordinarily we do "Firstname Lastname <email@address>".  If you have privacy concerns we can also work out something else.

Rik <rik5>
Group administrator
Thu 20 Sep 2012 04:44:07 PM UTC, comment #6: 

I've been using this patch for some time now:

diff -r 6823ad7a25b1 libinterp/interp-core/ls-mat5.cc
--- a/libinterp/interp-core/ls-mat5.cc  Thu Sep 20 12:20:39 2012 -0400
+++ b/libinterp/interp-core/ls-mat5.cc  Thu Sep 20 17:39:51 2012 +0100
@@ -1144,7 +1144,7 @@
       // Fall-through
     case MAT_FILE_STRUCT_CLASS:
       {
-        Octave_map m (dim_vector (1, 1));
+        Octave_map m (dims);
         int32_t fn_type;
         int32_t fn_len;
         int32_t field_name_length;


It fixed the bug I was reporting and I didn't see any side effect since then.
Could someone review the change and push it if OK? Many thanks.

Guillaume <gyom>
Fri 17 Aug 2012 04:45:18 PM UTC, comment #5: 

It seems to work if I change l.1147 of src/interp-core/ls-mat5.cc so that instead of:
  Octave_map m (dim_vector (1, 1));
it reads:
  Octave_map m (dims);
but then I don't understand how it could work before when one of the dimension of the struct array was greater than 1.

Guillaume <gyom>
Wed 15 Aug 2012 06:27:08 PM UTC, comment #4: 

I did actually look at this file earlier but couldn't figure out where the problem was taking place.

Just got GDB running following this:
http://wiki.octave.org/Debugging_Octave
but nothing meaningful yet...

Guillaume <gyom>
Wed 15 Aug 2012 04:04:45 PM UTC, comment #3: 
Jordi GutiƩrrez Hermoso <jordigh>
Group Member
Wed 15 Aug 2012 03:58:10 PM UTC, comment #2: 

Wanna have a stab at debugging the problem yourself? Run Octave in a debugger and set a breakpoint here:

http://hg.savannah.gnu.org/hgweb/octave/file/3b8275fed4dd/src/interp-core/ls-mat5.cc#l118

Jordi GutiƩrrez Hermoso <jordigh>
Group Member
Wed 15 Aug 2012 01:57:12 PM UTC, comment #1: 

To be more precise, the problem is with load() and not save(), i.e. file A.mat is fine but is read erroneously (found out by cross-checking with MATLAB).

Guillaume <gyom>
Mon 13 Aug 2012 07:14:00 PM UTC, original submission:  

The size of an empty struct (struct([])) changes when saved in MATLAB binary data format:

octave> A=struct([])
A =
  0x0 struct array containing the fields:

octave> isempty(A)
ans = 1
octave> size(A)
ans =
   0   0
octave> save A.mat A -mat
octave> load A.mat
octave> A
A =
  scalar structure containing the fields:

octave> isempty(A)
ans = 0
octave> size(A)
ans =
   1   1


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 rik5 (Posted a comment)
  • -email is unavailable- added by jordigh (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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-10-16 rik5 StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2012-10-16 rik5 CategoryNone Libraries
        StatusNone In Progress

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code