bugGNU Octave - Bugs: bug #37623, MinGW: Crash on incorrect syntax...


bug #37623: MinGW: Crash on incorrect syntax on Windows 8

Submitted by:  None
Submitted on:  Wed Oct 24 02:28:17 2012  
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Crash
Status: FixedAssigned to: John Donoghue <lostbard>
Originator Name: GeorgeOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 3.6.1
Operating System: Microsoft Windows

Add a New Comment (Rich MarkupRich 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)

Tue Jan 6 17:59:41 2015, comment #28:

Closing as fixed

John Donoghue <lostbard>
Project MemberIn charge of this item.
Tue Aug 19 13:36:48 2014, comment #27:

Pushed patch to mxe-octave: http://hg.octave.org/mxe-octave/rev/1e623b4ce67b

John Donoghue <lostbard>
Project MemberIn charge of this item.
Sat Aug 16 02:43:56 2014, comment #26:

Patch for mxe-octave - if anyone can verify it fixes the issues with win8.

(file #31909)

John Donoghue <lostbard>
Project MemberIn charge of this item.
Tue Aug 12 19:56:40 2014, comment #25:

3.8.2-rc2 patch attached to use modified IsConsoleHandle in libgnu isatty.

(file #31894)

John Donoghue <lostbard>
Project MemberIn charge of this item.
Mon Jan 27 22:46:09 2014, comment #24:

AFAIK the problem is still present in 3.8. See [1]. The bug lies in gnulib.

[1] http://octave.1599824.n4.nabble.com/How-to-open-octave-3-8-GUI-td4661215.html

Michael Goffioul <goffioul>
Project Member
Mon Jan 27 22:13:02 2014, comment #23:

> i just installed octave 3.6.4 for windows

We are not maintaining that version anymore. Can you try with 3.8?

Jordi GutiƩrrez Hermoso <jordigh>
Project Administrator
Mon Jan 27 21:54:42 2014, comment #22:

hello this is still an issue, i just installed octave 3.6.4 for windows (the visual studio version) on windows 8 and incorrect syntax causes crash. on the other hand the -i extension to the target sorts this issue (and also brings back the prompt). clearly would be better if the installer defaulted the target to interactive mode etc so we don't all spend 15 mins googling this solution! :)

Iain Leverett <pavlev>
Sun Jan 19 20:40:51 2014, comment #21:

Windows 8 is the platform where the issue was found.
I don't have Win 8 anymore, so I can't check myself.

Adapted the title to include "Windows 8".

Philip Nienhuis <philipnienhuis>
Project Member
Sun Jan 19 19:36:02 2014, comment #20:

I do not see this issue running an MXE build of Octave 3.8.0 (MinGW-based) on Windows XP. Is this now fixed or no longer a problem?

Mike Miller <mtmiller>
Project Administrator
Sat Aug 17 09:53:33 2013, comment #19:

I just saw this discussion and I have the same problem. Octave closes after every syntax error and it doesn't plot. I'm using Octave 3.6.4 on Windows 8.

I've tried solving the closing on syntax error by adding -i to the shortcut path. E.g. the shortcut points to "C:\Octave\Octave3.6.2_gcc4.6.2\bin\octave.exe -i". But I am unable to change the shortcuts path because the name is not specified in the Target box. And I can't rename the original file 'cause it would change the extension. So I'm puzzled to how that is supposed to work.

There is also a suggestion that may solve the plot issue:
"Adding the --line-editing flag did fix the plot issue."
But I don't know what that means, so I haven't tried it. Or is there some other way?

I'm not so computer wise to understand most of the other suggestions. But if someone can help I would appreciate it.

Thank you.

Duje Roje <duje>
Thu Jan 3 01:57:13 2013, comment #18:

Michael, sorry for the delay, I got caught up in the holidays. Hope yours were well.

Here's the output run normally :

isatty (stdin): 64
IsConsoleHandle (stdin): 0
IsConsoleHandle2 (stdin): 1
ISATTY (stdin): 0
isatty (stdout): 64
IsConsoleHandle (stdout): 0
IsConsoleHandle2 (stdout): 1
ISATTY (stdout): 0

and the output as test.tty <NUL :

isatty (stdin): 64
IsConsoleHandle (stdin): 0
IsConsoleHandle2 (stdin): 0
ISATTY (stdin): 0
isatty (stdout): 64
IsConsoleHandle (stdout): 0
IsConsoleHandle2 (stdout): 1
ISATTY (stdout): 0

Tyler <ty36>
Sun Dec 23 20:46:49 2012, comment #17:

Tyler, would you be able to test this new program? Please run it normally, then run it as:

test-tty.exe <NUL

in a windows command prompt.

(file #27146)

Michael Goffioul <goffioul>
Project Member
Fri Dec 21 00:08:23 2012, comment #16:

Thanks. So it definitely looks like a bug in gnulib (as I suspected, the assumption of the IsConsoleHandler macro is not valid anymore). I've reported it to the gnulib mailing list [1].

[1] http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00092.html

Michael Goffioul <goffioul>
Project Member
Thu Dec 20 23:46:18 2012, comment #15:

This is the result after compiling and running the test code:

isatty (stdin): 64
IsConsoleHandle (stdin): 0
isatty (stdout): 64
IsConsoleHandle (stdout): 0

Tyler <ty36>
Thu Dec 20 16:13:15 2012, comment #14:

All these results are consistent and point in the direction of failure to detect stdin/stdout as TTY.

When interactive and line-editing flags are not set, an error will make octave to exit, and octave will not use readline internally. The readline REPL is used differently by the FLTK and Qt backends:
- FLTK runs the GUI event loop synchronously with octave, events are processed during idle time in the readline REPL; no readline == no GUI events being processed
- Qt runs the GUI event loop in a separate thread, but uses the readline REPL when it needs to run some piece of code synchronously with octave, for instance to run callbacks, e.g. when closing a window; no readline => no callbacks being processed and windows do not close

So the issue is that gnulib::isatty() fails on stdin and/or stdout on Windows 8. I've attached a small test program. Would you be able to compile and run it on Windows 8? If you installed the MinGW version of octave, you should have everything you need to compile that problem (as it comes bundled with a compiler). To compile with gcc, use the command:

gcc -O2 -o test-tty.exe test-tty.c

To compile with Visual Studio, use this instead:

cl -O2 -MD -Fetest-tty.exe test-tty.c

For reference, the test program on a WinXP 32 bits gives:

isatty (stdin): 64
IsConsoleHandle (stdin): 1
isatty (stdout): 64
IsConsoleHandle (stdout): 1

The "IsConsoleHandle()" macro is a gnulib trick that is based on a strong assumption [1], which may not be valid anymore on Windows 8.

[1] http://lists.gnu.org/archive/html/bug-gnulib/2009-08/msg00065.html

Michael Goffioul <goffioul>
Project Member
Wed Dec 19 04:19:00 2012, comment #13:

edit: all toolkits seem to work correctly with the --line-editing flag added

Tyler <ty36>
Wed Dec 19 04:17:42 2012, comment #12:

Ok I tried the VS2010 version and came to these conclusions:

*The -i flag still needs to be added
*The gnuplot graphics toolkit seems to work with no further flags
(I also went back and this is the same for the mingw32 build)
*The qt graphics toolkit plots but will not close when you click the 'X'.
*The fltk toolkit still hangs when you plot in the VS2010 build
*Both the fltk and gnuplot toolkit seem to work correctly when the --line-editing flag is also added

Not sure if this is related but the only difference I noticed between the mingw32 and VS2010 build was that the terminal launched by the shortcut in the mingw32 had a white background as compared to the traditional command prompt style terminal with black background.

Tyler <ty36>
Wed Dec 19 02:14:12 2012, comment #11:

This is weird, these flags are normally not needed when octave detects that stdin/stdout are attached to an interactive terminal, that is: isatty(...) returns true.

This may mean that either the implementation of isatty has changed in the Windows 8 Win32 API and/or that the gnulib replacement is incompatible with Windows 8.

It would be interesting to know whether the VS2010 version behaves the same or not. Could you give it a try? (both can be installed at the same time).

Michael Goffioul <goffioul>
Project Member
Wed Dec 19 01:58:37 2012, comment #10:

Cool thanks. Adding the --line-editing flag did fix the plot issue.

I'm not sure about the VS2010 build. I have not tried that one.

Tyler <ty36>
Wed Dec 19 00:43:47 2012, comment #9:

Does using also the flag --line-editing helps for the plot issue?

Does the VS2010 build show the same behavior (problem and workaround)?

Michael Goffioul <goffioul>
Project Member
Wed Dec 19 00:17:53 2012, comment #8:

I had the same problems with Octave and Windows 8. I was able to keep Octave from closing on syntax error by adding -i to the shortcut to force interactive mode. E.g. the shortcut points to "C:\Octave\Octave3.6.2_gcc4.6.2\bin\octave.exe -i".

I haven't been able to get the plot to work correctly though

Tyler <ty36>
Fri Oct 26 14:11:11 2012, comment #7:

Too bad it wasn't the libblas (or maybe it's good)

As an alternative you could try the 3.6.2 MinGW binary, or the 3.6.2 MSVC2010 binary, both can be grabbed from sourceforge.

Philip Nienhuis <philipnienhuis>
Project Member
Fri Oct 26 00:52:52 2012, comment #6:

Ops, that was dumb. I got 3.4.3 working, and 3.6.1 is correct for the one that's not working.

George <genrommel>
Thu Oct 25 22:29:36 2012, comment #5:

Oh, the Release version is actually 4.6.2, sorry about that.

I tried all of the libblas.dll s, none of them worked, not even libblas.dll.ref. No, there is no space in the install directory. I don't think it's hardware because it runs on the same computer on Windows 7, but not on Windows 8.

After some more testing, I found that it also won't plot anything.
It doesn't crash, it just does nothing when I try to plot. (gnu plot is installed and runs fine.)


Then nothing.

However, I tried installing an older version (gcc 4.5.2, also mingw32), and that works fine. So I guess I can just not be updated.

George <genrommel>
Thu Oct 25 21:25:53 2012, comment #4:

Added "MinGW" to bug report title/summary

Philip Nienhuis <philipnienhuis>
Project Member
Thu Oct 25 21:21:47 2012, comment #3:

You didn't install Octave in a directory path containing spaces, did you? (like "C:\Program Files(x86)" ) because that is a receipe for trouble.

Another possibility is that this is another manifestation of the notorious libblas versions issue with the MinGW builds.
This is known to turn up in completely unexpected and unpredictable places and usually it's in no way related to the actual error message (if any).
Have a look at bug #37231 and bug #35769.
I had the impression this was hardware (architecture)-dependent but I wouldn't be surprised if SW-platform (operating system level) may be involved as well.

What you can do to find a reliable libblas.dll:

In <OCTAVE_INSTALL_DIR>/bin there should be various versions of libblas..........dll.
Please backup the file libblas.dll and then, for each libblas......dll in turn, rename it to libblas.dll, restart Octave and try again.

In my case the Octave command:
demo plotyy
used to trigger crashes reliably.

Philip Nienhuis <philipnienhuis>
Project Member
Wed Oct 24 16:31:26 2012, comment #2:

It's mingw32.

George <genrommel>
Wed Oct 24 13:45:41 2012, comment #1:

Which Windows build are you using, or did you compile Octave yourself?

Jordi GutiƩrrez Hermoso <jordigh>
Project Administrator
Wed Oct 24 02:28:17 2012, original submission:

When incorrect syntax or inapplicable operation applied, Octave crashes. I believe this is a compatibility issue with Windows 8. I am dual booted with Windows 7 and Octave runs fine in Windows 7. It was originally installed in Windows 8 (64 bit).

When an error is encountered, octave prints the usual syntax error message then immediately exits.

Some examples of code that cause the crash:




There is no error dialog box, only the "parse error: syntax error >>> x=[1)

Then octave exits.



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

Attach File(s):

Attached Files
file #31909:  win8-term.patch added by lostbard (7kB - text/x-patch)
file #31894:  octave-1-gnulib-isatty.patch added by lostbard (1kB - application/octet-stream)
file #27146:  test-tty.c added by goffioul (1kB - text/x-csrc - Modified test program)
file #27129:  test-tty.c added by goffioul (488B - text/plain - Test program for TTY under Windows)


Depends on the following items: None found

   bug dependencies.


Carbon-Copy List
  • -unavailable- added by lostbard (Updated the item)
  • -unavailable- added by pavlev (Posted a comment)
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by duje (Posted a comment)
  • -unavailable- added by svillemot
  • -unavailable- added by goffioul (Posted a comment)
  • -unavailable- added by ty36 (Posted a comment)
  • -unavailable- added by philipnienhuis (Posted a comment)
  • -unavailable- added by genrommel (Posted a comment)
  • -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 15 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed Jan 7 02:39:33 2015lostbardOpen/ClosedOpen=>Closed
    Tue Jan 6 17:59:41 2015lostbardStatusNeed Info=>Fixed
      Assigned toNone=>lostbard
    Sat Aug 16 02:43:56 2014lostbardAttached File-=>Added win8-term.patch, #31909
    Tue Aug 12 19:56:40 2014lostbardAttached File-=>Added octave-1-gnulib-isatty.patch, #31894
    Tue Aug 12 14:05:28 2014jordighDependencies-=>bugs #42967 is dependent
    Thu Mar 27 04:57:04 2014mtmillerDependencies-=>bugs #41451 is dependent
    Thu Mar 27 04:55:22 2014mtmillerDependencies-=>bugs #40473 is dependent
    Sun Jan 19 20:40:51 2014philipnienhuisSummaryMinGW: Crash on incorrect syntax=>MinGW: Crash on incorrect syntax on Windows 8
    Sun Jan 19 19:36:02 2014mtmillerCategoryNone=>Interpreter
    Fri Mar 29 09:20:32 2013svillemotCarbon-Copy-=>Added svillemot
    Sun Dec 23 20:46:49 2012goffioulAttached File-=>Added test-tty.c, #27146
    Thu Dec 20 16:19:26 2012goffioulAttached File-=>Added test-tty.c, #27129
    Thu Oct 25 21:25:53 2012philipnienhuisSummaryCrash on incorrect syntax=>MinGW: Crash on incorrect syntax
    Wed Oct 24 13:45:41 2012jordighStatusNone=>Need Info

    Back to the top

    Powered by Savane 3.1-cleanup