[GRASS-dev] [GRASS GIS] #1803: GRASS 6.4.3RC1 on Win 7: grass64.bat fails due to UNIX line endings in Init.bat

#1803: GRASS 6.4.3RC1 on Win 7: grass64.bat fails due to UNIX line endings in
Init.bat
----------------------------+-----------------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: Startup | Version: 6.4.3 RCs
Keywords: Init.bat, CRLF | Platform: MSWindows 7
      Cpu: x86-64 |
----------------------------+-----------------------------------------------
There's a following error at GRASS 6.4.3RC1 startup in text mode on Win 7
64bit:

{{{
C:\>"C:\Program Files (x86)\GRASS GIS 6.4.3RC1\grass64.bat" -text
The system cannot find the batch label specified - aftertextcheck
}}}

The problem is in the etc\Init.bat where the "aftertextcheck" label is
used - looks like Windows expects "\r\n" at the end of the label name
rather than "\n".

Are the Windows builds done on Linux? If so, I guess the root cause is
eol-style=native on lib/init/init.bat in the GRASS repo. The solution
would be to set eol-style=CRLF, or maybe to tweak the makefile to run
tr/unix2dos/... on etc/Init.bat.

Opinions?

There are plenty of *.bat with LF instead of CRLF in the GRASS
installation dir. Shouldn't they all have CRLF line endings?:

{{{
$ cd '/c/Program Files (x86)/GRASS GIS 6.4.3RC1'
$ find . -type f -iname '*.bat' -print0 | xargs -0 grep -Ulv $'\r' | wc -l
112
}}}

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1803&gt;
GRASS GIS <http://grass.osgeo.org>

#1803: GRASS 6.4.3RC1 on Win 7: grass64.bat fails due to UNIX line endings in
Init.bat
----------------------------+-----------------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: Startup | Version: 6.4.3 RCs
Keywords: Init.bat, CRLF | Platform: MSWindows 7
      Cpu: x86-64 |
----------------------------+-----------------------------------------------
Description changed by martinl:

Old description:

There's a following error at GRASS 6.4.3RC1 startup in text mode on Win 7
64bit:

{{{
C:\>"C:\Program Files (x86)\GRASS GIS 6.4.3RC1\grass64.bat" -text
The system cannot find the batch label specified - aftertextcheck
}}}

The problem is in the etc\Init.bat where the "aftertextcheck" label is
used - looks like Windows expects "\r\n" at the end of the label name
rather than "\n".

Are the Windows builds done on Linux? If so, I guess the root cause is
eol-style=native on lib/init/init.bat in the GRASS repo. The solution
would be to set eol-style=CRLF, or maybe to tweak the makefile to run
tr/unix2dos/... on etc/Init.bat.

Opinions?

There are plenty of *.bat with LF instead of CRLF in the GRASS
installation dir. Shouldn't they all have CRLF line endings?:

{{{
$ cd '/c/Program Files (x86)/GRASS GIS 6.4.3RC1'
$ find . -type f -iname '*.bat' -print0 | xargs -0 grep -Ulv $'\r' | wc
-l
112
}}}

New description:

Are the Windows builds done on Linux? If so, I guess the root cause

winGRASS are built on Windows, of course - in MinGW/MSys environment.

--

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1803#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#1803: GRASS 6.4.3RC1 on Win 7: grass64.bat fails due to UNIX line endings in
Init.bat
----------------------------+-----------------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: Startup | Version: 6.4.3 RCs
Keywords: Init.bat, CRLF | Platform: MSWindows 7
      Cpu: x86-64 |
----------------------------+-----------------------------------------------

Old description:

Are the Windows builds done on Linux? If so, I guess the root cause

winGRASS are built on Windows, of course - in MinGW/MSys environment.

New description:

There's a following error at GRASS 6.4.3RC1 startup in text mode on Win 7
64bit:

{{{
C:\>"C:\Program Files (x86)\GRASS GIS 6.4.3RC1\grass64.bat" -text
The system cannot find the batch label specified - aftertextcheck
}}}

