bugGNU Octave - Bugs: bug #46553, Addpath shadows builtin functions...

 
 

bug #46553: Addpath shadows builtin functions without warning

Submitted by:  Max Görner <maxg>
Submitted on:  Fri 27 Nov 2015 08:45:24 AM UTC  
 
Category: Octave FunctionSeverity: 2 - Minor
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: devOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Wed 02 Dec 2015 06:44:52 PM UTC, comment #4:

The actual bug is solved (works for me on MingW and Linux), so can this bug report be closed?

Philip Nienhuis <philipnienhuis>
Project Member
Sun 29 Nov 2015 09:09:32 AM UTC, comment #3:

I have been thinking for a while that it would be nice to have another option that places a directory after the built-ins in the search path.

Two of my use-cases (admittedly specialised) are:
- while I'm developing a built-in textscan, I keep removing scripts/io/textscan.m so that I can make check, and keep putting it back whenever I want to make a patch for an unrelated issue. (If I knew mercurial better, there's probably a clean workaround).

- I have some directories from an old Matlab install in my path, because at one point I needed the function and either didn't want to hunt for the correct Forge module, or had no internet access at the time. This often shadows Octave built-ins.

If I implemented this, would it be likely to get applied?

Lachlan Andrew <lachlan>
Project Member
Fri 27 Nov 2015 07:11:19 PM UTC, comment #2:

I checked in the following change:

http://hg.savannah.gnu.org/hgweb/octave/rev/826a4771718b

John W. Eaton <jwe>
Project Administrator
Fri 27 Nov 2015 12:38:44 PM UTC, comment #1:

Matlab (r2014a) does warn when paths added using addpath shadow builtins (I tried with sin()), unlike Octave (also development version) => confirmed.

Note that str2double is a builtin in Octave but an .m-file function in Matlab - hence your addpath() trick may work with Matlab (although I don't follow) but not with Octave.

BTW, If I've interpreted your explanation correctly I would blame the creators of your projects rather than The Mathworks. Shadowing core functions in projects is rarely a Good Idea.
It is always possible to name functions along the lines of "str2double_1" or "size_B"; at my work we have several "improved" Matlab functions named along that principle.
As you're on Linux, a simple search & replace script recursing directories could help you a lot.

I'll set Item Group to Matlab Compatibility and Severity to minor as there are workarounds.
Status and Release also adapted.

Philip Nienhuis <philipnienhuis>
Project Member
Fri 27 Nov 2015 08:45:24 AM UTC, original submission:

When I add directories to the search path using the "'-end'"-switch, addpath shadows builtin functions without issuing a warning.

I'm on Ubuntu 15.10.

The functions size and str2double in /tmp/ext only contain an assertion.

Since I have to deal with some projects containing their own versions of essential functions (thanks Mathworks), I use the "'-end'"-switch to prevent shadowing. If it can't be avoided, a warning would be great.

sincerely

Max Görner <maxg>

 

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

Attach File(s):
   
   
Comment:
   

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 (Updated the item)
  • -unavailable- added by lachlan (Posted a comment)
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by maxg (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 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 08 Dec 2015 03:52:24 PM UTCrik5StatusReady For Test=>Fixed
      Open/ClosedOpen=>Closed
    Fri 27 Nov 2015 09:01:35 PM UTCjweStatusConfirmed=>Ready For Test
    Fri 27 Nov 2015 12:38:44 PM UTCphilipnienhuisSeverity3 - Normal=>2 - Minor
      Item GroupOther=>Matlab Compatibility
      StatusNone=>Confirmed
      Release4.0.0=>dev

    Back to the top


    Powered by Savane 3.1-cleanup1