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

 
 

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

Submitter:  None
Submitted:  Wed 24 Oct 2012 02:28:17 AM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  lostbard
Originator Name:  George Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.6.1
Operating System:  * Microsoft Windows Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 06 Jan 2015 05:59:41 PM UTC, comment #28: 

Closing as fixed

John Donoghue <lostbard>
Group Member
Tue 19 Aug 2014 01:36:48 PM UTC, comment #27: 
John Donoghue <lostbard>
Group Member
Sat 16 Aug 2014 02:43:56 AM UTC, comment #26: 

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


(file #31909)

John Donoghue <lostbard>
Group Member
Tue 12 Aug 2014 07:56:40 PM UTC, comment #25: 

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

(file #31894)

John Donoghue <lostbard>
Group Member
Mon 27 Jan 2014 10:46:09 PM UTC, 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>
Mon 27 Jan 2014 10:13:02 PM UTC, 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>
Group Member
Mon 27 Jan 2014 09:54:42 PM UTC, 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 19 Jan 2014 08:40:51 PM UTC, comment #21: 

@Mike:
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>
Group Member
Sun 19 Jan 2014 07:36:02 PM UTC, 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>
Group Member
Sat 17 Aug 2013 09:53:33 AM UTC, comment #19: 

Hi,
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 03 Jan 2013 01:57:13 AM UTC, 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 23 Dec 2012 08:46:49 PM UTC, 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>
Fri 21 Dec 2012 12:08:23 AM UTC, 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>
Thu 20 Dec 2012 11:46:18 PM UTC, 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 20 Dec 2012 04:13:15 PM UTC, 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>
Wed 19 Dec 2012 04:19:00 AM UTC, comment #13: 

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

Tyler <ty36>
Wed 19 Dec 2012 04:17:42 AM UTC, 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 19 Dec 2012 02:14:12 AM UTC, 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>
Wed 19 Dec 2012 01:58:37 AM UTC, 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 19 Dec 2012 12:43:47 AM UTC, 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>
Wed 19 Dec 2012 12:17:53 AM UTC, 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 26 Oct 2012 02:11:11 PM UTC, 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>
Group Member
Fri 26 Oct 2012 12:52:52 AM UTC, 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 25 Oct 2012 10:29:36 PM UTC, 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.)

example:
x=linspace[1,10,50];
y=sin(x);
plot(x,y)

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 25 Oct 2012 09:25:53 PM UTC, comment #4: 

Added "MinGW" to bug report title/summary

Philip Nienhuis <philipnienhuis>
Group Member
Thu 25 Oct 2012 09:21:47 PM UTC, 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>
Group Member
Wed 24 Oct 2012 04:31:26 PM UTC, comment #2: 

It's mingw32.

George <genrommel>
Wed 24 Oct 2012 01:45:41 PM UTC, comment #1: 

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

Jordi GutiƩrrez Hermoso <jordigh>
Group Member
Wed 24 Oct 2012 02:28:17 AM UTC, 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:

x=[1)

and

n=[1,2,3];
b=[3,2,1];
n*b

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

Then octave exits.


Anonymous

 

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

Attach Files:
   
   
Comment:
   

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

 

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

    Date Changed by Updated Field Previous Value => Replaced by
    2015-01-07 lostbard Open/ClosedOpen Closed
    2015-01-06 lostbard StatusNeed Info Fixed
        Assigned toNone lostbard
    2014-08-16 lostbard Attached File- Added win8-term.patch, #31909
    2014-08-12 lostbard Attached File- Added octave-1-gnulib-isatty.patch, #31894
    2014-08-12 jordigh Dependencies- bugs #42967 is dependent
    2014-03-27 mtmiller Dependencies- bugs #41451 is dependent
    2014-03-27 mtmiller Dependencies- bugs #40473 is dependent
    2014-01-19 philipnienhuis SummaryMinGW: Crash on incorrect syntax MinGW: Crash on incorrect syntax on Windows 8
    2014-01-19 mtmiller CategoryNone Interpreter
    2013-03-29 svillemot Carbon-Copy- Added svillemot
    2012-12-23 goffioul Attached File- Added test-tty.c, #27146
    2012-12-20 goffioul Attached File- Added test-tty.c, #27129
    2012-10-25 philipnienhuis SummaryCrash on incorrect syntax MinGW: Crash on incorrect syntax
    2012-10-24 jordigh StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code