The problem is in the etc\Init.bat where the "aftertextcheck" label is
used - looks like Windows expects "\r\n" at the end of the label name
rather than "\n".

Are the Windows builds done on Linux? If so, I guess the root cause is
eol-style=native on lib/init/init.bat in the GRASS repo. The solution
would be to set eol-style=CRLF, or maybe to tweak the makefile to run
tr/unix2dos/... on etc/Init.bat.

Opinions?

There are plenty of *.bat with LF instead of CRLF in the GRASS
installation dir. Shouldn't they all have CRLF line endings?:

{{{
$ cd '/c/Program Files (x86)/GRASS GIS 6.4.3RC1'
$ find . -type f -iname '*.bat' -print0 | xargs -0 grep -Ulv $'\r' | wc -l
112
}}}

--

Comment(by martinl):

Replying to [ticket:1803 msieczka]:
> Are the Windows builds done on Linux? If so, I guess the root cause
>
> winGRASS are built on Windows, of course - in MinGW/MSys environment.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1803#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#1803: GRASS 6.4.3RC1 on Win 7: grass64.bat fails due to UNIX line endings in
Init.bat
----------------------------+-----------------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: Startup | Version: 6.4.3 RCs
Keywords: Init.bat, CRLF | Platform: MSWindows 7
      Cpu: x86-64 |
----------------------------+-----------------------------------------------

Comment(by martinl):

I don't know why but original description has been modified (I just
clicked on 'reply'). Now should be back. And my answer:

> Are the Windows builds done on Linux? If so, I guess the root cause

winGRASS are built on Windows, of course - in MinGW/MSys environment.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1803#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#1803: GRASS 6.4.3RC1 on Win 7: grass64.bat fails due to UNIX line endings in
Init.bat
----------------------------+-----------------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: Startup | Version: 6.4.3 RCs
Keywords: Init.bat, CRLF | Platform: MSWindows 7
      Cpu: x86-64 |
----------------------------+-----------------------------------------------

Comment(by msieczka):

I assume that the svn checkout from GRASS repo is done on Windows too.

In that case, lib/init/init.bat (having eol-style=native) should have CRLF
line endings after an svn checkout on Win. So why does etc/Init.bat (made
from lib/init/init.bat during the build) have LF instead?

And BTW - should the other 111 *.bat have LF rather than CRLF like they
do?

Same issue is present in GRASS 6.4.3RC1 provided by the OSGeo4W installer.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1803#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#1803: GRASS 6.4.3RC1 on Win 7: grass64.bat fails due to UNIX line endings in
Init.bat
----------------------------+-----------------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: Startup | Version: 6.4.3 RCs
Keywords: Init.bat, CRLF | Platform: MSWindows 7
      Cpu: x86-64 |
----------------------------+-----------------------------------------------

Comment(by neteler):

Replying to [ticket:1803 msieczka]:
>
>
> There's a following error at GRASS 6.4.3RC1 startup in text mode on Win
7 64bit:
>
> {{{
> C:\>"C:\Program Files (x86)\GRASS GIS 6.4.3RC1\grass64.bat" -text
> The system cannot find the batch label specified - aftertextcheck
> }}}
>
> The problem is in the etc\Init.bat where the "aftertextcheck" label is
used - looks like Windows expects "\r\n" at the end of the label name
rather than "\n".

It is surprising that this has never been reported before.

Any CRLF expert here?

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1803#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>

#1803: GRASS 6.4.3RC1 on Win 7: grass64.bat fails due to UNIX line endings in
Init.bat
----------------------------+-----------------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: Startup | Version: 6.4.3 RCs
Keywords: Init.bat, CRLF | Platform: MSWindows 7
      Cpu: x86-64 |
----------------------------+-----------------------------------------------

Comment(by martinl):

Replying to [comment:4 msieczka]:
> I assume that the svn checkout from GRASS repo is done on Windows too.
>
> In that case, lib/init/init.bat (having eol-style=native) should have
CRLF line endings after an svn checkout on Win. So why does etc/Init.bat
(made from lib/init/init.bat during the build) have LF instead?

