bugGNU Octave - Bugs: bug #48235, ver.m does not output an empty...

 
 

bug #48235: ver.m does not output an empty struct for an unknown package

Submitter:  Garrett Euler <ggeuler>
Submitted:  Wed 15 Jun 2016 06:05:06 PM UTC
   
 
Category:  Octave Function Severity:  2 - Minor
Priority:  3 - Low Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 4.0.2 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 16 Jun 2016 04:04:32 PM UTC, comment #5: 

Okay, thanks for testing.  Octave is compatible in returning a row vector struct array.

Rik <rik5>
Group administrator
Thu 16 Jun 2016 03:43:17 PM UTC, comment #4: 

All versions of Matlab I have available (2009-2014) give a 0x0 for an unknown toolbox.  In Matlab (2014a):

>> pkg=ver('unknown')

pkg =

0x0 struct array with fields:

    Name
    Version
    Release
    Date

>>


Octave with the patch is giving exactly the same.

Returning all toolbox info using ver in Matlab:

>> a=ver

a =

1x12 struct array with fields:

    Name
    Version
    Release
    Date

>>



Garrett Euler <ggeuler>
Thu 16 Jun 2016 04:41:23 AM UTC, comment #3: 

Small side question, does Matlab return a column or row vector struct for ver?  Octave is returning a row vector, but Matlab usually likes column vectors.

Rik <rik5>
Group administrator
Thu 16 Jun 2016 12:37:23 AM UTC, comment #2: 

@Garrett: Thanks for the patch.  I modified the commit message slightly.  We like to have the bug number in the commit message which makes it easy to grep through the Mercurial logs to find which particular changeset solved an issue.  At any rate, I checked it in on the stable branch here http://hg.savannah.gnu.org/hgweb/octave/rev/2c035963f469.  It will be a part of the next bug fix release, 4.0.3.

Rik <rik5>
Group administrator
Wed 15 Jun 2016 06:31:29 PM UTC, comment #1: 

I can confirm the difference in behavior between 3.8 and 4.0 (and still the same change in behavior on the default branch).

I didn't even know ver was used for this, but yes if this is a Matlab compatibility issue, this should probably be fixed on the stable branch.

It looks like this change is where the behavior was changed: http://hg.savannah.gnu.org/hgweb/octave/rev/b54093acb8fe

Mike Miller <mtmiller>
Group Member
Wed 15 Jun 2016 06:05:06 PM UTC, original submission:  

In Octave 3.8.2- calling ver.m on an unknown package produced an empty struct - which is what ver.m does in Matlab too.  Octave stable (4.0.2) & dev now produce a scalar struct with empty fields which is not compatible with previous Octave and Matlab.

As an example, this makes testing for a missing package go from:

if(isempty(ver('mypackage')))

to:

mypkg=ver('mypackage');
if(isempty(mypkg) || isempty(mypkg.Version))


I have attached a small patch to fix the issue (affects a single command within ver.m and adds a test).

Garrett Euler <ggeuler>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #37492:  octave4_ver.diff added by ggeuler (1KiB - 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 rik5 (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by ggeuler (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-06-16 rik5 Open/ClosedOpen Closed
    2016-06-16 rik5 StatusConfirmed Fixed
    2016-06-15 mtmiller Severity3 - Normal 2 - Minor
        Priority5 - Normal 3 - Low
        StatusNone Confirmed
    2016-06-15 ggeuler Attached File- Added octave4_ver.diff, #37492

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code