bugGNU Octave - Bugs: bug #53369, Octave 4.5.0+ launched from...

 
 

bug #53369: Octave 4.5.0+ launched from installer runs as hidden process on Windows

Submitter:  Philip Nienhuis <philipnienhuis>
Submitted:  Sat 17 Mar 2018 04:29:04 PM UTC
   
 
Category:  Configuration and Build System Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Assigned to:  None
Originator Name:  philipnienhuis Open/Closed:  * Closed
Release:  * dev Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 27 Mar 2018 04:55:40 PM UTC, comment #16: 

I verified the latest change works and then checked in the cset.  There is still an issue with octave.bat not running correctly.  But that should be handled over at bug #53419.

Marking this bug as fixed and closing report.

Rik <rik5>
Group administrator
Tue 27 Mar 2018 04:07:18 PM UTC, comment #15: 

The changes don't work for me.  I get the warning dialog attached.  On the other hand, it was pretty easy to see how to patch things.  I'm compiling to see if this works


# HG changeset patch
# Parent  b0cb0218813cc14562200c90daf22420c96bdefd

diff -r b0cb0218813c -r 64b772db5f7b installer-files/octave-firsttime.vbs
--- a/installer-files/octave-firsttime.vbs        Mon Mar 26 18:14:40 2018 -0700
+++ b/installer-files/octave-firsttime.vbs        Tue Mar 27 09:05:24 2018 -0700
@@ -40,7 +40,8 @@ End If
 startpath = wshShell.ExpandEnvironmentStrings("%UserProfile%")
 wshShell.CurrentDirectory = startpath

-wshShell.Run chr(34) & OctavePath & "\bin\octave-gui.exe --gui" & Chr(34), 0
+GUIArg = " " & chr(34) & "--gui" & chr(34)
+wshShell.Run chr(34) & OctavePath & "\bin\octave-gui.exe" & Chr(34) & GUIArg, 0

 ' free our objects
 Set fso = Nothing
diff -r b0cb0218813c -r 64b772db5f7b installer-files/octave.vbs
--- a/installer-files/octave.vbs        Mon Mar 26 18:14:40 2018 -0700
+++ b/installer-files/octave.vbs        Tue Mar 27 09:05:24 2018 -0700
@@ -42,13 +42,14 @@ GUI_MODE=1
 AllArgs = ""
 Set wshArgs = WScript.Arguments
 For I = 0 to wshArgs.Count - 1
-  if wshArgs(I) = "--no-gui" then GUI_MODE=0
+  If wshArgs(I) = "--no-gui" Then GUI_MODE=0
   AllArgs = AllArgs & " " & chr(34) & wshArgs(I) & chr(34)
 Next

 ' start octave-gui, either with console shown or hidden
 If GUI_MODE = 1 then
-  wshShell.Run chr(34) & OctavePath & "\bin\octave-gui.exe --gui" & Chr(34) & AllArgs, 0
+  AllArgs = AllArgs & " " & chr(34) & "--gui" & chr(34)
+  wshShell.Run chr(34) & OctavePath & "\bin\octave-gui.exe" & Chr(34) & AllArgs, 0
 Else
   wshShell.Run chr(34) & OctavePath & "\bin\octave-gui.exe" & Chr(34) & AllArgs, 1
 End If





Rik <rik5>
Group administrator
Tue 27 Mar 2018 03:26:15 PM UTC, comment #14: 

I'll take a look when I get a spare few, unless someone else beats me to it

John Donoghue <lostbard>
Group Member
Tue 27 Mar 2018 01:17:07 AM UTC, comment #13: 

Done. I didn't update the comments because I haven't changed how the command-line options to octave.bat itself are handled. I can't parse enough bat file syntax to figure out how to handle both --force-gui and --gui, so it still accepts --force-gui. If someone else is better at bat and vbs scripting they might want to update both octave.bat and octave.vbs to accept both --gui and --force-gui.

Mike Miller <mtmiller>
Group Member
Tue 27 Mar 2018 12:27:59 AM UTC, comment #12: 

@Mike: Can you push your changes to octave-firsttime.vbs, octave.bat, octave.vbs?  They look right to me.  I think the comments about --force-gui in octave.bat should be updated since --gui is the preferred option name now.

Rik <rik5>
Group administrator
Wed 21 Mar 2018 08:39:33 PM UTC, comment #11: 
Philip Nienhuis <philipnienhuis>
Group Member
Tue 20 Mar 2018 06:08:25 PM UTC, comment #10: 

Running octave.bat will try to open a cmd shell and run octave-gui.exe

