bugGNU Octave - Bugs: bug #32242, incomplete initialisation of...

 
 

bug #32242: incomplete initialisation of object arrays - follow up to bug #32222

Submitter:  Volkmar Glauche <glauche>
Submitted:  Tue 25 Jan 2011 11:41:32 AM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 28 Jan 2011 08:26:54 AM UTC, comment #11: 

I was not logged in yesterday night - this issue is fixed in with the patch.

Best,

Volkmar

Volkmar Glauche <glauche>
Thu 27 Jan 2011 10:28:04 PM UTC, comment #10: 

It seems to work for me. Thank you very much for fixing it.

Anonymous
Thu 27 Jan 2011 10:17:05 PM UTC, comment #9: 

Can you please confirm that the patch I checked in fixes the problem described in this bug report?

John W. Eaton <jwe>
Group administrator
Thu 27 Jan 2011 02:48:08 PM UTC, comment #8: 

please disregard comment #7, it does belong to bug #32261.

Volkmar Glauche <glauche>
Thu 27 Jan 2011 01:39:07 PM UTC, comment #7: 

I've uploaded the data to


ftp://uklfr:ftp2ukf@ftp.uniklinik-freiburg.de/glauche/cj.mat


Please forgive the huge amount of data and code involved. I do hope the steps to reproduce the problem are a hint as to what is going wrong.

Volkmar Glauche <glauche>
Thu 27 Jan 2011 11:21:35 AM UTC, comment #6: 

I checked in an additional changeset:

http://hg.savannah.gnu.org/hgweb/octave/rev/88ff30dcc048

With it, I see


octave:1> test_job;
octave:2> tmp = matlabbatch;
octave:3> clear matlabbatch
octave:4> who
Variables in the current scope:

ans  tmp

octave:5> load test_job.mat
octave:6> who
Variables in the current scope:

ans          matlabbatch  tmp

octave:7> isequal (tmp, matlabbatch)
ans =  1


So maybe this will fix the problem for you.

John W. Eaton <jwe>
Group administrator
Thu 27 Jan 2011 10:03:56 AM UTC, comment #5: 

I'm not sure whether the load issue was related, but it seems to be gone now. However, the original problem still persists in one way or the other. Running the attached test_job.m as a script, the field


matlabbatch{2}.spm.spatial.realign.write.data


should contain a properly initialised cfg_dep, but it doesn't. Again, the empty substructs are lost. The file test_job.mat contains the same variable, correctly saved in MATLAB and loadable in octave.

(file #22530, file #22531)

Volkmar Glauche <glauche>
Thu 27 Jan 2011 09:26:40 AM UTC, comment #4: 

Was that problem caused by the patch, or was it also failing to load the object before the patch was applied?

I checked in the following change.

http://hg.savannah.gnu.org/hgweb/octave/rev/a71c1aa9823e

It seems to fix the problem for me.

John W. Eaton <jwe>
Group administrator
Thu 27 Jan 2011 09:02:31 AM UTC, comment #3: 

There is now another problem: loading a .mat file with a cfg_dep object fails. After a cfg_dep object is created from the command line, load does not fail anymore. (see attached file)


octave:2> load /tmp/dep.mat
error: feval: first argument must be a string, inline function or a function handle
warning: call to constructor for class cfg_dep failed
octave:2> d=cfg_dep

d =

cfg_dep object: 1-by-1

  scalar structure containing the fields:

    tname = Target
    tgt_exbranch =

      0x0 struct array containing the fields:

        type
        subs

    tgt_input =

      0x0 struct array containing the fields:

        type
        subs

    tgt_spec = {}(0x0)
    jtsubs =

      0x0 struct array containing the fields:

        type
        subs

    sname = Source
    src_exbranch =

      0x0 struct array containing the fields:

        type
        subs

    src_output =

      0x0 struct array containing the fields:

        type
        subs


octave:3> load /tmp/dep.mat
octave:4>



(file #22524)

Volkmar Glauche <glauche>
Thu 27 Jan 2011 01:43:40 AM UTC, comment #2: 

I checked in the following change:

http://hg.savannah.gnu.org/hgweb/octave/rev/d08901c05c1b

Jaroslav, do you see a better way to solve this problem?

This seems to fix the bug for me, but I'll wait for feedback before closing the report.

John W. Eaton <jwe>
Group administrator
Tue 25 Jan 2011 12:52:23 PM UTC, comment #1: 

There seems to be a different behaviour in MATLAB and octave in this case, which is handled in cfg_dep/subsasgn.m. In MATLAB, cfg_dep/subsasgn is called with the following arguments:


>> dbstop @cfg_dep/subsasgn
>> d(2) = cfg_dep;
K>> whos
  Name          Size            Bytes  Class     Attributes

  dep           0x0                 0  double
  subs          1x1               476  struct
  varargin      1x1              2184  cell


Here, dep is not yet classified, and more importantly, it is empty.

In Octave, the situation is different.


dbstop @cfg_dep/subsasgn
d(2) = cfg_dep;
debug> whos
Variables in the current scope:

  Attr Name          Size                     Bytes  Class
  ==== ====          ====                     =====  =====
   f   dep           1x1                          0  cfg_dep
   f   subs          1x1                         10  struct
   f   varargin      1x1                         12  cell
debug> dep

dep =

cfg_dep object: 1-by-1

  scalar structure containing the fields:

    tname = [](0x0)
    tgt_exbranch = [](0x0)
    tgt_input = [](0x0)
    tgt_spec = [](0x0)
    jtsubs = [](0x0)
    sname = [](0x0)
    src_exbranch = [](0x0)
    src_output = [](0x0)


Here, dep is not empty, but the properties do not seem to be initialised by the constructor code either. For MATLAB compatibility, dep should be empty under these circumstances.

Volkmar Glauche <glauche>
Tue 25 Jan 2011 11:41:32 AM UTC, original submission:  

Using the same code as in bug #32222, the following produces incorrect results:


octave:2> d(2)=cfg_dep

d =

cfg_dep object: 1-by-2

octave:3> d(1)

ans =

cfg_dep object: 1-by-1

  scalar structure containing the fields:

    tname = [](0x0)
    tgt_exbranch = [](0x0)
    tgt_input = [](0x0)
    tgt_spec = [](0x0)
    jtsubs = [](0x0)
    sname = [](0x0)
    src_exbranch = [](0x0)
    src_output = [](0x0)

octave:4> d(2)

ans =

cfg_dep object: 1-by-1

  scalar structure containing the fields:

    tname = Target
    tgt_exbranch =

      0x0 struct array containing the fields:

        type
        subs

    tgt_input =

      0x0 struct array containing the fields:

        type
        subs

    tgt_spec = {}(0x0)
    jtsubs =

      0x0 struct array containing the fields:

        type
        subs

    sname = Source
    src_exbranch =

      0x0 struct array containing the fields:

        type
        subs

    src_output =

      0x0 struct array containing the fields:

        type
        subs


d(1) does not get initialised properly, but d(2) does. In MATLAB, both d(1) and d(2) get initialised.

Volkmar Glauche <glauche>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #22530:  test_job.m added by glauche (2KiB - text/x-objcsrc)
file #22531:  test_job.mat added by glauche (841B - application/octet-stream)
file #22524:  dep.mat added by glauche (320B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by jwe
  • -email is unavailable- added by glauche (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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-01-28 jwe StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2011-01-27 glauche Attached File- Added test_job.m, #22530
        Attached File- Added test_job.mat, #22531
    2011-01-27 glauche Attached File- Added dep.mat, #22524
    2011-01-27 jwe StatusNone Ready For Test
        Carbon-Copy- Added highegg

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code