bugGNU Octave - Bugs: bug #49334, addpath(pwd) removes '.' from path

 
 

bug #49334: addpath(pwd) removes '.' from path

Submitter:  None
Submitted:  Thu 13 Oct 2016 01:19:42 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Houtan Bastani Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 4.2.0-rc2
Operating System:  * Mac OS Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 13 Oct 2016 03:27:10 PM UTC, comment #1: 

Happily, this has already been fixed.  See bug #49184.  The fix was made after the 4.2.0-rc2 release candidate and will be part of -rc3, or the final release.

Rik <rik5>
Group administrator
Thu 13 Oct 2016 01:19:42 PM UTC, original submission:  

Using `addpath(pwd)` to add the current working directory to the path removes '.' from the path. If you then change directories and run a `.m` file, Octave tells you that the file is undefined.

The following is a minimum working example to show the removal of '.' from the path and, further down, that Octave no longer finds a file that is in the current directory.


% Show that addpath(pwd) removes '.' from path
find(strcmp(strsplit(path,":"),'.'))
addpath(pwd)
find(strcmp(strsplit(path,":"),'.'))

% Create tmp/file_to_run.m
mkdir tmp;
cd tmp;
fname = 'file_to_run';
fid = fopen([fname '.m'],'w');
fprintf(fid, 'a=1');
fclose(fid);

% Show that Octave no longer finds file_to_run.m because '.' is not in the path
pwd
ls([fname '.m'])
evalin('base', fname)


NB: I am using Octave 4.2.0-rc2 on OS X 10.12 installed through Homebrew, but I get the same bug on Octave 4.2.0-rc2 that I built myself on Debian Jessie.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #38718:  bug.m added by None (239B - application/octet-stream - the above code in a .m file)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by None (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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-10-13 rik5 StatusNone Fixed
        Open/ClosedOpen Closed
    2016-10-13 None Attached File- Added bug.m, #38718

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code