including path containing "function rem() warning('off');" turns warning state off [was Re: mexWarnMsgTxt does not print warning message]
John W. Eaton
jwe at octave.org
Thu Jun 25 10:14:31 CDT 2009
On 25-Jun-2009, Alois Schlögl wrote:
| 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.
I can't duplicate this problem with 3.2.0, 3.0.5, or the current
sources. I would try setting a breakpoint in Fwarning and see where
it is called to change the state.
jwe
More information about the Bug-octave
mailing list