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


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

Submitter:  Doug Stewart <dastew>
Submitted:  Wed 20 Sep 2017 01:02:30 PM UTC
Category:  Interpreter Severity:  3 - Normal
Priority:  3 - Low Item Group:  Missed Error or Warning
Status:  Confirmed Assigned to:  None
Originator Name:  Doug Stewart Open/Closed:  * Open
Release:  * 4.2.1 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment (Rich Markup)

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>
Group 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>
Group 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>
Group 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 Files:

No files currently attached


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 mtmiller (Posted a comment)
  • -email is unavailable- added by dastew (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 project members can vote.





    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-09-25 rik5 Priority5 - Normal 3 - Low
        StatusNone Confirmed
    2017-09-20 mtmiller CategoryGUI Interpreter

    Back to the top

    Powered by Savane 3.11