bugGNU Octave - Bugs: bug #51706, dir_in_loadpath, file_in_loadpath...

 
 

bug #51706: dir_in_loadpath, file_in_loadpath need better documentation of the action they perform

Submitter:  Rik <rik5>
Submitted:  Wed 09 Aug 2017 05:33:02 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Documentation
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
   

Jump to the original submission

Fri 01 Sep 2017 12:36:48 AM UTC, comment #7: 

I added documentation about what happens when the input is an absolute name (http://hg.savannah.gnu.org/hgweb/octave/rev/bdde51fda657).  This is good enough for now.  Marking as fixed and closing report.

Rik <rik5>
Group administrator
Wed 09 Aug 2017 08:26:30 PM UTC, comment #6: 

Another possibility that could avoid confusion is to rename these functions find_file and find_directory, deprecating and eventually removing the old names.

John W. Eaton <jwe>
Group administrator
Wed 09 Aug 2017 08:20:54 PM UTC, comment #5: 

We can solve this with a documentation fix then.  It wasn't clear to me that its purpose was to do the actions you describe.

Rik <rik5>
Group administrator
Wed 09 Aug 2017 06:58:25 PM UTC, comment #4: 

Maybe the name of the function is misleading.  It is more like "find a file (or directory) also searching a list of directories".  If the file (or directory) name is absolute and it exists, then it can be found, so it returns the name of the file (or directory).

The purpose of the function is not to say whether the directory is contained in the list of directories that make up the load path, or to only search for subdirectories of path elements.

As far as I know, it's always been this way because this is the way that the kpathsearch library works for finding files and that's what Octave originally used for all path searching.  If you change it so that it only searches for subdirectories of path elements, then you will have to check that each location where dir_in_loadpath is used is also modified to also check for absolute names, or verify that searching for absolute names is actually NOT wanted in those places.

John W. Eaton <jwe>
Group administrator
Wed 09 Aug 2017 06:40:18 PM UTC, comment #3: 

The problem is that the output is not true.  dir_in_loadpath says that "/home" is on the path, when it is not on the path.

I don't want to disable handling absolute names, just return the correct answer when the input is an absolute name.

Rik <rik5>
Group administrator
Wed 09 Aug 2017 06:04:03 PM UTC, comment #2: 

I'm pretty sure dir_in_loadpath has behaved this way for a very long time and that it's intentional.  What trouble does it cause?

If we change file_in_loadpath and dir_in_loadpath to not handle absolute names, then we have to look at every use of those functions and decide whether we should also handle absolute names in those places.

John W. Eaton <jwe>
Group administrator
Wed 09 Aug 2017 05:39:19 PM UTC, comment #1: 

I added a BIST test for dir_in_loadpath here (http://hg.savannah.gnu.org/hgweb/octave/rev/e43e95392c29).

Rik <rik5>
Group administrator
Wed 09 Aug 2017 05:33:02 PM UTC, original submission:  

When the input argument is the absolute name of a directory the function incorrectly returns the input argument.  This affects both dir_in_loadpath and file_in_loadpath.

Example Code:


octave:12> dir_in_loadpath ("/home")
ans = /home
octave:13> file_in_loadpath ("/home")
ans = /home




Rik <rik5>
Group administrator

 

(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 jwe (Posted a comment)
  • -email is unavailable- added by rik5 (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-09-01 rik5 Item GroupIncorrect Result Documentation
        StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2017-08-09 jwe CategoryDocumentation Octave Function
    2017-08-09 rik5 CategoryOctave Function Documentation
        Summarydir_in_loadpath, file_in_loadpath are incorrect when input is absolute directory name dir_in_loadpath, file_in_loadpath need better documentation of the action they perform

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code