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


bug #40332: which function sometimes returns relative pathname

Submitted by:  Richard <crobar>
Submitted on:  Mon 21 Oct 2013 07:07:54 PM UTC  
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 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 02 Nov 2013 06:47:36 PM UTC, 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 30 Oct 2013 01:33:44 AM UTC, 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 29 Oct 2013 03:52:14 AM UTC, 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 29 Oct 2013 03:19:40 AM UTC, 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 22 Oct 2013 12:16:55 PM UTC, comment #2:

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

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

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

Richard <crobar>
Mon 21 Oct 2013 07:07:54 PM UTC, 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 (3KiB - 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 02 Nov 2013 06:47:36 PM UTCmtmillerStatusPatch Submitted=>Fixed
    Wed 30 Oct 2013 02:09:32 AM UTCmtmillerAssigned toNone=>mtmiller
    Tue 29 Oct 2013 03:19:40 AM UTCmtmillerAttached File-=>Added bug40332.diff, #29497
    Tue 22 Oct 2013 12:15:53 PM UTCcrobarAttached File-=>Added which_canon_path.patch, #29441
    Tue 22 Oct 2013 11:38:53 AM UTCjweStatusNone=>Patch Submitted
    Tue 22 Oct 2013 11:01:27 AM UTCcrobarAttached File-=>Added which_canon_path.patch, #29440

    Back to the top

    Powered by Savane 3.1-cleanup1