Windows: different behaviour of octave.bat and octave-cli/gui.exe regarding modifying path

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Windows: different behaviour of octave.bat and octave-cli/gui.exe regarding modifying path

Abhinav Tripathi
Hi,
I saw that if I run octave from '<octave-dir>/bin/octave-cli.exe' or '<octave-dir>/bin/octave-cli.exe' then I only get PATH as "<windows-path>;<octave-dirs>;" which doesn't let me install any packages. I get errors such as 'sort' is not gnu sort or sometimes 'expr.exe' starts crashing (that too repeatedly 10-20 times)...

If I edit PATH (using setenv) such that PATH becomes "<octave-dir>;<windows-path>;" (simply swapping the 2 parts) then I can install packages (using "pkg install").

Also, instead, if I run octave from '<octave-dir>/octave.bat' then it automatically prepends octave's bin dir to PATH and the installation of packages goes smoothly.

Mike said "those executables should not change PATH, what you are seeing is the expected behavior. Setting environment variables like PATH is precisely the point of the bat file."

I have just one question, why aren't the other executables supposed to modify the PATH when it helps resolve this issue?

.
Abhinav
Reply | Threaded
Open this post in threaded view
|

Re: Windows: different behaviour of octave.bat and octave-cli/gui.exe regarding modifying path

nrjank
On Mon, Aug 8, 2016 at 3:52 PM, Abhinav Tripathi <[hidden email]> wrote:
Hi,
 
I have just one question, why aren't the other executables supposed to modify the PATH when it helps resolve this issue?

.
Abhinav

you don't want multiple files changing the path when starting octave. the windows version is designed to use available widows scripting language to find the local path and set it. this is done with the octave.bat file. after taking care of startup steps, octave.bat calls the appropriate executable. 

Octave.bat runs the following line:

set OCT_HOME=%~dp0

to find the current location of octave and then that gets added to the path.  This enables the zip-file "installer" for windows, as well as having multiple versions of Octave installed at one time.
Reply | Threaded
Open this post in threaded view
|

Re: Windows: different behaviour of octave.bat and octave-cli/gui.exe regarding modifying path

tmacchant
----- Original Message -----

>From: Nicholas Jankowski
>To: Abhinav Tripathi  
>Cc: octave-maintainers <[hidden email]>; Mike Miller <[hidden email]>
>Date: 2016/8/9, Tue 05:07
>Subject: Re: Windows: different behaviour of octave.bat and octave-cli/gui.exe regarding modifying path
>
>
>On Mon, Aug 8, 2016 at 3:52 PM, Abhinav Tripathi <[hidden email]> wrote:
>
>Hi,

>I have just one question, why aren't the other executables supposed to modify the PATH when it helps resolve this issue?
>>
>>
>>.Abhinav
>
>you don't want multiple files changing the path when starting octave. the windows version is designed to use available widows scripting language to find the local path and set it. this is done with the octave.bat file. after taking care of startup steps, octave.bat calls the appropriate executable. 
>
>Octave.bat runs the following line:
>
>set OCT_HOME=%~dp0
>
>
>to find the current location of octave and then that gets added to the path.  This enables the zip-file "installer" for windows, as well as having multiple versions of Octave installed at one time.
>



Sorry I have informed you that incorrect writing cli mode startup on windows.

From windows console shell, the cli mode
(path to octave.bat)\octave.bat --no-gui
(path to octave.bat)\octave.bat --no-gui --no-qt

At first one, you can use qt graphics toolkit 
At second one, you only fltk graphics toolkit as opengl graphics.

Tatsuro  


Reply | Threaded
Open this post in threaded view
|

Re: Windows: different behaviour of octave.bat and octave-cli/gui.exe regarding modifying path

Abhinav Tripathi
In reply to this post by nrjank

On Aug 9, 2016 1:38 AM, "Nicholas Jankowski" <[hidden email]> wrote:
>
>
> you don't want multiple files changing the path when starting octave. the windows version is designed to use available widows scripting language to find the local path and set it. this is done with the octave.bat file. after taking care of startup steps, octave.bat calls the appropriate executable. 
>
> Octave.bat runs the following line:
>
> set OCT_HOME=%~dp0
>
> to find the current location of octave and then that gets added to the path.  This enables the zip-file "installer" for windows, as well as having multiple versions of Octave installed at one time.

