print function executes index.m in CWD

Dmitri A. Sergatskov dasergatskov at gmail.com
Fri Sep 5 11:09:56 CDT 2008


On Fri, Sep 5, 2008 at 10:27 AM, Ben Abbott <bpabbott at mac.com> wrote:
...
>
> Octave searches its path and runs the first instance of index.m that it finds.
>

The only index.m I have on my computer is

/usr/share/octave/3.0.1/m/strings/index.m

The file implements function
octave:1> help index
 -- Function File:  index (S, T)
 -- Function File:  index (S, T, DIRECTION)
  ...


     See also: find, rindex.

/usr/share/octave/3.0.1/m/strings/index.m

This file is obviously in the octave's path.

yet it is not executed at startup, otherwise I would get
a a message

Invalid call to index.  Correct usage is:

 -- Function File:  index (S, T)
 -- Function File:  index (S, T, DIRECTION)

(which I do not).

Having index.m that looks like:

1

(I.e. it just a line with number 1 on it)
I get:

For information about changes from previous versions, type `news'.

ans =  1
error: can't perform indexing operations for <unknown type> type
error: evaluating assignment expression near line 47, column 5
error: called from `rindex' in file `/usr/share/octave/3.0.1/m/strings/rindex.m'
error: evaluating assignment expression near line 30, column 10
(lots of errors deleted)
...
error: addpath: expecting all args to be character strings
error: evaluating if command near line 2231, column 3
error: called from `pkg:load_packages_and_dependencies' in file
`/usr/share/octave/3.0.1/m/pkg/pkg.m'
error: called from `pkg:load_packages' in file
`/usr/share/octave/3.0.1/m/pkg/pkg.m'
error: evaluating switch command near line 269, column 3
error: called from `pkg' in file `/usr/share/octave/3.0.1/m/pkg/pkg.m'
error: near line 20 of file `/usr/share/octave/3.0.1/m/startup/octaverc'

So I am really baffled.

Dmitri.
--


More information about the Bug-octave mailing list