bugGNU Octave - Bugs: bug #52071, reporting functions that shadow a...


bug #52071: reporting functions that shadow a core library function is inconsistent.

Submitted by:  Doug Stewart <dastew>
Submitted on:  Wed 20 Sep 2017 01:02:30 PM UTC  
Category: InterpreterSeverity: 3 - Normal
Priority: 3 - LowItem Group: Missed Error or Warning
Status: ConfirmedAssigned to: None
Originator Name: Doug StewartOpen/Closed: Open
Release: 4.2.1Operating System: GNU/Linux

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Mon 25 Sep 2017 06:53:09 PM UTC, comment #4:

Oh, so this is with the GUI setting "Startup path" set to a directory with m-files in it? I agree, using that setting it does not warn when Octave starts like it would if Octave was run from that directory.

The GUI is probably calling Fchdir under the hood, which is probably why this behaves similar to calling "cd" or "chdir" in the interpreter later and not printing a warning.

Mike Miller <mtmiller>
Project Administrator
Mon 25 Sep 2017 06:46:31 PM UTC, comment #3:

I think you are still thinking about the cli way of using octave.
I am thinking about the gui users.(myself included)

When only working in the gui mode (most of windows users)
after you make a folder your pwd, and then close octave, on the next startup it starks in that folder. In my case it is called Mfiles. ( a place I keep all my M files) So the gui always starts up using this folder and never reports and shadowing.

I would like it to report any shadowing on startup for this startup folder.

Doug Stewart <dastew>
Mon 25 Sep 2017 06:26:05 PM UTC, comment #2:

Would we really want to change this behavior?

1. chdir(dir) or cd(dir) → no warning

I could cd to a directory just to look at things, and then cd back out, without ever having any intention to execute the flip.m m-file. I think it might be annoying to get lots of false positive warnings about m-files which are not really problems.

I second Mike's experiments in that the GUI and the CLI both reproduce the same set of warnings under the same set of circumstances.

I also can reproduce the difference between a compiled function and an m-file. That seems small, so I lowered the priority, but worth fixing if it would be easy to do so.

Rik <rik5>
Project Administrator
Wed 20 Sep 2017 07:04:13 PM UTC, comment #1:

I do see a warning when the GUI starts, and also when using addpath in the GUI. So I don't see any difference between command-line and GUI with regards to this behavior. The difference only has to do with how the function override is added to the path.

1. chdir(dir) or cd(dir) → no warning
2. addpath(dir) → warning
3. start Octave in dir → warning
4. start Octave with --path $dir option → no warning

However, if the override is a compiled builtin, for example "exp" instead of "flip", then a warning is issued when the --path option is given. This probably has to do with the order of path initialization and of initial scanning of m-files and oct-files in the load path.

Mike Miller <mtmiller>
Project Administrator
Wed 20 Sep 2017 01:02:30 PM UTC, original submission:

Whe warning "function foo.m shadows a core library function"
is missing for some circumstances.

The following statements assumes that there is a function "flip.m" that shadows a core library function.

When starting octave with "octave-cli" It checks the pwd for any function that shadows and reports it at start up.

When starting octave with "octave" (run GUI) there is no warning.

Running octave-cli and then addpath to a folder that has "flip.m" octave then gives a warning.

Running octave-cli and then CD to a folder that has "flip.m" and no warning is given.

Running GUI and CD or addpath there is no warning issued.

Doug Stewart <dastew>


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

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by dastew (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 25 Sep 2017 06:26:05 PM UTCrik5Priority5 - Normal=>3 - Low
    Wed 20 Sep 2017 07:04:13 PM UTCmtmillerCategoryGUI=>Interpreter

    Back to the top

    Powered by Savane 3.1-cleanup1