Hi Nicholas,
Thanks for the explanation.

How about having the path such that it gives higher precedence to octave files over windows?
I mean currently, if I open octave (by the exe files), the PATH is atleast "<windows-path>;<some-octave-dirs>;" how about swapping the 2 parts such that the octave dirs are prepended and not appended?
Even that would help resolve issues while installing packages...

.
Abhinav

Reply | Threaded
Open this post in threaded view
|

Re: Windows: different behaviour of octave.bat and octave-cli/gui.exe regarding modifying path

tmacchant
----- Original Message -----

>From: Abhinav Tripathi 
>To: Nicholas Jankowski 
>Cc: octave-maintainers ; Mike Miller 
>Date: 2016/8/9, Tue 16:10
>Subject: Re: Windows: different behaviour of octave.bat and octave-cli/gui.exe regarding modifying path
>
>
>On Aug 9, 2016 1:38 AM, "Nicholas Jankowski" <[hidden email]> wrote:
>>
>>
>> you don't want multiple files changing the path when starting octave. the windows version is designed to use available widows scripting language to find the local path and set it. this is done with the octave.bat file. after taking care of startup steps, octave.bat calls the appropriate executable. 
>>
>> Octave.bat runs the following line:
>>
>> set OCT_HOME=%~dp0
>>
>> to find the current location of octave and then that gets added to the path.  This enables the zip-file "installer" for windows, as well as having multiple versions of Octave installed at one time.
>
>Hi Nicholas,
>Thanks for the explanation.
>How about having the path such that it gives higher precedence to octave files over windows?
>I mean currently, if I open octave (by the exe files), the PATH is atleast "<windows-path>;<some-octave-dirs>;" how about swapping the 2 parts such that the octave dirs are prepended and not appended?
>Even that would help resolve issues while installing packages...
>.
>Abhinav
>


If you set some setting outside octave.bat, you can use "call (path to octave.bat)\octave.bat (options)"

e.g.

Rem example.bat

@echo off
(some setting you want)

call C:\octave\octave-dev\octave.bat --no-gui.

Rem end if example.bat


HTH

Tatsuro

Reply | Threaded
Open this post in threaded view
|

Re: Windows: different behaviour of octave.bat and octave-cli/gui.exe regarding modifying path

Mike Miller-4
In reply to this post by Abhinav Tripathi
On Tue, Aug 09, 2016 at 12:40:58 +0530, Abhinav Tripathi wrote:
> How about having the path such that it gives higher precedence to octave
> files over windows?

This is precisely what the purpose of octave.bat is.

If you run the executable directly, then it's generally assumed that the
executable is already in PATH, or that PATH is at least configured such
that the helper programs that Octave will need are already in PATH.

> I mean currently, if I open octave (by the exe files), the PATH is atleast
> "<windows-path>;<some-octave-dirs>;" how about swapping the 2 parts such
> that the octave dirs are prepended and not appended?

That behavior is marked with a FIXME comment [1]. I think it would be
ideal (and I think the FIXME comment agrees with me) if the Octave
executables did *not* modify the PATH environment variable at all.

Silently prepending Octave's bin and libexec directories to PATH would
be a severe error on most operating systems, I hope that is easy to see.

Configuring the PATH correctly in octave.bat is a compromise for Windows
users who do not know how to or do not want to configure the global PATH
to include Octave's bin directory. Which is probably most users. So
essentially no one should be calling the executables directly. Is that a
problem in itself?

[1]: http://hg.savannah.gnu.org/hgweb/octave/file/22c2bd440544/libinterp/corefcn/defaults.cc#l266

--
mike

Reply | Threaded
Open this post in threaded view
|

Re: Windows: different behaviour of octave.bat and octave-cli/gui.exe regarding modifying path

Abhinav Tripathi

