Opened 9 years ago

Closed 6 years ago

#2975 closed enhancement (invalid)

support bash on windows 10

Reported by: martinl Owned by: grass-dev@…
Priority: normal Milestone: 8.0.0
Component: Startup Version: unspecified
Keywords: bash, wingrass, windows 10 Cc:
CPU: Unspecified Platform: Unspecified

Description

GRASS 8 should use bash on Windows 10 instead of cmd.

See: http://blog.dustinkirkland.com/2016/03/ubuntu-on-windows.html

Change History (15)

comment:1 by wenzeslaus, 6 years ago

See #653 for an alternative suggestion.

in reply to:  description ; comment:2 by hellik, 6 years ago

Replying to martinl:

GRASS 8 should use bash on Windows 10 instead of cmd.

See: http://blog.dustinkirkland.com/2016/03/ubuntu-on-windows.html

not sure if everyone will install the linux subsystem in windows.

in reply to:  2 ; comment:3 by mmetz, 6 years ago

Replying to hellik:

Replying to martinl:

GRASS 8 should use bash on Windows 10 instead of cmd.

See: http://blog.dustinkirkland.com/2016/03/ubuntu-on-windows.html

not sure if everyone will install the linux subsystem in windows.

What about MSYS? We provided it with GRASS6, not much overhead to include again in the standalone installer.

What do Windows users want as command line, if any? Windows native or some form of GNU/Linux shell (bash etc.)?

comment:4 by veroandreo, 6 years ago

