bugGNU Octave - Bugs: bug #47874, error/warning fail when only...

 
 

bug #47874: error/warning fail when only argument looks like an error/warning ID

Submitted by:  Robert Jenssen <morgawr>
Submitted on:  Sun 08 May 2016 03:11:49 AM UTC  
 
Category: Octave FunctionSeverity: 2 - Minor
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: InvalidAssigned to: None
Originator Name: Robert JenssenOpen/Closed: Closed
Release: devOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Sat 14 May 2016 03:20:01 AM UTC, comment #9:

I applied Lachlan's patch to make the error message a bit clearer (http://hg.savannah.gnu.org/hgweb/octave/rev/b766928062f5).

Since Octave is, indeed, Matlab compatible in producing an error I'm closing the report.

Rik <rik5>
Project Administrator
Sat 14 May 2016 12:52:19 AM UTC, comment #8:

Actually, I'll submit the patch even if it isn't acceptable :)

(file #37152)

Lachlan Andrew <lachlan>
Project Member
Sat 14 May 2016 12:27:10 AM UTC, comment #7:

How about just making the usage error more explicit. If the error message were

"error: call to error with identifier 'XX:YY' requires message"

then the end user would at least get the message that the programmer intended, as well as the programmer getting told to clean up their act.

I'm always puzzled why error messages don't display more readily-available information.

If that is acceptable, I'll write a patch soon.

Lachlan Andrew <lachlan>
Project Member
Tue 10 May 2016 06:01:28 PM UTC, comment #6:

Alright, so Octave is doing the right thing here. We could be a little more picky in what we accept as an error identifier, so maybe something like

would be allowed. But if you pass a single string that looks like it should be an identifier, then this is a valid usage error.

Anyone care to test whether Matlab accepts something like

as an error string? These should not be accepted as identifiers according to the help, so maybe Matlab just prints them as the message?

Mike Miller <mtmiller>
Project Administrator
Tue 10 May 2016 07:45:06 AM UTC, comment #5:

In Matlab:

Anonymous
Mon 09 May 2016 04:25:34 AM UTC, comment #4:

I believe that the current Octave behavior matches Matlab. Can someone please confirm?

John W. Eaton <jwe>
Project Administrator
Mon 09 May 2016 01:58:38 AM UTC, comment #3:

No, I'm afraid I don't have access to Matlab.

IMHO if calling error() with single string argument that contains a ":" causes an error message then that is a bug. The problem arose when I tried to show a vector range in an error message.

Robert Jenssen <morgawr>
Sun 08 May 2016 03:45:27 PM UTC, comment #2:

Confirmed here, but not sure what the right behavior should be.

Do you have Matlab to test what it does in this scenario? The error/warning ID parsing is meant to be Matlab compatible.

Also note that you can easily work around this by including spaces or other characters that are forbidden in an error/warning identifier.

It could be argued that calling error or warning with a string that is actually meant to be an identifier and missing the message is an error, which is what is reported now.

Mike Miller <mtmiller>
Project Administrator
Sun 08 May 2016 03:22:48 AM UTC, comment #1:

Sorry if this report was a bit cryptic. The "doc" for error() has:

I read this to mean that error should only assume that the first string is an error ID if that string contains a ":" AND there are two string arguments.

Robert Jenssen <morgawr>
Sun 08 May 2016 03:11:49 AM UTC, original submission:
Robert Jenssen <morgawr>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #37152:  bug_47874_err_id.cset added by lachlan (864B - text/x-diff)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by lachlan (Posted a comment)
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by morgawr (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 10 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 14 May 2016 03:20:01 AM UTCrik5StatusPatch Submitted=>Invalid
      Open/ClosedOpen=>Closed
    Sat 14 May 2016 12:52:19 AM UTClachlanAttached File-=>Added bug_47874_err_id.cset, #37152
      StatusNeed Info=>Patch Submitted
    Sun 08 May 2016 03:45:27 PM UTCmtmillerSeverity3 - Normal=>2 - Minor
      Item GroupNone=>Matlab Compatibility
      StatusNone=>Need Info
      Release4.0.2=>dev
      Operating SystemGNU/Linux=>Any
      Summaryerror() fails when string contains a colon =>error/warning fail when only argument looks like an error/warning ID

    Back to the top


    Powered by Savane 3.1-cleanup1