print function executes index.m in CWD

Ben Abbott bpabbott at mac.com
Fri Sep 5 10:27:14 CDT 2008


On Friday, September 05, 2008, at 06:34AM, "Adam Ludvig" <hunludvig at gmail.com> wrote:
>Bug report for Octave 3.0.2 configured for i686-pc-linux-gnu
>
>Description:
>-----------
>
>  I try to print a plot to ps, it doesnt create the ps, but it
>executes the index.m script in the current working dir.
>        If it's a feature , that was a bad joke :(
>        It works correctly (as I think) with 3.0.0, so maybe in the
>print.m is the failure.
>        It works also, when I remove index.m.
>

Adam,

Octave searches its path and runs the first instance of index.m that it finds.

If you type "path" at Octave's command prompt you'll see something similar to ...

octave:1> path

Octave's search path contains the following directories:
.
/sw/share/octave/packages/vrml-1.0.3
/sw/share/octave/packages/time-1.0.2
/sw/share/octave/packages/struct-1.0.2
/sw/share/octave/packages/strings-1.0.2
/sw/share/octave/packages/statistics-1.0.3
/sw/share/octave/packages/splines-1.0.2
/sw/share/octave/packages/special-matrix-1.0.2
/sw/share/octave/packages/specfun-1.0.3
/sw/share/octave/packages/plot-1.0.2
/sw/share/octave/packages/physicalconstants-0.1.2
/sw/share/octave/packages/parallel-1.0.3
/sw/share/octave/packages/outliers-0.13.4
/sw/share/octave/packages/optiminterp-0.2.4
/sw/share/octave/packages/optim-1.0.0
/sw/share/octave/packages/odepkg-0.3.3
/sw/share/octave/packages/odebvp-1.0.1
/sw/share/octave/packages/octcdf-1.0.6
[...]

Notice the *first* location is "." which, of course, is you current working directory.

Thus, this is not a bug but the way Octave is intended to work, and is consistent with the way Matlab works as well.

I agree this can be annoying, but in the event you'd like to over-ride the way one of Octave/Matlab's functions works this "feature" is very convenient.

Ben


More information about the Bug-octave mailing list