octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #49334] addpath(pwd) removes '.' from path


From: anonymous
Subject: [Octave-bug-tracker] [bug #49334] addpath(pwd) removes '.' from path
Date: Thu, 13 Oct 2016 13:19:45 +0000 (UTC)
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:49.0) Gecko/20100101 Firefox/49.0

URL:
  <http://savannah.gnu.org/bugs/?49334>

                 Summary: addpath(pwd) removes '.' from path
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Thu 13 Oct 2016 01:19:42 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: Houtan Bastani
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.2.0-rc2
        Operating System: Mac OS

    _______________________________________________________

Details:

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.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Thu 13 Oct 2016 01:19:42 PM UTC  Name: bug.m  Size: 239B   By: None
the above code in a .m file
<http://savannah.gnu.org/bugs/download.php?file_id=38718>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?49334>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]