bugGNU Octave - Bugs: bug #39343, mexErrMsgTxt("") does...

 
 

bug #39343: mexErrMsgTxt("") does not abort execution of script.

Submitted by:  None
Submitted on:  Tue 25 Jun 2013 06:40:21 PM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: FixedAssigned to: None
Originator Name: Mario KleinerOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 3.6.4
Operating 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)

Wed 26 Jun 2013 01:46:05 AM UTC, comment #6:

I pushed the changeset. The fix is available on the development branch of Octave which you can access with Mercurial. Otherwise, it will be a part of the next major release of Octave (3.8).

Rik <rik5>
Project Administrator
Tue 25 Jun 2013 08:09:59 PM UTC, comment #5:

I'm only using mexErrMsgTxt() in my code, because we used to support back to Matlab V5, but nowadays i only test on R2007a and R2012a, targetting R2007a as minimum release.

Here's R2012a output:

With:

mexErrMsgIdAndTxt ("fake_ID", "");

Error using MexTest
The error message identifier is invalid.

With:

mexErrMsgIdAndTxt ("TEST:test:FakeMsgId", "");

Error using MexTest

With:

mexErrMsgIdAndTxt ("TEST:test:FakeMsgId", "Oops!");

Error using MexTest
Oops!

Anonymous
Tue 25 Jun 2013 07:23:07 PM UTC, comment #4:

This is pretty easy to fix if we want to. I've attached a changeset that appears to do it.

What version of Matlab (and hence what version of the mex interface) is the reporter using?

I also changed the function mexErrMsgIdAndTxt so that if it is called with an empty second argument then an error will be generated. Could the reporter verify that this is what Matlab does as well?

Something like

will work for testing.

(file #28419)

Rik <rik5>
Project Administrator
Tue 25 Jun 2013 07:03:12 PM UTC, comment #3:

It could be a bug in ancient Matlab that they just never could fix because it's so entrenched (e.g. like braind-dead short-circuiting).

At any rate, their documentation seems to suggest that this bug is intentional or here to stay.

Can you prepare a patch for Octave?

Jordi GutiƩrrez Hermoso <jordigh>
Project Administrator
Tue 25 Jun 2013 06:58:06 PM UTC, comment #2:

The mexErrMsgTxt() docu doesn't say anything about special treatment for empty strings, so in that sense i expect it to treat an empty string just as any other string. The current docu for the error() function otoh. explicitely states that "... If msgString is an empty string, the error command has no effect. ...", so the difference between mex and m file api seems to be intentional.

I can also confirm from testing that Matlab's mexErrMsgTxt() function behaves like that since at least ancient Matlab V5.

That said, i seldomly pass an empty error string, which is why i only managed to track down some weirdness in some corner case now, despite my toolkit being ported to ocatve since multiple years, so maybe it would be enough to document the difference?

Anonymous
Tue 25 Jun 2013 06:46:30 PM UTC, comment #1:

This appears to be a Matlab bug, since the mex interface differs from the m-file interface.

Can you confirm that TMW made this intentionally (e.g. is it documented?)

While we sometimes chase after Matlab bugs and duplicate them in Octave, we prefer to avoid doing this whenever possible.

Jordi GutiƩrrez Hermoso <jordigh>
Project Administrator
Tue 25 Jun 2013 06:40:21 PM UTC, original submission:

In the current stable octave version, the mex c-api function mexErrMsgTxt("") does not return control to the command prompt, as it should if an empty zero-terminated string "" is passed as argument.

This differs from Matlab's behaviour, where the same call aborts the mex file, printing an empty error message.

The original bug report #39271 was closed because the same behaviour for the error('') function is consistent with Matlab's behaviour. However, this is not true for the mex api.

The problem is easy to work around in my code, and therefore not really important to me, but i thought i'll file a bug report anyway to the benefit of other toolkits porting to octave.

Thanks,
-mario

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #28419:  mexErr.cset added by rik5 (1KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Updated the item)
  • -unavailable- added by jordigh (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 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 26 Jun 2013 01:46:05 AM UTCrik5StatusNeed Info=>Fixed
      Open/ClosedOpen=>Closed
    Tue 25 Jun 2013 07:23:07 PM UTCrik5Attached File-=>Added mexErr.cset, #28419
      StatusConfirmed=>Need Info
    Tue 25 Jun 2013 07:03:12 PM UTCjordighStatusNeed Info=>Confirmed
    Tue 25 Jun 2013 06:46:30 PM UTCjordighStatusNone=>Need Info

    Back to the top


    Powered by Savane 3.1-cleanup1