bugGNU Octave - Bugs: bug #44940, Empty class indexing should result...

 
 

bug #44940: Empty class indexing should result in copy of object rather than error

Submitter:  Rik <rik5>
Submitted:  Mon 27 Apr 2015 03:43:27 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 14 May 2015 03:02:52 PM UTC, comment #4: 

I added comments to the diffs and checked in jwe's changes here (http://hg.savannah.gnu.org/hgweb/octave/rev/b2532deba721).  I added comments and a missing module.mk file and checked in CarnĂ«'s changes here (http://hg.savannah.gnu.org/hgweb/octave/rev/38487298513b).

Closing report.

Rik <rik5>
Group administrator
Wed 06 May 2015 05:35:15 PM UTC, comment #3: 

Since this is a handle class, you could modify a property in one of the objects and see if it also changes in the other (as it should).

John W. Eaton <jwe>
Group administrator
Wed 06 May 2015 05:17:15 PM UTC, comment #2: 

The proposed fix works for me too, and doesn't cause any of the tests to fail. Unfortunately we don't have that much stuff in core with tests that uses classdef to pick up any problem.

I wrote a simple test for this (attached). It modifies properties on the copy to check that indeed we get the same object.

Doing this, I noticed that there's no way to check that two variables actually hold the same object (I couldn't find anything on Matlab documentation either). isequal will compare the values of the object properties so it's not good for this.

(file #33944)

Carnë Draug <carandraug>
Group Member
Wed 06 May 2015 03:05:48 PM UTC, comment #1: 

I'm attaching a possible fix for this problem.  It seems to work for me.

(file #33942)

John W. Eaton <jwe>
Group administrator
Mon 27 Apr 2015 03:43:27 PM UTC, original submission:  

This is a continuation of the bug and fix in this patch report (https://savannah.gnu.org/patch/?8152#postcomment).  Previously, Octave was segfaulting when an attempty was made to use a null index on a class object.  For example


x = foo ()
y = x()


The classdef file foo.m is attached to this report.  In this cset Octave was changed to issue an error and stop segfaulting (http://hg.savannah.gnu.org/hgweb/octave/rev/274b52724931).  This is certainly preferable.

However, for ultimate Matlab compatibility Octave should simply return the base object x rather than issue an error.  Testing of that was done in the patch cited.

Probable solution is something like  retval = this, but using the correct syntax.

Rik <rik5>
Group administrator

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #33944:  bug44940.cset added by carandraug (1KiB - application/octet-stream)
file #33942:  classdef-diffs added by jwe (2KiB - application/octet-stream)
file #33817:  foo.m added by rik5 (66B - text/x-objcsrc)

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Updated the item)
  • -email is unavailable- added by rik5 (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
    2017-12-22 mmuetzel Dependencies- bugs #52724 is dependent
    2015-05-14 rik5 Open/ClosedOpen Closed
    2015-05-14 rik5 StatusPatch Submitted Fixed
    2015-05-06 carandraug Attached File- Added bug44940.cset, #33944
    2015-05-06 jwe Attached File- Added classdef-diffs, #33942
        StatusConfirmed Patch Submitted
    2015-04-27 rik5 Attached File- Added foo.m, #33817

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code