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

 
 

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

Submitter:  None
Submitted:  Tue 25 Jun 2013 06:40:21 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Mario Kleiner Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.6.4
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group 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


mexErrMsgIdAndTxt ("fake_ID", "");


will work for testing.


(file #28419)

Rik <rik5>
Group 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>
Group Member
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>
Group Member
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 Files:
   
   
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
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by jordigh (Posted a comment)
  • -email is unavailable- added by None (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-06-26 rik5 StatusNeed Info Fixed
        Open/ClosedOpen Closed
    2013-06-25 rik5 Attached File- Added mexErr.cset, #28419
        StatusConfirmed Need Info
    2013-06-25 jordigh StatusNeed Info Confirmed
    2013-06-25 jordigh StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code