bugGNU Octave - Bugs: bug #40332, which function sometimes returns...


bug #40332: which function sometimes returns relative pathname

Submitted by:  Richard <crobar>
Submitted on:  Mon Oct 21 19:07:54 2013  
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: FixedAssigned to: Mike Miller <mtmiller>
Originator Name: Richard CrozierOpen/Closed: Closed
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 2 18:47:36 2013, comment #6:

Forgot about this one for a few days. Fixed in the following changeset:


Mike Miller <mtmiller>
Project AdministratorIn charge of this item.
Wed Oct 30 01:33:44 2013, comment #5:

I only see do_which being called from dbstatus and _which_, so AFAICT it's safe, at least nothing else in Octave is expecting a relative path.

The Matlab help at


says that it always returns a full path.

Mike Miller <mtmiller>
Project AdministratorIn charge of this item.
Tue Oct 29 03:52:14 2013, comment #4:

Mike, your change seems fine to me as long as there aren't times when this function is expected to return relative file names.

John W. Eaton <jwe>
Project Administrator
Tue Oct 29 03:19:40 2013, comment #3:

How about the attached change fixing it at a slightly lower level instead?

I see you updated the docstring as well. The new paragraph you added is a little unclear, it seems to imply that which only works for function files (m-files), but it also works with arbitrary files of any type, as well as built-in functions and functions in oct-files.

(file #29497)

Mike Miller <mtmiller>
Project AdministratorIn charge of this item.
Tue Oct 22 12:16:55 2013, comment #2:

I've now uploaded a revised patch which also adds help for the function call syntax.

Richard <crobar>
Tue Oct 22 11:50:56 2013, comment #1:

Ignore the first patch, there are mistakes in it, I'm working on an improvement.

Richard <crobar>
Mon Oct 21 19:07:54 2013, original submission:

'which mfile.m' returns a relative path to the file when that file is in the current directory. In Matlab this is always an absolute path.

Richard <crobar>


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

Attach File(s):

Attached Files
file #29497:  bug40332.diff added by mtmiller (345B - text/x-patch)
file #29441:  which_canon_path.patch added by crobar (3kB - text/x-patch)
file #29440:  which_canon_path.patch added by crobar (757B - text/x-patch - added changeset to force canonical path)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by mtmiller (Updated the item)
  • -unavailable- added by jwe (Updated the item)
  • -unavailable- added by crobar (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 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat Nov 2 18:47:36 2013mtmillerStatusPatch Submitted=>Fixed
    Wed Oct 30 02:09:32 2013mtmillerAssigned toNone=>mtmiller
    Tue Oct 29 03:19:40 2013mtmillerAttached File-=>Added bug40332.diff, #29497
    Tue Oct 22 12:15:53 2013crobarAttached File-=>Added which_canon_path.patch, #29441
    Tue Oct 22 11:38:53 2013jweStatusNone=>Patch Submitted
    Tue Oct 22 11:01:27 2013crobarAttached File-=>Added which_canon_path.patch, #29440

    Back to the top

    Powered by Savane 3.1-cleanup1