bugGNU Octave - Bugs: bug #35697, Matlab loadpath includes private...

 
 

bug #35697: Matlab loadpath includes private directories

Submitted by:  Muhali <muhali>
Submitted on:  Fri 02 Mar 2012 04:56:42 PM UTC  
 
Category:  Interpreter Severity:  3 - Normal
Priority:  3 - Low Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  Closed
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.

 

Fri 09 May 2014 10:40:16 AM UTC, comment #3: 

The fix works only when the loading is done from within the main directory (where fun.m resides). If a private function 'foo' is doing the loading, it doesn't work. Hence,

% /tmp/foo/fun.m
function y = fun()
   foo;
end

% /tmp/foo/private/foo.m
function y = foo()
   load foo.mat
end

works in ML but not in octave.

Muhali <muhali>
Fri 03 Jan 2014 07:37:05 PM UTC, comment #2: 

I checked in the following change on the default branch:

http://hg.savannah.gnu.org/hgweb/octave/rev/adbbacce8aaf

This change also affects the "exist" function, which now finds files in private directories.  I believe this is also compatibile with Matlab behavior.

John W. Eaton <jwe>
Project Administrator
Fri 02 Mar 2012 05:26:08 PM UTC, comment #1: 

I'm not sure Octave will want to chase compatibility in this case.  It seems odd that the load command should prepend "private/" to the list of directories it searches.

As a workaround, you could code the function to be

  load private/foo.mat

which works on Octave.  Of course, this will throw the occasional warning

warning: load: file found in load path

but that isn't horrible.

Rik <rik5>
Project Administrator
Fri 02 Mar 2012 04:56:42 PM UTC, original submission:  

Private directories are treated differently in matlab and octave. If in a function a file from the private directory is loaded this is recognized by matlab but not by octave, as in the following example where foo.mat resides in /foo/private:

% /foo/fun.m
function y = fun()
   load foo.mat
end

%> cd /foo; octave --no-init-file -q
octave:> fun
error: load: unable to find file foo.mat
error: called from:
error:   /foo/fun.m at line 3, column 4

Muhali <muhali>

 

(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 (Posted a comment)
  • -email is unavailable- added by muhali (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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-01-03 jwe StatusConfirmed => Fixed
        Open/ClosedOpen => Closed
    2012-03-02 rik5 StatusNone => Confirmed
    2012-03-02 rik5 Summaryprivate directories => Matlab loadpath includes private directories
    2012-03-02 rik5 CategoryNone => Interpreter
        Priority5 - Normal => 3 - Low
        Item GroupNone => Matlab Compatibility

    Back to the top


    Powered by Savane 3.5