MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Serious bug in MatchQ causes crashes and incorrect results

  • To: mathgroup at
  • Subject: [mg28213] Re: Serious bug in MatchQ causes crashes and incorrect results
  • From: Jens-Peer Kuska <kuska at>
  • Date: Thu, 5 Apr 2001 03:00:28 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <9aem2g$>
  • Sender: owner-wri-mathgroup at


you call Abort[] and you are wondering *why* the system crash.
Whow ... I have a similar problem on my PC, every time I press
the key with the "Reset" label to terminate a program the 
computer reboots and all my data are lost.

Abort[] kill your full computation in a very hard way, you should
use something like Break[] or Return[] to hinder the Kernel
to continue its computation. In harder cases you may try a
Catch[]/Throw[]  pair. But never, *never*, NEVER,  N_E_V_E_R
use Abort[]

Since Abort[] is so brutal it is very likely that a wonderfull
stable system like MacOS crashes ...

BTW: I expect that the whole function is nonsense because FileNames[]
*can* only return a list of strings or an empty list, both should match
{_String...}. So it is useless to test it. And it always better and more
clear to have a rules



Jeff DuMonthier wrote:
> I recently posted a question in this group asking how I could do complex
> pattern matching and default arguments in function (delayed set)
> definitions.  The best way seemed to be to use the argument list
> definition for the defaults and MatchQ in the body to check arguments.
> This is an example of what I was doing:
> getFile[dirs_:{},file_]:=Module[{ vars... },
> If[! MatchQ[dirs,{_String...}], Message[getFile::err1];Abort[] ];
> ...
> ];
> Although my test cases worked, when I tried to actually use the code I
> encountered serious problems.
> Running version 4.0.1 for Macintosh (OS 9.1) I started experiencing
> frequent system crashes (freezing).  Usually this would occur while one
> of these functions was being executed.  Once it froze when closing the
> help browser.   I edited just the MatchQ expressions out of the code and
> it ran with no problems.
> Running version 3.0 under Solaris the MatchQ conditions did not always
> return the correct results.  For example, the code fragment above would
> usually but not always abort on the check shown, even when the first
> argument was a list containing one or more strings, i.e. {"aaa"}.
> This is the first case I have found (without using Mathlink) where
> Mathematica crashes or returns erroneous and inconsistent results rather
> than cryptic error messages.
>                                                                    -Jeff
> DuMonthier

  • Prev by Date: Re: complex coefficients and rules...
  • Next by Date: Re: norm symbol
  • Previous by thread: Serious bug in MatchQ causes crashes and incorrect results
  • Next by thread: Re: Serious bug in MatchQ causes crashes and incorrect results