bugGNU Octave - Bugs: bug #53419, GUI crashes if QT_PLUGIN_PATH is...

 
 

bug #53419: GUI crashes if QT_PLUGIN_PATH is not set

Submitter:  None
Submitted:  Thu 22 Mar 2018 07:53:12 AM UTC
   
 
Category:  GUI Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  None
Originator Name:  cg31 Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 4.2.2
Operating System:  * Microsoft Windows Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 28 Mar 2018 11:09:02 PM UTC, comment #13: 

Done.  Marking as fixed and closing report.

Rik <rik5>
Group administrator
Wed 28 Mar 2018 10:20:10 PM UTC, comment #12: 

Re #2: Yes I think we should delete the exit command. I think that dates back to when octave.bat was used in the Start menu launcher, and the point was to get rid of the cmd window after the Octave GUI exited.

Re #1: shrug I would vote for consistency, and most Octave users will be using the Start menu shortcuts so the GUI will run for them automatically.

Mike Miller <mtmiller>
Group Member
Wed 28 Mar 2018 12:00:30 AM UTC, comment #11: 

There are still two open issues.

1) Should the CLI or GUI be started by default from octave.bat?  In analogy with octave on Linux it probably should not start the GUI unless directed to.

2) Should we call exit at the end of the batch file?  If you are on the command line this can be annoying because your terminal window disappears.  Wouldn't it be better to remove this?  As another data point, gvim.bat does not close the terminal that I am working in.

Rik <rik5>
Group administrator
Tue 27 Mar 2018 11:57:31 PM UTC, comment #10: 

I checked in a change for octave.bat.  This sets QT_PLUGIN_PATH and also simplifies the way we processed arguments.


changeset:   4645:56a712112482
tag:         tip
user:        Rik <rik@octave.org>
date:        Tue Mar 27 16:56:01 2018 -0700
summary:     octave.bat: Rewrite to set QT_PLUGIN_PATH (bug #53419).

diff -r c3950e2b4066 -r 56a712112482 installer-files/octave.bat
--- a/installer-files/octave.bat        Tue Mar 27 09:53:22 2018 -0700
+++ b/installer-files/octave.bat        Tue Mar 27 16:56:01 2018 -0700
@@ -3,21 +3,27 @@ Rem   Find Octave's install directory th
 Rem   This batch file should reside in Octaves installation subdir!
 Rem
 Rem   This trick finds the location where the batch file resides.
-Rem   Note: the result ends with a backslash
+Rem   Note: the result ends with a backslash.
 set OCT_HOME=%~dp0
-Rem Coonvert to 8.3 format so dont have to worry about spaces
+Rem Convert to 8.3 format so we don't have to worry about spaces.
 for %%I in ("%OCT_HOME%") do set OCT_HOME=%%~sI

-Rem   Set up PATH. Make sure the octave bin dir
-Rem   comes first.
+Rem   Set up PATH.  Make sure the octave bin dir comes first.

 set PATH=%OCT_HOME%qt5\bin;%OCT_HOME%bin;%PATH%

-Rem   Set up any environment vars we may need
+Rem   Set up any environment vars we may need.

 set TERM=cygwin
 set GNUTERM=wxt
 set GS=gs.exe
+
+Rem QT_PLUGIN_PATH must be set to avoid segfault (bug #53419).
+IF EXIST "%OCT_HOME%\qt5\bin\" (
+  set QT_PLUGIN_PATH=%OCT_HOME%\qt5\plugins
+) ELSE (
+  set QT_PLUGIN_PATH=%OCT_HOME%\plugins
+)

 Rem set home if not already set
 if "%HOME%"=="" set HOME=%USERPROFILE%
@@ -25,27 +31,34 @@ if "%HOME%"=="" set HOME=%HOMEDRIVE%%HOM
 Rem set HOME to 8.3 format
 for %%I in ("%HOME%") do set HOME=%%~sI

-Rem   Check for args to see if we are told to start GUI
-Rem   with the --force-gui option or not (--no-gui)
-Rem   Otherwise assume starting as command line
+Rem   Check for args to see if we are told to start GUI (--gui, --force-gui)
+Rem   or not (--no-gui).
+Rem   If nothing is specified, start the GUI.
 set GUI_MODE=1
 :checkargs
-if -%1-==-- goto noargs
-  if NOT %1==--force-gui goto notguiarg
-    set GUI_MODE=1
-:notguiarg
-  if NOT %1==--no-gui goto notnoguiarg
-    set GUI_MODE=0
-:notnoguiarg
-  shift
-  goto  checkargs
-:noargs
+if -%1-==-- goto args_done
+
+if %1==--gui (
+  set GUI_MODE=1
+) else (
+if %1==--force-gui (
+  set GUI_MODE=1
+) else (
+if %1==--no-gui (
+  set GUI_MODE=0
+)))
+
+Rem move to next argument and continue processing
+shift
+goto checkargs
+
+:args_done

 Rem   Start Octave (this detaches and immediately returns):
 if %GUI_MODE%==1 (
-start octave-gui.exe --gui %*
+  start octave-gui.exe --gui %*
 ) else (
-start octave-cli.exe %*
+  start octave-cli.exe %*
 )

 Rem   Close the batch file's cmd.exe window




Rik <rik5>
Group administrator
Tue 27 Mar 2018 10:44:36 PM UTC, comment #9: 

I checked and adding QT_PLUGIN_PATH to octave.bat in the manner suggested by John D. in comment #7 works.

Should Octave be launching the GUI or CLI when users call octave.bat from the command line?

According to the comments, we should be launching the CLI.  But actually, we initialize GUI_MODE to 1 so the GUI is launched by default.


Rem   Check for args to see if we are told to start GUI
Rem   with the --force-gui option or not (--no-gui)
Rem   Otherwise assume starting as command line
set GUI_MODE=1
:checkargs
if -%1-==-- goto noargs
  if NOT %1==--force-gui goto notguiarg
    set GUI_MODE=1
:notguiarg
  if NOT %1==--no-gui goto notnoguiarg
    set GUI_MODE=0
:notnoguiarg
  shift
  goto  checkargs
:noargs



Rik <rik5>
Group administrator
Tue 27 Mar 2018 05:13:36 PM UTC, comment #8: 

John D. is quite right.  You can use parentheses to allow the use of newlines and make it look alright.

Rik <rik5>
Group administrator
Tue 27 Mar 2018 05:10:41 PM UTC, comment #7: 

comment #4


IF EXIST "%OCTAVE_HOME%\qt5\bin\" (
set QT_PLUGIN_PATH=%OCTAVE_HOME%\qt5\plugins
) ELSE (
set QT_PLUGIN_PATH=%OCTAVE_HOME%\plugins
)


