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

Submitted by:  Rik <rik5>
Submitted on:  Wed 09 Aug 2017 05:33:02 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: ConfirmedAssigned to: None
Originator Name: Open/Closed: Open
Release: devOperating System: Any

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)

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>
Project 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>
Project 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>
Project 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>
Project 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>
Project 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>
Project 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:

Rik <rik5>
Project Administrator

 

(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 jwe (Posted a comment)
  • -unavailable- added by rik5 (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 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 09 Aug 2017 08:26:30 PM UTCjweCategoryDocumentation=>Octave Function
    Wed 09 Aug 2017 08:20:54 PM UTCrik5CategoryOctave 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.1-cleanup1