including path containing "function rem() warning('off');" turns warning state off [was Re: mexWarnMsgTxt does not print warning message]
Alois Schlögl
alois.schloegl at tugraz.at
Thu Jun 25 08:34:21 CDT 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
John W. Eaton wrote:
> On 18-Jun-2009, Alois Schlögl wrote:
>
> | -----BEGIN PGP SIGNED MESSAGE-----
> | Hash: SHA1
> |
> | John W. Eaton wrote:
> | > On 15-Jun-2009, Alois Schlögl wrote:
> | >
> | > | -----BEGIN PGP SIGNED MESSAGE-----
> | > | Hash: SHA1
> | > |
> | > |
> | > | mexWarnMsgTxt does not display any warning message.
> | > |
> | > | This can be reproduced with the attached mex-file
> | > |
> | > |
> | > | With Matlab I get this:
> | > | >> mex test_mexWarnMsgTxt.cpp
> | > | >> test_mexWarnMsgTxt
> | > | Warning: that's a test warning message!
> | > | >>
> | > | >>
> | > |
> | > |
> | > | With Octave I get this:
> | > |
> | > | octave:14> mex test_mexWarnMsgTxt.cpp
> | > | octave:15> test_mexWarnMsgTxt
> | > | octave:16>
> | > | octave:16>
> | > |
> | > |
> | > | There is no error message. I tested this with a recent Version of Octave
> | > | 3.1.55 configured for x86_64-unknown-linux-gnu.
> | >
> | > I can't reproduce this problem.
> | >
> | > What does
> | >
> | > nm test_mexWarnMsgTxt.mex
> | >
> | > display on your system?
> | >
> | > jwe
> |
> |
> |
> | schloegl at bcipc038:~/matlab/NaN/src$ nm test_mexWarnMsgTxt.mex
> | 0000000000201018 d DW.ref.__gxx_personality_v0
> | 0000000000200d10 a _DYNAMIC
> | 0000000000200fe8 a _GLOBAL_OFFSET_TABLE_
> | w _Jv_RegisterClasses
> | 0000000000200cf0 d __CTOR_END__
> | 0000000000200ce8 d __CTOR_LIST__
> | 0000000000200d00 d __DTOR_END__
> | 0000000000200cf8 d __DTOR_LIST__
> | 00000000000007f8 r __FRAME_END__
> | 0000000000200d08 d __JCR_END__
> | 0000000000200d08 d __JCR_LIST__
> | 0000000000201020 A __bss_start
> | w __cxa_finalize@@GLIBC_2.2.5
> | 0000000000000740 t __do_global_ctors_aux
> | 0000000000000670 t __do_global_dtors_aux
> | 0000000000201010 d __dso_handle
> | w __gmon_start__
> | U __gxx_personality_v0@@CXXABI_1.3
> | 0000000000201020 A _edata
> | 0000000000201030 A _end
> | 0000000000000778 T _fini
> | 0000000000000608 T _init
> | 0000000000000650 t call_gmon_start
> | 0000000000201020 b completed.6997
> | 0000000000201028 b dtor_idx.6999
> | 00000000000006f0 t frame_dummy
> | 0000000000000730 T mexFunction
> | U mexWarnMsgTxt
>
> Since I can't reproduce the problem, I don't have much hope of finding
> why this is happening on your system. If you want to debug it, I
> suggest you run Octave under gdb and set a breakpoint in
> mexWarningMsgTxt and see what happens when it is called. Is it
> called? If it is, step into the call to Octave's warning function and
> see what happens there.
>
> jwe
Thanks, I did that and found, that the warning state was off. How stupid
of me - I should have checked this first. But I never turn off the
warning state. So, I tried to track the cause for the turned-off warning
state.
At first, it seems that warning was turned off if a specific path was
included
path('path-to-some-directory',path)
is added or not. I did not depend on the fact whether any function is
called or not, just the fact of including the path was sufficient to
turn off all warnings. This was strange.
Next, I tested which function was causing the problem. The minimum test
case is storing this function in /tmp/inst/rem.m
====== /tmp/inst/rem.m =====
function [] = rem(x,y)
warning('off');
====== end of /tmp/inst/rem.m =====
and include the path to /tmp/inst/, starting octave 3.1.55
$ octave --norc
octave:1> path(['/tmp/inst'],path);warning
ans =
{
identifier = all
state = off
}
has turned of all warnings, although there is no command turning
warnings off. This seems like a bug, because there is no command that
turns off warnings. (I hope this is reproducible. )
If the function is renamed (e.g. to rem2.m, mod.m, diff.m) or slightly
modified, e.g. like this:
====== /tmp/inst/rem.m =====
function [] = rem(x,y)
s = warning;
warning('off');
warning(s);
====== end of /tmp/inst/rem.m =====
or Octave3.0 is used, the warning state remains undefined, which is
correct.
$ octave --norc
octave:1> path(['/tmp/inst'],path);warning
warning: `fcn' undefined near line 52 column 47
warning: `fcn' undefined near line 52 column 47
warning: `fcn' undefined near line 52 column 47
warning: `fcn' undefined near line 52 column 47
ans =
{
1x19 struct array containing the fields:
identifier
state
}
I did not find any documentation, that says including a path in Octave
3.1.55 with a function named rem.m with the content
function [] = rem(x,y)
warning('off');
(rem.m that was never called) turns off all warnings.
Alois
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkpDfNoACgkQzSlbmAlvEIipowCfePMZZ4wA39qvS9L8bGLzHFZR
URcAniP6vxkIbysiZA6Eyu9FS2IMMNRg
=9H3W
-----END PGP SIGNATURE-----
More information about the Bug-octave
mailing list