bugGNU Octave - Bugs: bug #41028, warning off shouldn't affect...

 
 

bug #41028: warning off shouldn't affect lastwarn

Submitter:  Felipe G. Nievinski <fgnievinski>
Submitted:  Sun 29 Dec 2013 07:38:18 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Patch Submitted Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 28 Jul 2022 03:56:57 PM UTC, comment #8: 

Cross-linking related Bug #62829.

Arun Giridhar <arungiridhar>
Group Member
Tue 23 Jun 2020 04:35:19 PM UTC, comment #7: 

I updated the patch again (attached).

But this change causes a number of failures with the test suite because we expect to be able to check lastwarn but now can instead get the wrong info if there are disabled warnings (like for Octave language extensions) that happen between the code for the test case and our attempt to grab the last warning info.  So some other chages will be needed to handle that before we can apply this patch.

(file #49356)

John W. Eaton <jwe>
Group administrator
Fri 04 Dec 2015 01:40:19 AM UTC, comment #6: 

I have freshened the patch.

One caveat with changing the behaviour of "warning off" is that there are many warnings that are off by default but are thrown by core code like "help".

An alternative to this patch is simply to rename "quiet" to "off" and to rename "off" to something like "nothing".  That keeps Matlab compatibility and the current flexibility.

I have two related gripes.  Please let me know if they should be separate bug reports:

1) Is there a comand to reset the warning status to the original setting, with a dozen or so warnings "off"?  If not, I think there should be.

2) The documentation should not recommend "warning(error)", because it breaks commands like "help", without which it is hard to find out how to fix it.  I propose adding the keyword "active" as an alternative for "all", but that does not affect warnings that are off, and making that the default set of warnings when none is specified.

I'm happy to write patches for these if they are approved of.

(file #35639)

Lachlan Andrew <lachlan>
Mon 29 Dec 2014 04:19:44 AM UTC, comment #5: 

@jwe: The patch you submitted for warning is now almost exactly 1 year old.  Should it be committed and this bug closed?

Rik <rik5>
Group administrator
Mon 30 Dec 2013 10:00:37 PM UTC, comment #4: 

I'm okay with ditching warning quiet but warning on|off should be retained, to chose whether the message is displayed or not.

Felipe G. Nievinski <fgnievinski>
Mon 30 Dec 2013 09:47:40 PM UTC, comment #3: 

I think I would prefer something like the attached patch.

It seems to me that the "warning on|off|query quiet" feature is not needed if the warning id and message are still set when warning is "off".  I'm inclined to deprecate this feature and remove it in the future.  I don't think that it was ever documented, so maybe we could just remove it.


(file #30136)

John W. Eaton <jwe>
Group administrator
Mon 30 Dec 2013 08:00:34 PM UTC, comment #2: 

unfortunately the undocumented feature "warning quiet" wouldn't help with matlab compatibility, when a user wishes to check lastwarn.

I've submitting a tentative patch; could you please let me know if it's in the right direction or not.


(file #30134)

Felipe G. Nievinski <fgnievinski>
Mon 30 Dec 2013 05:00:31 PM UTC, comment #1: 

Have you tried "warning on quiet"? That will suppress the display of warnings but still record them in the background.


octave:1> lastwarn
ans =
octave:2> warning query quiet
ans =
  scalar structure containing the fields:
    identifier = quiet
    state = off
octave:3> warning on quiet
octave:4> warning query quiet
ans =
  scalar structure containing the fields:
    identifier = quiet
    state = on
octave:5> 1/0
ans = Inf
octave:6> lastwarn
ans = warning: division by zero


Arun Giridhar <arungiridhar>
Group Member
Sun 29 Dec 2013 07:38:18 PM UTC, original submission:  

contrast:

>> warning("on", "Octave:singular-matrix-div");  lastwarn("", "")
>> ones(2)  [1;1];  [msg, id] = lastwarn ()

warning: matrix singular to machine precision, rcond = 0
msg = warning: matrix singular to machine precision, rcond = 0
id = Octave:singular-matrix-div

to:

>> warning("off", "Octave:singular-matrix-div");  lastwarn("", "")
>> ones(2)  [1;1];  [msg, id] = lastwarn ()

{no warning displayed}
msg =
id =

it should do instead:

>> warning("off", "Octave:singular-matrix-div");  lastwarn("", "")
>> ones(2)  [1;1];  [msg, id] = lastwarn ()

{no warning displayed}
msg = warning: matrix singular to machine precision, rcond = 0
id = Octave:singular-matrix-div

Felipe G. Nievinski <fgnievinski>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #49356:  bug-41028.txt added by jwe (2KiB - text/plain)
file #30136:  diffs.txt added by jwe (3KiB - text/plain)
file #30134:  lastwarn.diff added by fgnievinski (873B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by lachlan (Updated the item)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mtmiller (Updated the item)
  • -email is unavailable- added by jwe (Updated the item)
  • -email is unavailable- added by arungiridhar (Posted a comment)
  • -email is unavailable- added by fgnievinski (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 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-06-23 jwe Attached File- Added bug-41028.txt, #49356
        Assigned tolachlan None
    2016-03-31 mtmiller Release3.6.4 dev
        Operating SystemMicrosoft Windows Any
    2016-02-26 rik5 Assigned toNone lachlan
    2015-12-04 lachlan Attached File- Added bug_41028-warn-quiet-freshened.txt, #35639
    2014-01-19 mtmiller CategoryNone Octave Function
        StatusNone Patch Submitted
    2013-12-30 jwe Attached File- Added diffs.txt, #30136
    2013-12-30 fgnievinski Attached File- Added lastwarn.diff, #30134

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code