I saw that several environment setting commands don't work anymore, e.g., set OCT_HOME=%~dp0 (%~dp0 is a "macro" for the current directory); that may be one cause of the errors I saw in octave.bat.

Anyway, fixing a few things in octave-firsttime.vbs wouldn't hurt :-)
I'll try your suggestions hopefully next Sunday, if no one beats me to it.



Philip Nienhuis <philipnienhuis>
Group Member
Mon 19 Mar 2018 06:29:59 PM UTC, comment #9: 

Hold on, I was only speculating in general about how useful octave.exe is, and whether octave.bat is necessary for users to do open a command shell, cd to Octave's bin directory, and type "octave". Unrelated to fixing this bug.

For this bug, I think all that is needed is to sprinkle some options in octave.bat and octave.vbs. Something like this


diff --git a/installer-files/octave-firsttime.vbs b/installer-files/octave-firsttime.vbs
--- a/installer-files/octave-firsttime.vbs
+++ b/installer-files/octave-firsttime.vbs
@@ -40,7 +40,7 @@ End If
 startpath = wshShell.ExpandEnvironmentStrings("%UserProfile%")
 wshShell.CurrentDirectory = startpath

-wshShell.Run chr(34) & OctavePath & "\bin\octave-gui.exe" & Chr(34), 0
+wshShell.Run chr(34) & OctavePath & "\bin\octave-gui.exe --gui" & Chr(34), 0

 ' free our objects
 Set fso = Nothing
diff --git a/installer-files/octave.bat b/installer-files/octave.bat
--- a/installer-files/octave.bat
+++ b/installer-files/octave.bat
@@ -43,7 +43,7 @@ if -%1-==-- goto noargs

 Rem   Start Octave (this detaches and immediately returns):
 if %GUI_MODE%==1 (
-start octave-gui.exe %*
+start octave-gui.exe --gui %*
 ) else (
 start octave-cli.exe %*
 )
diff --git a/installer-files/octave.vbs b/installer-files/octave.vbs
--- a/installer-files/octave.vbs
+++ b/installer-files/octave.vbs
@@ -48,7 +48,7 @@ Next

 ' start octave-gui, either with console shown or hidden
 If GUI_MODE = 1 then
-  wshShell.Run chr(34) & OctavePath & "\bin\octave-gui.exe" & Chr(34) & AllArgs, 0
+  wshShell.Run chr(34) & OctavePath & "\bin\octave-gui.exe --gui" & Chr(34) & AllArgs, 0
 Else
   wshShell.Run chr(34) & OctavePath & "\bin\octave-gui.exe" & Chr(34) & AllArgs, 1
 End If


Needs some thorough testing of all of the install options and all of the ways that Octave can be launched via shortcut or command shell. Have you tested all of the installed shortcuts yet to verify whether they do work correctly?

Mike Miller <mtmiller>
Group Member
Mon 19 Mar 2018 05:54:30 PM UTC, comment #8: 

Both octave.bat and octave.exe then; octave.bat calls octave.exe.

On Windows, typing octave in a cmd.exe window won't do anything unless octave's install or /bin directory is in the path.

Even then, the only commands that will make Octave run =
octave.vbs --force-gui
or
octave.vbs --no-gui

octave.vbs by itself will create the zombie process;
octave.exe crashes;
octave-gui does nothing;
running any of those commands from /bin will also crash with "This application has requested the Runtime to terminate it in an unusual way."

All of this for octave-5.4.0+

Maybe we'll have to ask JohnD or JWE what to do.

Philip Nienhuis <philipnienhuis>
Group Member
Mon 19 Mar 2018 01:39:00 AM UTC, comment #7: 

I was thinking the opposite, maybe we should delete octave.exe from the Windows install entirely, keep both octave.bat and octave.vbs. If a user is in the terminal and runs "octave" will the command shell run octave.vbs? Aren't there some users who have trouble with the vbs scripts and have to rely on octave.bat?

Mike Miller <mtmiller>
Group Member
Sun 18 Mar 2018 07:38:34 PM UTC, comment #6: 

OK thanks, I'll try again, hopefully later tonight as my build box is busy doing other things for me.

We had a bit of miscommunication, could well be my fault.
That I ran octave.exe (not just like that, see below) was because I saw octave turning into a zombie process, so I wanted to find out where and why things went wrong.

Of course I didn't run octave.exe directly but only after setting up the environment as done in octave.bat.  FYI, I'm the one who came up with octave.bat for starting octave in Windows, later on one of the Johns absorbed it into mxe-octave and perfected it and still later JohnD wrote octave.vbs
Anyway along this way I found out that octave.exe simply doesn't run at all in Windows and octave-gui.exe is required. Has something to do with stdin/stdout AFAIU.
In octave.vbs octave-gui.exe is called so that's good.