John Donoghue <lostbard>
Group Member
Tue 27 Mar 2018 05:09:45 PM UTC, comment #6: 

@Mike: If you really want to use use if/else syntax then this will work in a batch file.


IF EXIST Linux\ echo "Linux Found"

IF NOT EXIST Linux\ echo "Not Found"


I couldn't get "ELSE" to work so I just repeat the test using "NOT".  The command needs to appear on the same line as "IF", no prettiness of newlines.

Rik <rik5>
Group administrator
Tue 27 Mar 2018 04:46:54 PM UTC, comment #5: 

I'm running across the same issue with octave.bat and the 4.4.0 release candidates.

I can fix the issue by modifying octave.bat in the following way,


set PATH=%OCT_HOME%qt5\bin;%OCT_HOME%bin;%PATH%
set QT_PLUGIN_PATH=%OCT_HOME%qt5\plugins


, where the second line is my addition.

Given that we build and ship Qt5 in the MXE version, do we even need to test for OCT_HOME\qt5\plugins or can we unilaterally set this environment variable in octave.bat?


Rik <rik5>
Group administrator
Tue 27 Mar 2018 02:06:35 AM UTC, comment #4: 

Can someone supply the right bat file syntax for


if test -d "$OCTAVE_HOME/qt5/bin"; then
  export QT_PLUGIN_PATH="$OCTAVE_HOME/qt5/plugins"
else
  export QT_PLUGIN_PATH="$OCTAVE_HOME/plugins"
fi


Mike Miller <mtmiller>
Group Member
Fri 23 Mar 2018 01:58:35 PM UTC, comment #3: 

OP sent the following reply to the mailing list:

Changing octave.bat can fix it. But it would be better to use
QCoreApplication::addLibraryPath with a relative path.

John W. Eaton <jwe>
Group administrator
Thu 22 Mar 2018 07:05:48 PM UTC, comment #2: 

Changing octave.bat would be the simplest fix.  Can we do that for the 4.4.0 release?

Rik <rik5>
Group administrator
Thu 22 Mar 2018 06:22:16 PM UTC, comment #1: 

The octave.vbs script sets QT_PLUGIN_PATH. Would including QT_PLUGIN_PATH in octave.bat fix this issue for you?

Users are not meant to call the octave executables directly as I understand it.

Mike Miller <mtmiller>
Group Member
Thu 22 Mar 2018 07:53:12 AM UTC, original submission:  


It seems the new octave-4.2.2 gui requires QT_PLUGIN_PATH to be set, so when the zip is used, users have to set it themselves.

It will be better if octave-gui can find Qt5 plugin by a relative path i.e QT_PLUGIN_PATH = ..\qt5\plugins.


Anonymous

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by lostbard (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by rik5 (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
    2019-02-26 mtmiller Carbon-CopyRemoved 80942 -
    2018-03-28 rik5 Open/ClosedOpen Closed
    2018-03-27 rik5 StatusIn Progress Fixed
    2018-03-27 rik5 StatusConfirmed In Progress
    2018-03-27 rik5 StatusNeed Info Confirmed
    2018-03-22 mtmiller StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code