I have changed `eol-style` for `init.bat` to `CRLF` in r54365 (devbr6).

The source code in devb6 contains 24 bat files (other bat files are
generated during compilation process - for shell scripts).

{{{
find . -name '*.bat'
./mswindows/external/rbatch/Rversions.bat
./mswindows/external/rbatch/Rtidy.bat
./mswindows/external/rbatch/rterm.bat
./mswindows/external/rbatch/Rtools.bat
./mswindows/external/rbatch/Rcmd.bat
./mswindows/external/rbatch/RguiStart.bat
./mswindows/external/rbatch/movedir.bat
./mswindows/external/rbatch/#Rscript.bat
./mswindows/external/rbatch/Stangle.bat
./mswindows/external/rbatch/copydir.bat
./mswindows/external/rbatch/Rgui.bat
./mswindows/external/rbatch/RtoolsVersion.bat
./mswindows/external/rbatch/Sweave.bat
./mswindows/external/rbatch/R.bat
./mswindows/external/rbatch/Rscript.bat
./mswindows/env.bat
./mswindows/osgeo4w/postinstall.bat
./mswindows/osgeo4w/msys.bat
./mswindows/osgeo4w/preremove.bat
./scripts/windows_launch.bat
./gui/scripts/windows_launch.bat
./gui/tcltk/gis.m/gis.m.bat
./lib/init/grass-run.bat
./lib/init/init.bat
}}}

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1803#comment:6&gt;
GRASS GIS <http://grass.osgeo.org>

#1803: GRASS 6.4.3RC1 on Win 7: grass64.bat fails due to UNIX line endings in
Init.bat
----------------------------+-----------------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: Startup | Version: 6.4.3 RCs
Keywords: Init.bat, CRLF | Platform: MSWindows 7
      Cpu: x86-64 |
----------------------------+-----------------------------------------------

Comment(by hamish):

did the work-around work?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1803#comment:7&gt;
GRASS GIS <http://grass.osgeo.org>

#1803: GRASS 6.4.3RC1 on Win 7: grass64.bat fails due to UNIX line endings in
Init.bat
----------------------------+-----------------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: Startup | Version: 6.4.3 RCs
Keywords: Init.bat, CRLF | Platform: MSWindows 7
      Cpu: x86-64 |
----------------------------+-----------------------------------------------

Comment(by msieczka):

Replying to [comment:7 hamish]:
> did the work-around work?

It was not applied to releasebranch_6_4.

Is there any reason that prevents us from setting eol-style to CRLF for
*.bat files once and for all to avoid such issues in the future?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1803#comment:8&gt;
GRASS GIS <http://grass.osgeo.org>

#1803: GRASS 6.4.3RC1 on Win 7: grass64.bat fails due to UNIX line endings in
Init.bat
----------------------------+-----------------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: Startup | Version: 6.4.3 RCs
Keywords: Init.bat, CRLF | Platform: MSWindows 7
      Cpu: x86-64 |
----------------------------+-----------------------------------------------

Comment(by msieczka):

Promoting to blocker, per #1890.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1803#comment:9&gt;
GRASS GIS <http://grass.osgeo.org>

#1803: GRASS 6.4.3RC1 on Win 7: grass64.bat fails due to UNIX line endings in
Init.bat
----------------------------+-----------------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: Startup | Version: 6.4.3 RCs
Keywords: Init.bat, CRLF | Platform: MSWindows 7
      Cpu: x86-64 |
----------------------------+-----------------------------------------------

Comment(by neteler):

Replying to [comment:8 msieczka]:
> Replying to [comment:7 hamish]:
> > did the work-around work?
>
> It was not applied to releasebranch_6_4.

Please update
grass-addons/tools/module_svn_propset.sh
to do it properly. Then it becomes an easy job.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1803#comment:10&gt;
GRASS GIS <http://grass.osgeo.org>

