bugGNU Octave - Bugs: bug #53654, [octave forge] (image)...

 
 

bug #53654: [octave forge] (image) "rgb2gray.m shadows a core function" only under Windows, not under Linux

Submitter:  Hartmut <hardy>
Submitted:  Sat 14 Apr 2018 06:18:21 PM UTC
   
 
Category:  Octave Package Severity:  2 - Minor
Priority:  3 - Low Item Group:  Unexpected Error or Warning
Status:  Works For Me Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 4.3.90 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 20 May 2018 10:57:04 AM UTC, comment #10: 

This can be solved by not including rgb2gray.m in the Octave Forge Package. While this has yet to be done, I simply delete rgb2gray.m and the warning stops appearing.

Anonymous
Sun 22 Apr 2018 08:32:57 PM UTC, comment #9: 

I'll try to explain more fully, but yes, I think this is intentional behavior, so closing.

When you run Octave normally (not from a build directory), it has a compiled-in default path that includes all of the m-file subdirectories (/opt/.../share/octave/4.3.91/m/audio, etc). You can see what this path is with the pathdef function.

This core default path is the only set of directories that Octave checks with the shadowing warning. If you run addpath('/foo') that contains a function imcrop.m, you will not get a shadowing warning if you later load the image package, because /foo is not in Octave's core default path.

If you run octave --no-init-path, the core default path is set to empty, there is no builtin path. Any directories you add later, even if they would normally have been on the default system path, are not treated like system directories and the shadowing warning is not issued for any files in these paths.

When you use ./run-octave as a developer, octave runs with --no-init-path, because the compiled-in directories may not exist yet if you haven't run 'make install' yet. It uses the --path option to add all of the directories under $sourcedir/scripts. These are not treated as system directories, so the shadow warning is not issued.

This is analogous to GCC and system header files. GCC has a compiled-in default set of include paths, like /usr/include. These are treated differently from normal header files, for example certain warnings are disabled. If you compile something with '-nostdinc -I/usr/include', then the header files in /usr/include are not treated like system header files.

Mike Miller <mtmiller>
Group Member
Sun 22 Apr 2018 07:25:35 AM UTC, comment #8: 

I don't quite understand why, but if this is intentional behavior of (core) Octave, then let's just CLOSE this issue.