On Aug 9, 2016 1:20 PM, "Mike Miller" <[hidden email]> wrote:
>
> This is precisely what the purpose of octave.bat is.
>
> If you run the executable directly, then it's generally assumed that the
> executable is already in PATH, or that PATH is at least configured such
> that the helper programs that Octave will need are already in PATH.
>
> That behavior is marked with a FIXME comment [1]. I think it would be
> ideal (and I think the FIXME comment agrees with me) if the Octave
> executables did *not* modify the PATH environment variable at all.
>
> Silently prepending Octave's bin and libexec directories to PATH would
> be a severe error on most operating systems, I hope that is easy to see.
>
> Configuring the PATH correctly in octave.bat is a compromise for Windows
> users who do not know how to or do not want to configure the global PATH
> to include Octave's bin directory. Which is probably most users. So
> essentially no one should be calling the executables directly. Is that a
> problem in itself?
>
> [1]: http://hg.savannah.gnu.org/hgweb/octave/file/22c2bd440544/libinterp/corefcn/defaults.cc#l266
>
> --
> mike

Thanks for the explanation.
If I see it from a user's point of view, it seems perfectly alright. I'll use octave.bat for opening octave now.
.

Tatsuro wrote:
> Sorry I have informed you that incorrect writing cli mode startup on windows.
>
>From windows console shell, the cli mode
>(path to octave.bat)\octave.bat --no-gui
>(path to octave.bat)\octave.bat --no-gui --no-qt
>
>At first one, you can use qt graphics toolkit 
>At second one, you only fltk graphics toolkit as opengl graphics.
>
>Tatsuro  

Thanks for the commands. I should have tried/searched for the correct way to use octave executable.

Abhinav

Reply | Threaded
Open this post in threaded view
|

Re: Windows: different behaviour of octave.bat and octave-cli/gui.exe regarding modifying path

Colin Macdonald-2
On 09/08/16 11:31, Abhinav Tripathi wrote:
> rom a user's point of view, it seems perfectly alright. I'll use
> octave.bat for opening octave now.

Some time ago (6 months) I observed the following problem with the .bat
file.  No sure how reproducible it is; maybe Abhinav or others can check
and report back.

1.  I ran octave.bat (by using the file manager to find it and double
clicking on it).

2.  After the GUI started, I right-clicked on its icon on the "task/icon
bar" (not sure what's its called, the icons to the right of the Start
Menu"), and selected "pin here" (or something like that).

3.  Quit Octave.

4.  Click on the persistent task/icon bar icon.

5.  It directly ran some .exe file (octave-gui.exe?) and not the bat
file, therefore the PATH seemed incorrect (and I could not install
packages).

This was on either Win 8 or Win 10.

best,
Colin

Reply | Threaded
Open this post in threaded view
|

Re: Windows: different behaviour of octave.bat and octave-cli/gui.exe regarding modifying path

Mike Miller-4
On Tue, Aug 09, 2016 at 11:52:36 -0700, Colin Macdonald wrote:

> On 09/08/16 11:31, Abhinav Tripathi wrote:
> > rom a user's point of view, it seems perfectly alright. I'll use
> > octave.bat for opening octave now.
>
> Some time ago (6 months) I observed the following problem with the .bat
> file.  No sure how reproducible it is; maybe Abhinav or others can check and
> report back.
>
> 1.  I ran octave.bat (by using the file manager to find it and double
> clicking on it).
>
> 2.  After the GUI started, I right-clicked on its icon on the "task/icon
> bar" (not sure what's its called, the icons to the right of the Start
> Menu"), and selected "pin here" (or something like that).
>
> 3.  Quit Octave.
>
> 4.  Click on the persistent task/icon bar icon.
>
> 5.  It directly ran some .exe file (octave-gui.exe?) and not the bat file,
> therefore the PATH seemed incorrect (and I could not install packages).
>
> This was on either Win 8 or Win 10.

That is similar to https://savannah.gnu.org/bugs/?47527. The bug looks
like it will be fixed soon so that pinning the provided shortcut to the
task bar will continue to run the right scripts. However, I don't think
starting Octave by clicking on the octave.bat file directly and pinning
the resulting task bar icon will work.

--
mike