#1803: GRASS 6.4.3RC1 on Win 7: grass64.bat fails due to UNIX line endings in
Init.bat
--------------------------------------+-------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: Startup | Version: 6.4.3 RCs
Keywords: Init.bat, CRLF, wingrass | Platform: MSWindows 7
      Cpu: x86-64 |
--------------------------------------+-------------------------------------
Changes (by hamish):

  * keywords: Init.bat, CRLF => Init.bat, CRLF, wingrass

Comment:

Replying to [comment:10 neteler]:
> Please update grass-addons/tools/module_svn_propset.sh
> to do it properly. Then it becomes an easy job.

done, & all .bat files in main svn now updated in r55154,5,6.

I notice have this unchecked-in change for grass6x/lib/init/init.bat:
{{{
Index: lib/init/init.bat

--- lib/init/init.bat (revision 55154)
+++ lib/init/init.bat (working copy)
@@ -142,9 +142,9 @@

  set PYTHONPATH=%PYTHONPATH%;%GISBASE%\etc\python;%GISBASE%\etc\wxpython

-python "%GISBASE%/etc/wxpython/gis_set.py"
+"%GRASS_PYTHON%" "%GISBASE%/etc/wxpython/gis_set.py"
  if %errorlevel% == 2 goto exitinit
-python "%GISBASE%/etc/wxpython/wxgui.py"
+"%GRASS_PYTHON%" "%GISBASE%/etc/wxpython/wxgui.py"

  goto exitinit

}}}

any thoughts?

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1803#comment:11&gt;
GRASS GIS <http://grass.osgeo.org>

#1803: GRASS 6.4.3RC1 on Win 7: grass64.bat fails due to UNIX line endings in
Init.bat
--------------------------------------+-------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: Startup | Version: 6.4.3 RCs
Keywords: Init.bat, CRLF, wingrass | Platform: MSWindows 7
      Cpu: x86-64 |
--------------------------------------+-------------------------------------

Comment(by hamish):

Retesting with the 6.4.3svn r55185 nightly build; the svn prop change
didn't help.

I assume that's because the Init.bat script is not copied, it is made from
init.bat(?).

note that msys nicely provides unix2dos.exe, if we need it at build or
install time.

Once resaving Init.bat with DOS newlines, "GRASS Command Line" in the
cmd.exe window starts, but after esc-enter an error message pops up saying
"set_data.exe has stopped working (segfault afaict "APPCRASH") do you want
to check for an online solution or close the program?". If you press
cancel you get the usual GRASS welcome text but no ascii art, and g.gisenv
all seems to be ok.

not sure where to go from here, but the nightly build scripts?

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1803#comment:12&gt;
GRASS GIS <http://grass.osgeo.org>

#1803: GRASS 6.4.3RC1 on Win 7: grass64.bat fails due to UNIX line endings in
Init.bat
--------------------------------------+-------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: Startup | Version: 6.4.3 RCs
Keywords: Init.bat, CRLF, wingrass | Platform: MSWindows 7
      Cpu: x86-64 |
--------------------------------------+-------------------------------------

Comment(by neteler):

Replying to [comment:12 hamish]:
> Retesting with the 6.4.3svn r55185 nightly build; the svn prop change
didn't help.
>
> I assume that's because the Init.bat script is not copied, it is made
from init.bat(?).
>
> note that msys nicely provides unix2dos.exe, if we need it at build or
install time.

Wouldn't it be sufficient then to add a unix2dos.exe call in:

http://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_4/lib/init/Makefile#L107

?

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1803#comment:13&gt;
GRASS GIS <http://grass.osgeo.org>

#1803: GRASS 6.4.3RC1 on Win 7: grass64.bat fails due to UNIX line endings in
Init.bat
--------------------------------------+-------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: Startup | Version: 6.4.3 RCs
Keywords: Init.bat, CRLF, wingrass | Platform: MSWindows 7
      Cpu: x86-64 |
--------------------------------------+-------------------------------------

Comment(by hamish):

