bugGNU Octave - Bugs: bug #41992, inputname fails for arguments...

 
 

bug #41992: inputname fails for arguments stemming from a list

Submitted by:  None
Submitted on:  Fri 28 Mar 2014 08:29:16 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: ConfirmedAssigned to: None
Originator Name: batOriginator Email: -unavailable-
Open/Closed: OpenRelease: dev
Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Thu 15 Dec 2016 02:31:50 PM UTC, comment #5:

Part of this issue is still present in Octave 4.2.0. (But it might be a "WON'T FIX", according to Rik's comment #3.)

This is what I see with Octave 4.2.0 :

  • There are no error messages from inputname any more, when I use the code from commment #0. This has been fixed according to comment #3.
  • I still get different results with Octave when I run the code from comment #1 and compare it to the Matlab result in comment #2. But Rik mentioned in comment #3 that this will maybe never be fixed.
Hartmut <hardy>
Wed 25 Nov 2015 11:50:15 PM UTC, comment #4:

Can someone test the following in Matlab?

I'd like to know whether they error out, or silently return an empty string for bad index values.

Rik <rik5>
Project Administrator
Wed 25 Nov 2015 11:48:30 PM UTC, comment #3:

It seems pretty clear that Matlab expands any inputs to a function, such as comma-separated lists, before creating the input argument list. Octave seems to do the reverse and makes the list of inputs directly from what is available in the parser.

For reference, the code to modify is in ov-usr-fcn.cc. The function that populates the symbol table is

It is the arg_names variable which is different than expected.

Before this gets fixed, which may never happen, I have re-written inputname so that it at least won't issue strange index out-of-bound errors. See http://hg.savannah.gnu.org/hgweb/octave/rev/2892f62fb37c.

Rik <rik5>
Project Administrator
Tue 01 Apr 2014 02:30:56 PM UTC, comment #2:

Here is what matlab returns:

i.e exactly what octave would return after "foo (1,2,3,x)"

Pantxo Diribarne <pantxo>
Project Member
Sat 29 Mar 2014 02:58:15 AM UTC, comment #1:

Confirmed here as well. I'm not sure if that's the expected behavior, can you test what Matlab does for this example?

Also what would Matlab do with named arguments following a cell array, for example

Mike Miller <mtmiller>
Project Administrator
Fri 28 Mar 2014 08:29:16 PM UTC, original submission:

I define:

function foo(varargin)
_varval_(".argn.")
nargin
inputname(1)
inputname(2)

If I call foo(5,3), I get the expected behavior where inputname(1) and inputname(2) both evaluate to "".

octave-cli-3.8.1> foo(5,3)
ans =
{
[1,1] = 5
[2,1] = 3
}
ans = 2
ans =
ans =

If I define c={5 3} and call foo(c{:}) I expect to get the same thing. But instead:

octave-cli-3.8.1> c={5 3}; foo(c{:})
ans =
{
[1,1] = c {:}
}
ans = 2
ans =
error: foo: A(I): index out of bounds; value 2 out of bound 1
error: called from:
error: /usr/local/share/octave/3.8.1/m/miscellaneous/inputname.m at line 31, column 7

I thought this might be fixed by bug #35497. Tried incorporating the development version of oct-obj.h. However, I received same results.

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

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 rik5 (Posted a comment)
  • -unavailable- added by pantxo (Posted a comment)
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by None (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 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 25 Nov 2015 11:48:30 PM UTCrik5Release3.8.1=>dev
    Sat 29 Mar 2014 02:58:15 AM UTCmtmillerCategoryNone=>Octave Function
      Item GroupNone=>Matlab Compatibility
      StatusNone=>Confirmed

    Back to the top


    Powered by Savane 3.1-cleanup1