bugGNU Octave - Bugs: bug #53587, Disabling an invalid warning ID...

 
 

bug #53587: Disabling an invalid warning ID should give an error

Submitter:  Marco Caliari <caliari>
Submitted:  Mon 09 Apr 2018 06:46:22 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Missed Error or Warning
Status:  Confirmed 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

Wed 11 Apr 2018 08:17:56 PM UTC, comment #7: 

@jwe: We're in the same boat.  I thought it would be easy so I took a look, and then was overwhelmed by the input parsing.

Rik <rik5>
Group administrator
Wed 11 Apr 2018 08:05:00 PM UTC, comment #6: 

Rik, I tried to do that earlier today.  Writing a separate function to do the the check is easy enough, as there is already a conditional statement that does it.  But where to place it is more complicated because the logic for decoding the arguments to the warning function is fairly complicated.  I eventually gave up.

John W. Eaton <jwe>
Group administrator
Wed 11 Apr 2018 07:03:47 PM UTC, comment #5: 

I took a look at error.cc.  Unfortunately, there are several places where the warning ID is used.  Probably the best thing is to write a short subroutine to validate warning IDs so that the code is all in one place, and then call validate_ID from everywhere that is required in error.cc.

Rik <rik5>
Group administrator
Mon 09 Apr 2018 03:27:34 PM UTC, comment #4: 

We can't know the ilst of possible warnings.  Packages are free to define their own IDs, and so are users.  All we can determine in core Octave is whether the ID has the correct form.

Rik <rik5>
Group administrator
Mon 09 Apr 2018 08:05:15 AM UTC, comment #3: 

Agreed, a colon is mandatory in Matlab, and Octave also uses that as one of the requirements to determine if the first argument is a warning ID or just a warning string:

libinterp/corefcn/error.cc:1087

      // For compatibility with Matlab, an identifier must contain ':',
      // but not at the beginning or the end, and it must not contain '%'
      // (even if it is not a valid conversion operator) or whitespace.


So that logic might as well be applied to the warning ID passed to warning on/off/query/error.

Mike Miller <mtmiller>
Group Member
Mon 09 Apr 2018 07:55:33 AM UTC, comment #2: 

For reference with Matlab R2016a:

>> warning ('off', 'undefinedID')
Error using warning
Unknown setting or incorrect message identifier 'undefinedID'.

>> warning ('off', 'test:undefinedID')
>> warning ('off', 'test:undefined ID')
Error using warning
Unknown setting or incorrect message identifier 'test:undefined ID'.


So a colon seems to be obligatory. I don't know whether we impose the same restriction in Octave.

Markus Mützel <mmuetzel>
Group administrator
Mon 09 Apr 2018 07:05:20 AM UTC, comment #1: 

Do you mean invalid rather than an undefined warning ID? What are defined warning IDs? Doesn't that imply some kind of central registration point for all warning IDs? The way I understand it, any user function can define any arbitrary warning ID.

We could raise an error for some invalid warning identifier, for example


>> warning off 1234
error: warning: '1234' is not a valid warning identifier


Mike Miller <mtmiller>
Group Member
Mon 09 Apr 2018 06:46:22 AM UTC, original submission:  

If you try something like


warning ("off", "undefined ID")


you get no error, while it should be reasonable (and it would be a compatible behavior) to get it.

Marco Caliari <caliari>
Group Member

 

(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 jwe (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by caliari (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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-04-09 mtmiller StatusNeed Info Confirmed
    2018-04-09 caliari SummaryDisabling an undefined warning ID should give an error Disabling an invalid warning ID should give an error
    2018-04-09 mtmiller StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code