IMHO, It would be pretty useful to provide msys in standalone installer for windows, especially for us Linux users teaching GRASS GIS courses to (mostly) Windows users. As I see it, CLI is one of the most powerful things that we have and it is very frustrating not being able to show that to windows users :(

(at least in my case that I'm fully ignorant of cmd)

in reply to:  4 comment:5 by hellik, 6 years ago

Replying to veroandreo:

IMHO, It would be pretty useful to provide msys in standalone installer for windows, especially for us Linux users teaching GRASS GIS courses to (mostly) Windows users. As I see it, CLI is one of the most powerful things that we have and it is very frustrating not being able to show that to windows users :(

(at least in my case that I'm fully ignorant of cmd)

what are these things what can't be shown in the command line to Windows users? Are there any examples?

in reply to:  3 ; comment:6 by hellik, 6 years ago

Replying to mmetz:

Replying to hellik:

Replying to martinl:

GRASS 8 should use bash on Windows 10 instead of cmd.

See: http://blog.dustinkirkland.com/2016/03/ubuntu-on-windows.html

not sure if everyone will install the linux subsystem in windows.

What about MSYS? We provided it with GRASS6, not much overhead to include again in the standalone installer.

What do Windows users want as command line, if any? Windows native or some form of GNU/Linux shell (bash etc.)?

common tools Like e.g. awk etc are already shipped with winGRASS. Anything else needed?

in reply to:  6 ; comment:7 by wenzeslaus, 6 years ago

Replying to hellik:

What about MSYS? We provided it with GRASS6, not much overhead to include again in the standalone installer.

What do Windows users want as command line, if any? Windows native or some form of GNU/Linux shell (bash etc.)?

common tools Like e.g. awk etc are already shipped with winGRASS. Anything else needed?

There is a difference in syntax, so the binaries are there, but not the command line tricks, right?

in reply to:  3 ; comment:8 by wenzeslaus, 6 years ago

Replying to mmetz:

What about MSYS? We provided it with GRASS6, not much overhead to include again in the standalone installer.

It's part of OSGeo4W, isn't it?

If I remember correctly, the reason to remove it was that there was too many ways how to start GRASS GIS (with cmd.exe, with MSYS, and than without GUI guess). The other reason was too different behaviors on Windows (in cmd.exe and in MSYS) and finally also problems with MSYS itself mostly the encoding (would have to find the emails to confirm those).

What do Windows users want as command line, if any? Windows native or some form of GNU/Linux shell (bash etc.)?

I have seen people using or recommending Git Bash (see e.g. this Software Crapentry Workshop at NCSU). Git Bash uses MSYS AFAIU.

in reply to:  2 comment:9 by wenzeslaus, 6 years ago

Replying to hellik:

Replying to martinl:

GRASS 8 should use bash on Windows 10 instead of cmd.

See: http://blog.dustinkirkland.com/2016/03/ubuntu-on-windows.html

not sure if everyone will install the linux subsystem in windows.

I'm actually not sure if this is even an option for people with the Home edition of MS Windows (things like this usually are not available there). There reason I moved the discussion from #653 to this ticket was mainly to avoid duplication and this was the one more current.

in reply to:  7 comment:10 by hellik, 6 years ago

Replying to wenzeslaus:

There is a difference in syntax, so the binaries are there, but not the command line tricks, right?

not sure what you mean:

C:\>awk --version
GNU Awk 3.1.7
Copyright (C) 1989, 1991-2009 Free Software Foundation.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.
C:\>grep --version
GNU grep 2.5.4

Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
C:\>sed --version
GNU sed version 4.2.1
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE,
to the extent permitted by law.

GNU sed home page: <http://www.gnu.org/software/sed/>.
General help using GNU software: <http://www.gnu.org/gethelp/>.
E-mail bug reports to: <bug-gnu-utils@gnu.org>.
Be sure to include the word ``sed'' somewhere in the ``Subject:'' field.

these are the GNU flavours of these tools shipped by OSGeo4W winGRASS? are there different tool syntax on different operating systems?

in reply to:  7 comment:11 by hellik, 6 years ago

Replying to wenzeslaus:

There is a difference in syntax, so the binaries are there, but not the command line tricks, right?

an example with grep.

list shapefile in a directory by dir /b

D:\wd\sample_data>dir /b
sample_shapefile01.cpg
sample_shapefile01.dbf
sample_shapefile01.prj
sample_shapefile01.qpj
sample_shapefile01.shp
sample_shapefile01.shx
sample_shapefile02.cpg
sample_shapefile02.dbf
sample_shapefile02.prj
sample_shapefile02.qpj
sample_shapefile02.shp
sample_shapefile02.shx
sample_shapefile03.cpg
sample_shapefile03.dbf
sample_shapefile03.prj
sample_shapefile03.qpj
sample_shapefile03.shp
sample_shapefile03.shx
sample_shapefile04.cpg
sample_shapefile04.dbf
sample_shapefile04.prj
sample_shapefile04.qpj
sample_shapefile04.shp
sample_shapefile04.shx
sample_shapefile05.cpg
sample_shapefile05.dbf
sample_shapefile05.prj
sample_shapefile05.qpj
sample_shapefile05.shp
sample_shapefile05.shx

ls is also shipped by OSgeo4W winGRASS:

D:\wd\sample_data>ls --version
ls (GNU coreutils) 5.97
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.

Written by Richard Stallman and David MacKenzie.
D:\wd\sample_data>ls
sample_shapefile01.cpg  sample_shapefile02.cpg  sample_shapefile03.cpg  sample_shapefile04.cpg  sample_shapefile05.cpg
sample_shapefile01.dbf  sample_shapefile02.dbf  sample_shapefile03.dbf  sample_shapefile04.dbf  sample_shapefile05.dbf
sample_shapefile01.prj  sample_shapefile02.prj  sample_shapefile03.prj  sample_shapefile04.prj  sample_shapefile05.prj
sample_shapefile01.qpj  sample_shapefile02.qpj  sample_shapefile03.qpj  sample_shapefile04.qpj  sample_shapefile05.qpj
sample_shapefile01.shp  sample_shapefile02.shp  sample_shapefile03.shp  sample_shapefile04.shp  sample_shapefile05.shp
sample_shapefile01.shx  sample_shapefile02.shx  sample_shapefile03.shx  sample_shapefile04.shx  sample_shapefile05.shx

now if you want the output of dir/ls filtered by grep using the pipe:

D:\wd\sample_data>dir /b | grep .shp
sample_shapefile01.shp
sample_shapefile02.shp
sample_shapefile03.shp
sample_shapefile04.shp
sample_shapefile05.shp
D:\wd\sample_data>ls | grep .shp
sample_shapefile01.shp
sample_shapefile02.shp
sample_shapefile03.shp
sample_shapefile04.shp
sample_shapefile05.shp

there may be some differences in the syntax caused by different operating system characteristics; the main work flow is similar.

is the linux way to do things the only right way to do things? ;-D

one may argue that the native windows powershell is the same powerfull as the linux shell.

D:\wd\sample_data>powershell
Windows PowerShell
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

PS D:\wd\sample_data> ls


    Verzeichnis: D:\wd\sample_data


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----       01.09.2018     11:25              5 sample_shapefile01.cpg
-a----       01.09.2018     11:25             66 sample_shapefile01.dbf
-a----       01.09.2018     11:25            143 sample_shapefile01.prj
-a----       01.09.2018     11:25            257 sample_shapefile01.qpj
-a----       01.09.2018     11:25            100 sample_shapefile01.shp
-a----       01.09.2018     11:25            100 sample_shapefile01.shx
-a----       01.09.2018     11:25              5 sample_shapefile02.cpg
-a----       01.09.2018     11:25             66 sample_shapefile02.dbf
-a----       01.09.2018     11:25            143 sample_shapefile02.prj
-a----       01.09.2018     11:25            257 sample_shapefile02.qpj
-a----       01.09.2018     11:25            100 sample_shapefile02.shp
-a----       01.09.2018     11:25            100 sample_shapefile02.shx
-a----       01.09.2018     11:26              5 sample_shapefile03.cpg
-a----       01.09.2018     11:26             66 sample_shapefile03.dbf
-a----       01.09.2018     11:26            143 sample_shapefile03.prj
-a----       01.09.2018     11:26            257 sample_shapefile03.qpj
-a----       01.09.2018     11:26            100 sample_shapefile03.shp
-a----       01.09.2018     11:26            100 sample_shapefile03.shx
-a----       01.09.2018     11:26              5 sample_shapefile04.cpg
-a----       01.09.2018     11:26             66 sample_shapefile04.dbf
-a----       01.09.2018     11:26            143 sample_shapefile04.prj
-a----       01.09.2018     11:26            257 sample_shapefile04.qpj
-a----       01.09.2018     11:26            100 sample_shapefile04.shp
-a----       01.09.2018     11:26            100 sample_shapefile04.shx
-a----       01.09.2018     11:26              5 sample_shapefile05.cpg
-a----       01.09.2018     11:26             66 sample_shapefile05.dbf
-a----       01.09.2018     11:26            143 sample_shapefile05.prj
-a----       01.09.2018     11:26            257 sample_shapefile05.qpj
-a----       01.09.2018     11:26            100 sample_shapefile05.shp
-a----       01.09.2018     11:26            100 sample_shapefile05.shx

I have seen people using or recommending Git Bash (see e.g. ​this Software Crapentry >Workshop at NCSU). Git Bash uses MSYS AFAIU.

what is the real advantage to use Git Bash/MSYS instead of using the GNU tools on the windows native console?

how to tackle the maintenance work load to integrate Git Bash/MSYS? e.g. to keep them update or fix securities issues?

in reply to:  8 comment:12 by hellik, 6 years ago

Replying to wenzeslaus:

If I remember correctly, the reason to remove it was that there was too many ways how to start GRASS GIS (with cmd.exe, with MSYS, and than without GUI guess). The other reason was too different behaviors on Windows (in cmd.exe and in MSYS) and finally also problems with MSYS itself mostly the encoding (would have to find the emails to confirm those).

e.g. windows command console understands slash and backslash in paths, see

D:\wd\sample_data>cd D:\wd\sample_data\otherdata

D:\wd\sample_data\otherdata>cd ..

D:\wd\sample_data>cd D:/wd/sample_data/otherdata

D:\wd\sample_data\otherdata>

not sure if MSYS handles all these cases of path issues.

in the OSGeo4W shell based on the windows native command line, you can still start GRASS without GUI, e.g.

D:\wd\sample_data\otherdata>grass74 --text
Failed to enforce user specified language 'en' with error: 'unsupported locale setting'
A LANGUAGE environmental variable has been set.
Part of messages will be displayed in the requested language.
Cleaning up temporary files...
Starting GRASS GIS...
WARNING: Concurrent mapset locking is not supported on Windows

          __________  ___   __________    _______________
         / ____/ __ \/   | / ___/ ___/   / ____/  _/ ___/
        / / __/ /_/ / /| | \__ \\_  \   / / __ / / \__ \
       / /_/ / _, _/ ___ |___/ /__/ /  / /_/ // / ___/ /
       \____/_/ |_/_/  |_/____/____/   \____/___//____/

Welcome to GRASS GIS 7.4.1
GRASS GIS homepage:                      http://grass.osgeo.org
This version running through:            Command Shell (C:\WINDOWS\system32\cmd.exe)
Help is available with the command:      g.manual -i
See the licence terms with:              g.version -c
See citation options with:               g.version -x
Start the GUI with:                      g.gui wxpython
When ready to quit enter:                exit

Microsoft Windows [Version 10.0.17134.228]
(c) 2018 Microsoft Corporation. Alle Rechte vorbehalten.

D:\wd\sample_data\otherdata>

also

grass74 --exec MyScript.bat D:/myGrassData/MyLoc/MyMapset

works on the OSGeo4W shell; anyone tested if this works with MSYS?

also GRASS-R-integration works in the windows command line:

o avoid Unicode errors in GUI, install en_US.UTF-8 locale and restart GRASS.
Also consider upgrading your Python version to one containg fix for Python Issue 30755.
Cleaning up temporary files...
Starting GRASS GIS...
WARNING: Concurrent mapset locking is not supported on Windows

          __________  ___   __________    _______________
         / ____/ __ \/   | / ___/ ___/   / ____/  _/ ___/
        / / __/ /_/ / /| | \__ \\_  \   / / __ / / \__ \
       / /_/ / _, _/ ___ |___/ /__/ /  / /_/ // / ___/ /
       \____/_/ |_/_/  |_/____/____/   \____/___//____/

Welcome to GRASS GIS 7.5.svn (r73206)
GRASS GIS homepage:                      http://grass.osgeo.org
This version running through:            Command Shell (C:\WINDOWS\system32\cmd.exe)
Help is available with the command:      g.manual -i
See the licence terms with:              g.version -c
See citation options with:               g.version -x
If required, restart the GUI with:       g.gui wxpython
When ready to quit enter:                exit

Launching <wxpython> GUI in the background, please wait...
Microsoft Windows [Version 10.0.17134.228]
(c) 2018 Microsoft Corporation. Alle Rechte vorbehalten.

C:\>R

R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

>

anyone tested if this works also with MSYS?

and I also remember encoding issues.

in reply to:  3 ; comment:13 by hellik, 6 years ago

Replying to mmetz:

What do Windows users want as command line, if any? Windows native or some form of GNU/Linux shell (bash etc.)?

IMHO it's more a discussion about operating systems and their characteristics and how to balance these differences than about GRASS itself.

in reply to:  13 comment:14 by mmetz, 6 years ago

Replying to hellik:

Replying to mmetz:

What do Windows users want as command line, if any? Windows native or some form of GNU/Linux shell (bash etc.)?

IMHO it's more a discussion about operating systems and their characteristics and how to balance these differences than about GRASS itself.

It would help if martinl, the author of this ticket, explains in more detail why "GRASS 8 should use bash on Windows 10 instead of cmd".

comment:15 by martinl, 6 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.