(I assume Carne will adapt the image package to Octave 4.4. at some point of time. It nevertheless runs fine currently. I think a bug report for this won't help much in this respect.)

Hartmut <hardy>
Sat 21 Apr 2018 07:46:45 PM UTC, comment #7: 

I don't think there's anything wrong with respect to the shadowing warning.

When you start octave with ./run-octave, it is passing the '--no-init-path' option and the '--path=$dirs' option. When Octave starts with no initial path (--no-init-path), then nothing will produce the shadowing warning.

Do you want to retitle and reuse this bug for making sure the image package does something to avoid the warning on the next release?

Mike Miller <mtmiller>
Group Member
Sat 21 Apr 2018 07:27:00 PM UTC, comment #6: 

Yes, that was the difference!

When I do the following:

  • cd /opt/octave-4.3.90/bin
  • ./octave --no-init-file
  • pkg load image
  • then I DO get the proper "shadows a core function" warning


There are several other Octave versions installed on my system. (Some older ones are een installed into my central bin folder.) If I skip the "." in the above start command, and only do "octave --no-init-file" in the 4.3.90 bin folder, then I start Octave 4.0.0 (!)for example.

What is the bottom line now? Is there something wrong? Or is only my linux PC too "messed up" with different Octave versions, so that it gets confused itself? Is there something we should fix in the current Octave (core) code?




Hartmut <hardy>
Sat 21 Apr 2018 06:54:03 PM UTC, comment #5: 

Oh, please try by running /opt/octave-4.3.90/bin/octave instead of ./run-octave. I think that makes a difference in how the load path is interpreted.

Mike Miller <mtmiller>
Group Member
Sat 21 Apr 2018 06:50:17 PM UTC, comment #4: 

What I have done is:

  • use Ubuntu 16.04 LTS, 64bit
  • use octave-4.3.90 (but 4.3.91 still behaves the same)
    • self compiled from the release tar-ball (no config or compile options at all, except for --prefix=/opt/octave-4.3.90 )
    • install via "make install" under /opt/octave-4.3.90
  • go to the above octave installation folder: "./run-octave --no-init-file" (CLI behaves the same as GUI)
    • uninstall image package "pkg uninstall image" (and verify all package files have really disappearded)
    • uninstall all other packages as well
    • exit Octave and restart Octave (--no-init-file again)
  • re-install image package from forge: "pkg install -forge image" (wait, see several compiler warnings...)
  • restart Octave again (same command as above, not using my octaverc file)
  • "pkg load image" -> still NO warning at all.


Wired, what is special about my linux system? Does anyone else sees this?  (It's probably hard to "see" something is missing, if you don't know it should be there...)

Hartmut <hardy>
Sat 21 Apr 2018 05:11:34 PM UTC, comment #3: 

I consistently get the warning message on Debian with Octave 4.3.90 and 4.3.91. If you are not getting the warning it seems like a local configuration difference on your system.

Do you have a ~/.octaverc that is disabling the Octave:shadowed-function warning?

Are you installing the image package with -forge or are you installing a tarball on your system that may not be the official release, dev snapshot?


[…compiler warnings…]
warning: function /…/image-2.6.2/rgb2gray.m shadows a core library function
For information about changes from previous versions of the image package, run 'news image'.
>> pkg load image
warning: function /…/image-2.6.2/rgb2gray.m shadows a core library function
warning: called from
    load_packages_and_dependencies at line 48 column 5
    load_packages at line 47 column 3
    pkg at line 456 column 7


Mike Miller <mtmiller>
Group Member
Sun 15 Apr 2018 06:12:27 AM UTC, comment #2: 

Octave 4.3.90 with (Ubuntu) linux: I have uninstalled and re-installed the image package. What I then get is a lot of "deprecated" messages during installation (compilation of some image package functions), but still no warning message after "pkg load image".

I assume the shadowing itself will be fixed in one of the next releases of the image package. But the missing warning message itself under (my ?) linux is what makes me suspicious.

Hartmut <hardy>
Sat 14 Apr 2018 11:07:59 PM UTC, comment #1: 

On Debian GNU/Linux I see the exact same behavior you are describing, so I don't see any system-dependent difference:


>> version
ans = 4.3.90
>> pkg load image
warning: function /.../image-2.6.2/rgb2gray.m shadows a core library function
warning: called from
    load_packages_and_dependencies at line 48 column 5
    load_packages at line 47 column 3
    pkg at line 456 column 7


Is this a bug or just the way the image package is working for now?

Mike Miller <mtmiller>
Group Member
Sat 14 Apr 2018 06:18:21 PM UTC, original submission:  

When I use Octave 4.3.90 and do "pkg load image" with the current image-2.6.2 package, then

  • I do NOT get any warning message under Linux. When doing "which rgb2gray" then the answer is that it would use rgb2gray from the image package. When I look in the octave folder "scripts/image" then I do see a second rgb2gray.m file there.
  • I DO get a warning message "rgb2gray.m shadows a core function" under Windows.


This seems odd to me, but I am unsure if this hints to a deeper problem. Shouldn't the same shadowing also happen under Linux? Shouldn't this provoke the same warning message under Linux, then?

Hartmut <hardy>

 

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

Attach Files:
   
   
Comment:
   

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

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-04-22 mtmiller StatusNeed Info Works For Me
        Open/ClosedOpen Closed
    2018-04-14 mtmiller CategoryNone Octave Package
        Severity3 - Normal 2 - Minor
        Priority5 - Normal 3 - Low
        Item GroupNone Unexpected Error or Warning
        StatusNone Need Info
        Summary&quot;rgb2gray.m shadows a core function&quot; only under Windows, not under Linux [octave forge] (image) "rgb2gray.m shadows a core function" only under Windows, not under Linux

    Back to the top

    Powered by Savane 3.13-cf05.
    Corresponding source code