bugGNU Octave - Bugs: bug #39271, error('') does not abort execution...

 
 

bug #39271: error('') does not abort execution of script.

Submitted by:  None
Submitted on:  Mon 17 Jun 2013 06:39:37 PM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: InvalidAssigned to: None
Originator Name: Mario KleinerOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 3.6.1
Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Tue 18 Jun 2013 06:11:43 PM UTC, comment #4:

I added a note to the documentation string for error() specifically pointing out that a null string will be treated as a NOP (http://hg.savannah.gnu.org/hgweb/octave/rev/2b86cb4e172b). This might help a little bit for future users.

Rik <rik5>
Project Administrator
Tue 18 Jun 2013 01:32:24 PM UTC, comment #3:

Ok, i just checked with R2012a. You are right that error('') will do nothing, just as octave. The "help error" for Matlab says error() should be a no-op in case of an empty struct passed, but doesn't say what should happen in case of an empty string.

However, the behaviour of the mex api function mexErrMsgTxt("") differs in case of the 0-terminated empty string. On Matlab, it will abort the mex function and just "print" the empty error string, ie., nothing. On Octave, execution continues. This is how i found the difference, because the error handling of some of our mex files behaved weird in our octave port. I've worked around this by passing a non-empty error string.

Should i file a new bug report, only referring to mex api anomalies?

Thanks,
-mario

Anonymous
Tue 18 Jun 2013 01:19:14 PM UTC, comment #2:

We have to keep this stupid behaviour. It's what Matlab does. Sorry.

Jordi GutiƩrrez Hermoso <jordigh>
Project Administrator
Tue 18 Jun 2013 03:47:18 AM UTC, comment #1:

For consistency, how does Matlab handle a null argument to error()?

Rik <rik5>
Project Administrator
Mon 17 Jun 2013 06:39:37 PM UTC, original submission:

Hi,

in the current stable Octave 3.6.x, the error() function, when invoked with an empty error string '', and also mexErrMsgTxt("") from the C mex api with an empty string, do not return control to the command prompt, as they should. E.g.:

Would result in output:

x = 1
x = 2

instead of aborting with an error after x = 1. error() with a non-empty string behaves as expected. This was tested on Octave 3.6.

Best,
-mario

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jordigh (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by None (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 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 18 Jun 2013 01:19:14 PM UTCjordighItem GroupIncorrect Result=>Matlab Compatibility
      StatusNone=>Invalid
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1