bugGNU Octave - Bugs: bug #32296, matlabbatch: equivalent subscript...

 
 

bug #32296: matlabbatch: equivalent subscript assignments produce unequal results

Submitted by:  Volkmar Glauche <glauche>
Submitted on:  Sun Jan 30 21:16:59 2011  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: ConfirmedAssigned to: None
Originator Name: Open/Closed: Open
Release: devOperating System: GNU/Linux

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

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

 

(Jump to the original submission Jump to the original submission)

Sat Nov 19 14:35:23 2016, comment #9:

This issue seems to still be present in Octave 4.2.0.

(The test script from the from the original submission still returns "false", when used together with the files from comment #4.)

Hartmut <hardy>
Tue Jul 15 14:55:56 2014, comment #8:

Using the following changes to cfg_callbuiltin.m and helper functions oct_findfield.m and oct_fixsubs.m I was able to run the simple batch file attached (test.m).

I'm sure it requires testing but I think the way Octave's builtin() is implemented can be worked around with this approach.

Stanislaw Adaszewski <sadaszew>
Tue Jan 21 13:59:50 2014, comment #7:

Thanks for proofing, trying again:

Mike Miller <mtmiller>
Project Administrator
Tue Jan 21 08:28:09 2014, comment #6:

The code excerpt given is from a batch configuration and job management system used e.g. by Statistical Parametric Mapping (SPM), a MATLAB software that is used widely in brain imaging and data analysis. While development is focused on MATLAB, SPM developers would like to support Octave as well. Most of the algorithms implemented in SPM run fine on Octave, but the batch system as a major part of the command line user interface to SPM does not.

I understand that there seems to be an incompatibility between MATLAB and Octave when dispatching to the correct subsasgn/subsref methods for @-objects. MATLAB also has difficulties there, which have been resolved by the cfg_callbuiltin.m function.

For SPM, it would be necessary to get the same subsasgn/subsref behaviour in both MATLAB and Octave. If this can't be fixed easily in Octave itself, I would be open to suggestions to work around this problem.

Best, Volkmar

PS@Mike:

your comment #5 seems to be truncated on the web page for this bug compared to the email.

Volkmar Glauche <glauche>
Tue Jan 21 07:06:54 2014, comment #5:

Yes, the example with the provided class definitions still shows the reported problem in the current development version. Here's another way of looking at the symptom:

Mike Miller <mtmiller>
Project Administrator
Mon Jan 20 09:28:20 2014, comment #4:

I've compiled an excerpt from my original project containing the relevant .m files only. See matlabbatch_extract.tgz attached. Although there are multiple classes (cfg_repeat, cfg_exbranch, cfg_branch) derived from cfg_item, all share the same subsasgn/subsref logic.

Things seem to go wrong whenever one of the class subsasgn/subsref methods call cfg_callbuiltin to dispatch subscript reference/assignment calls.

The example code from the original submission still produces this problem in octave 3.6.4.

Steps to test:

1. Unpack matlabbatch_extract.tgz into new folder
2. add this folder to octave's path
3. run the code lines from the original bug submission

cr and cr1 should have the same contents, especially the cfg_exbranch objects in cr.values{1} and cr1.values{1} should have the same contents. cr is the reference object, information is lost when assigning cr1.values{1}.tag.

I did not yet try octave 3.8 or a current developer release, but would be happy to do so if there might be a chance that the problem has been resolved.

(file #30316)

Volkmar Glauche <glauche>
Mon Jan 20 00:15:02 2014, comment #3:

It would be nice if there was a simple example pasted or attached to this report to reproduce this error. Setting status to "need info" for now, I don't know how to test if this still affects the current development version.

Mike Miller <mtmiller>
Project Administrator
Mon Jan 31 11:17:58 2011, comment #2:

Calling subsasgn via builtin is actually required by MATLAB to figure out correctly which method to call.
Anecdotally, the way this is done (outside any object method using the static cfg_callbuiltin) works around a problem in MATLAB, where builtin() called from an object method does not determine the correct subsasgn method as well...

Volkmar Glauche <glauche>
Mon Jan 31 10:48:58 2011, comment #1:

Jaroslav, I'm copying you on this report because you have worked on this part of Octave much more than I have lately, so I'm hoping you will have some insight here.

It seems that this problem is related to the following change:

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

which was made in response to the following bug report:

https://mailman.cae.wisc.edu/pipermail/help-octave/2009-April/034731.html

The change added a check to see whether octave_value::subsasgn was called from the "builtin" function, and if so, the subsasgn method lookup is skipped. Maybe this was not the right fix, but it avoided the reported problem.

In your case, the cfg_repeat and cfg_exbranch subsasgns call subsasgn using the "builtin" function, but they should perform the method lookup, and if they do, I think Octave does the right thing for your code.

However, simply removing the check for called_from_builtin in subsasgn brings back the earlier problem.

So I don't know how to solve both problems at the same time. What is the appropriate check that should be made here to avoid the recursion in one case and to allow the method lookup when it is needed?

John W. Eaton <jwe>
Project Administrator
Sun Jan 30 21:16:59 2011, original submission:

Using matlabbatch (see bug #32261) objects, the following commands should produce two identical objects cr and cr1:

The only difference is that the contents of cr.values{1} is created as a separate object in workspace before it is assigned, while the contents of cr1.values{1} is assigned 'on-the-fly'. In MATLAB,

returns true, while octave returns false. Octave should return true as well. As far as I can tell, cr is the correct result, while cr1 is not created correctly.

Volkmar Glauche <glauche>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #31720:  cfg_callbuiltin.m added by sadaszew (476B - text/x-objcsrc)
file #31721:  oct_findfield.m added by sadaszew (848B - text/x-objcsrc)
file #31722:  oct_fixsubs.m added by sadaszew (630B - text/x-objcsrc)
file #31723:  test.m added by sadaszew (397B - text/x-objcsrc)
file #30316:  matlabbatch_extract.tgz added by glauche (14kB - application/x-gtar)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by hardy (Posted a comment)
  • -unavailable- added by sadaszew (Updated the item)
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by jwe
  • -unavailable- added by glauche (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 9 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue Jul 15 14:54:09 2014sadaszewAttached File-=>Added cfg_callbuiltin.m, #31720
      Attached File-=>Added oct_findfield.m, #31721
      Attached File-=>Added oct_fixsubs.m, #31722
      Attached File-=>Added test.m, #31723
    Tue Jan 21 07:06:54 2014mtmillerStatusNeed Info=>Confirmed
    Mon Jan 20 09:28:20 2014glaucheAttached File-=>Added matlabbatch_extract.tgz, #30316
    Mon Jan 20 00:15:02 2014mtmillerCategoryNone=>Octave Function
      StatusNone=>Need Info
    Mon Jan 31 10:48:58 2011jweCarbon-Copy-=>Added highegg

    Back to the top


    Powered by Savane 3.1-cleanup