Which makes me think that it may be time to decommission octave.bat from mxe-octave entirely.

Philip Nienhuis <philipnienhuis>
Group Member
Sun 18 Mar 2018 07:04:35 PM UTC, comment #5: 

I have now merged some more important changes from stable onto the default branch, so please try again with a73dedb0d9b5.

I think some small changes are needed in the octave.bat and octave.vbs wrapper scripts, that may be what this bug is about more than anything.

If the shortcuts created by the installer do work correctly, but only the first time launch from the installer is wrong, then feel free to retitle it again. I was missing the context, you were saying you were running octave.exe directly, and I was fixing a similar bug on my system at the same time.

AFAIK all of the shortcuts and advice we give to users is to run octave.vbs or octave.bat, and never to run octave.exe directly.

Mike Miller <mtmiller>
Group Member
Sun 18 Mar 2018 10:37:13 AM UTC, comment #4: 

@Mike:
No I didn't know that octave.exe is dysfunctional on Windows these days.

In my comment #2 I wasn't clear that indeed octave-gui.exe works (BTW, with the mxe-octave - supplied "--force-gui" flag rather than just "--gui", however both turn out to work).

But, when I adapted the title in comment #2 it was IMO accurate then: octave-gui.exe doesn't show up when launched from the installer and becomes a zombie process, w/o taskbar button and only seen in the task manager processes tab.
octave-gui.exe does show up when launched from the desktop GUI-icon & Start menu entries.
(Verified on 3 of the 4 Windows installations here.)
Apparently you didn't understand the adapted title; could you come up with a better title using the above-mentioned info, please? (remember, I'm no native English speaker.)

Philip Nienhuis <philipnienhuis>
Group Member
Sat 17 Mar 2018 10:32:23 PM UTC, comment #3: 

I thought that octave.exe was not used at all on Windows. The octave.bat script runs either octave-gui.exe or octave-cli.exe.

Can you please try running "octave-gui.exe --gui"?

Mike Miller <mtmiller>
Group Member
Sat 17 Mar 2018 09:14:14 PM UTC, comment #2: 

Some more experimenting:

After being started from the installer the Octave GUI runs hidden and needs to be killed from the task manager.
But after that, double-clicking the desktop icon or selecting the GUI from the start menu does lead to the GUI appearing on the desktop.

(adapting title)

Philip Nienhuis <philipnienhuis>
Group Member
Sat 17 Mar 2018 04:39:08 PM UTC, comment #1: 

On Win 7 the same issues.

A screenshot of the cmd.exe window from which I tried to start Octave in GUI mode is attached. Octave just crashes when invoked as:
octave --force-gui
But ISTR on Windows octave.exe cannot be started properly like this?



Philip Nienhuis <philipnienhuis>
Group Member
Sat 17 Mar 2018 04:29:04 PM UTC, original submission:  

(In Windows 10)

A just cross-built Octave-5.4.0+ (64 bit Idx) refuses to start in GUI mode using:
start octave.exe --force-gui
(after having run the previous environment setup commands in the octave.bat file)

Using octave-gui.exe creates a zombie process. Nothing comes up on the screen, but in the Task Manager an octave-gui process is running.

octave-cli.exe does run; graphics capabilities seem to work, given that some graphics demos yield expected results.

Philip Nienhuis <philipnienhuis>
Group Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #43698:  vbs_warning.png added by rik5 (15KiB - image/png)

 

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 rik5 (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by philipnienhuis (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 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-03-27 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2018-03-27 rik5 Attached File- Added vbs_warning.png, #43698
    2018-03-27 mtmiller StatusNone Ready For Test
    2018-03-20 mtmiller CategoryNone Configuration and Build System
    2018-03-18 philipnienhuis SummaryOctave 4.5.0+ runs as hidden process on Windows Octave 4.5.0+ launched from installer runs as hidden process on Windows
    2018-03-17 mtmiller Summary(mxe-octave) After installation Octave-5.4.0+ runs as hidden process on Windows Octave 4.5.0+ runs as hidden process on Windows
    2018-03-17 philipnienhuis Summary(mxe-octave) Octave-5.4.0+ won't start in GUI mode on Windows (mxe-octave) After installation Octave-5.4.0+ runs as hidden process on Windows
    2018-03-17 philipnienhuis Attached File- Added Octave540_Win10.PNG, #43582

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code