bugGNU Octave - Bugs: bug #50541, which() should return non-empty...

 
 

bug #50541: which() should return non-empty string for existing built-in classes/functions

Submitter:  Felipe G. Nievinski <fgnievinski>
Submitted:  Tue 14 Mar 2017 05:08:45 AM UTC
   
 
Category:  Octave Function 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 16 Mar 2017 07:33:51 PM UTC, comment #4: 

I change which to return the type field--for example, "built-in function"--whenever the path to the function is null ("").  This makes more sense for command-line functions as well which previously returned "".  See http://hg.savannah.gnu.org/hgweb/octave/rev/c1362a71fb0e.

Rik <rik5>
Group administrator
Wed 15 Mar 2017 08:45:07 PM UTC, comment #3: 

Okay.  It seems like we should return the string


'inputParser' is a built-in function




Rik <rik5>
Group administrator
Wed 15 Mar 2017 07:26:41 PM UTC, comment #2: 

ML r2017a prerelease:

>> tmp = which ('sin')

tmp =

    'built-in (C:\Program Files\MATLAB\R2017a\toolbox\matlab\elfun\@double\sin)'


The path in the output is nonexistent.
In ..\matlab\elfun, sin.m only contains a very short help text.

Philip Nienhuis <philipnienhuis>
Group Member
Tue 14 Mar 2017 03:57:54 PM UTC, comment #1: 

So Matlab copies over the whole string.  That's not a bad option.

According to the documentation for which, it is supposed to return the string "variable" if the argument is a variable, and a path to the file otherwise.

Could you test this code?


tmp = which ('sin')



Rik <rik5>
Group administrator
Tue 14 Mar 2017 05:08:45 AM UTC, original submission:  

In Octave we have:

>> size(which('inputParser'))

ans =
        0        0

>> tmp = which('inputParser')

tmp =

It may only be a matter of assigning to the output the message which is already displayed:

>> which('inputParser')

'inputParser' is a built-in function


For reference, in Matlab we have:

>> tmp = which('inputParser')

tmp =
inputParser is a built-in method

>> size(which('inputParser'))

ans =
     1    32

Felipe G. Nievinski <fgnievinski>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

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 fgnievinski (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
    2017-03-16 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
        Release4.2.1 dev
    2017-03-15 rik5 StatusNeed Info Confirmed
    2017-03-14 rik5 StatusNone Need Info
        Operating SystemMicrosoft Windows Any

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code