Replying to [comment:13 neteler]:
> Wouldn't it be sufficient then to add a unix2dos.exe call in:
>
>
http://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_4/lib/init/Makefile#L107
>
> ?

attempted in r55296.

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1803#comment:14&gt;
GRASS GIS <http://grass.osgeo.org>

#1803: GRASS 6.4.3RC1 on Win 7: grass64.bat fails due to UNIX line endings in
Init.bat
--------------------------------------+-------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: Startup | Version: 6.4.3 RCs
Keywords: Init.bat, CRLF, wingrass | Platform: MSWindows 7
      Cpu: x86-64 |
--------------------------------------+-------------------------------------

Comment(by hellik):

Replying to [comment:13 neteler]:
>
> Wouldn't it be sufficient then to add a unix2dos.exe call in:
>
>
http://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_4/lib/init/Makefile#L107

tested here with

{{{
GRASS version: 6.4.3svn
GRASS SVN Revision: 55262
GIS Library Revision: 50937 (2012-02-25)
GDAL/OGR: 1.9.2
PROJ4: Rel. 4.8.0, 6 March 2012
Python: 2.7.2
wxPython: 2.8.12.1
Platform: Windows-7-6.1.7601-SP1 (OSGeo4W)
}}}

"GRASS 6.4.3svn GUI" start without any problem, but "GRASS 6.4.3svn
Command Line" is the problem.

unix2dos C:\OSGeo4W\apps\grass\grass-6.4.3svn\etc\Init.bat helps to start
by "GRASS 6.4.3svn Command Line", by maybe other files affected...

Helmut

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1803#comment:15&gt;
GRASS GIS <http://grass.osgeo.org>

#1803: GRASS 6.4.3RC1 on Win 7: grass64.bat fails due to UNIX line endings in
Init.bat
--------------------------------------+-------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: Startup | Version: 6.4.3 RCs
Keywords: Init.bat, CRLF, wingrass | Platform: MSWindows 7
      Cpu: x86-64 |
--------------------------------------+-------------------------------------

Comment(by martinl):

Replying to [comment:15 hellik]:
> Replying to [comment:13 neteler]:
> >
> > Wouldn't it be sufficient then to add a unix2dos.exe call in:
> >
> >
http://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_4/lib/init/Makefile#L107

tested the last build (no.517) and GRASS 6.5 CLI starts. Please backport
to `relbr64`.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1803#comment:16&gt;
GRASS GIS <http://grass.osgeo.org>

#1803: GRASS 6.4.3RC1 on Win 7: grass64.bat fails due to UNIX line endings in
Init.bat
--------------------------------------+-------------------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: Startup | Version: 6.4.3 RCs
Keywords: Init.bat, CRLF, wingrass | Platform: MSWindows 7
      Cpu: x86-64 |
--------------------------------------+-------------------------------------

Comment(by neteler):

Replying to [comment:16 martinl]:
> tested the last build (no.517) and GRASS 6.5 CLI starts. Please backport
to `relbr64`.

Done in r55304.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1803#comment:17&gt;
GRASS GIS <http://grass.osgeo.org>

#1803: GRASS 6.4.3RC1 on Win 7: grass64.bat fails due to UNIX line endings in
Init.bat
--------------------------+-------------------------------------------------
  Reporter: msieczka | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: critical | Milestone: 6.4.3
Component: Startup | Version: 6.4.3 RCs
Resolution: fixed | Keywords: Init.bat, CRLF, wingrass
  Platform: MSWindows 7 | Cpu: x86-64
--------------------------+-------------------------------------------------
Changes (by hellik):

  * status: new => closed
  * resolution: => fixed

Comment:

Replying to [comment:17 neteler]:
> Replying to [comment:16 martinl]:
> > tested the last build (no.517) and GRASS 6.5 CLI starts. Please
backport to `relbr64`.
>
> Done in r55304.

tested and works.

closing ticket, reopen if needed.

Helmut

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1803#comment:18&gt;
GRASS GIS <http://grass.osgeo.org>