bugGNU Octave - Bugs: bug #52598, addpath adds a relative path when...

 
 

bug #52598: addpath adds a relative path when given a relative path

Submitted by:  Motius <motius>
Submitted on:  Wed 06 Dec 2017 12:51:42 PM UTC  
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  In Progress Assigned to:  None
Originator Name:  Motius Open/Closed:  Open
Release:  dev Operating 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)

Wed 10 Jan 2018 04:36:12 PM UTC, comment #11:

@jwe: Yes, adding "+directory" to the patch is more equivalent to import. I suppose this bug report will have to be fixed independently of bug #52585.

Rik <rik5>
Project Administrator
Wed 10 Jan 2018 01:17:53 PM UTC, comment #10:

Wouldn't it cause trouble to add +namespace directories to the path? Those functions should only be visible if used as namespace.function or if there is an import statement present. Adding the +namespace directory to the path would make all the functions visible without "namespace." prefix.

John W. Eaton <jwe>
Project Administrator
Thu 07 Dec 2017 07:02:51 PM UTC, comment #9:

As long as work is being done on the the loadpath in Octave, also see bug #52585. In that case, functions in +namespace directories are note being recognized. One of the easiest solutions would be to add the +namespace directories to Octave's internal loadpath, but not to display these directories when path() is called since they are for Octave's internal benefit.

Rik <rik5>
Project Administrator
Wed 06 Dec 2017 09:26:07 PM UTC, comment #8:

I just pulled the reverted changeset and that does not change the path:

Dan Sebald <sebald>
Wed 06 Dec 2017 09:03:21 PM UTC, comment #7:

That raises an interesting question as to whether path() should show something different than what it interprets. That is, what happens with path(path)? Should the path change? Currently Octave adds the '.' as an expanded string:

Dan Sebald <sebald>
Wed 06 Dec 2017 07:36:39 PM UTC, comment #6:

Yes, "." is always first in Matlab's path but not displayed. I thought it best to display that info, but internally maybe it should be handled differently.

John W. Eaton <jwe>
Project Administrator
Wed 06 Dec 2017 07:11:22 PM UTC, comment #5:

> We probably want to avoid turning "." into an absolute name, especially if we are going to display it in the output of "path".


For what is worth, matlab's path function does not return '.' in the path. I am guessing it's simply always implicit.

Carnë Draug <carandraug>
Project Member
Wed 06 Dec 2017 07:02:55 PM UTC, comment #4:

I backed out the load-path changeset. The fix is not as simple as I initially thought. We probably want to avoid turning "." into an absolute name, especially if we are going to display it in the output of "path".

One simple fix would be to leave the load_path class alone and just fix addpath, rmpath, path (and others?) to expand the path, but I'd rather fix it in one place, inside the load_path class so that relative directory names can't appear in the load_path.

For the other problems, are you building with the JIT compiler enabled? I also see the the decic problem unless I disable it. I think it started happening after my most recent change to the symbol_scope object but I haven't investigated further.

John W. Eaton <jwe>
Project Administrator
Wed 06 Dec 2017 06:29:08 PM UTC, comment #3:

After commenting out the functional tests is decic.m I get a little farther, but the test suite aborts when it enters the fixed tests.

Rik <rik5>
Project Administrator
Wed 06 Dec 2017 06:11:14 PM UTC, comment #2:

Patch works, but I'm having problems running the 'make check'.

There is 1 test failure in run.m that seems related to this change.

The other problem is the test suite is hanging in scripts/ode/decic.m. That probably isn't related to this change but I can't complete 'make check' to see if there are any other errors.

Rik <rik5>
Project Administrator
Wed 06 Dec 2017 04:47:28 PM UTC, comment #1:

I pushed the following changeset:

http://hg.savannah.gnu.org/hgweb/octave/rev/4e746afab617

John W. Eaton <jwe>
Project Administrator
Wed 06 Dec 2017 12:51:42 PM UTC, original submission:

SUMMARY

Octave treats relative paths added with addpath as relative to the current directory. This used to be MatLab's behavior until it was changed around 2016, see:

https://www.mathworks.com/help/matlab/release-notes.html?rntext=&startrelease=R2016b&endrelease=R2016b&category=Language+and+Programming&groupby=release&sortby=descending&searchHighlight=

EXAMPLE

The scripts below illustrate the changing behavior between MatLab versions:

thanks to carandraug for the paste and the MatLab link

OCTAVE

Octave has the same behavior as earlier versions of MatLab.

Motius <motius>

 

(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 sebald (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by motius (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-12-06 jwe StatusReady For Test => In Progress
    2017-12-06 jwe StatusNone => Ready For Test
        Release4.2.1 => dev

    Back to the top


    Powered by Savane 3.3