Subject: Re: [GRASS5] compiling beta10 on IRIX and CYGWIN/WIN32

Justin Hickey wrote:

> >> > CYGWIN:
> >> > grass5
> >> > /usr/local/grass5/etc/Init.sh: not found
> > >> does not start with and without any commandline flag (-text,
> > >> -tcltk
>
> >> > etc.)
> >> > COMPLETELY BROKEN NOW!
> >> Hi Justin! :slight_smile: Seems to be a problem in src/general/init/Gmakefile.
> >
> >I need more information for this. /usr/local/grass5/etc/Init.sh
> >seems
> >to be the correct path (at least for Unix). What should it be for
> >CYGWIN?
>
> This looks like a problem that I had. I copied /bin/bash.exe to
> /bin/sh.exe and it worked fine. I think it was ash from the
> installation.

Does this mean that CYGWIN does not have a sh program but a bash one
instead? Should we put "if CYGWIN copy /bin/bash.exe to /bin/sh.exe"
code in the Makefile or somewhere? Just an idea.

It might be better to test which shell is being used and tell the user
that Init.sh (and grass5) won't run with the ash shell - which I think
is what is used for the default sh.exe program in the cygwin setup. This
information should also be added to the INSTALL file and to the Cygwin
instructions. A lot of people prefer the borne shell anyway. Since
other shells may be available (csh, ksh, etc.) now or in the future it
is probably best to avoid making changes to a users setup.

With bash linked to, or copied to, /bin/sh , "sh --version" returns:

GNU bash, version 2.04.0(8)-release (i686-pc-cygwin)
Copyright 1999 Free Software Foundation, Inc.

Ash doesn't recognize this option and returns "Illegal option --". I
don't know how to get version information from it.

Hope this helps,

Malcolm

----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo@geog.uni-hannover.de with
subject 'unsubscribe grass5'

Malcolm Blue wrote:

> Does this mean that CYGWIN does not have a sh program but a bash one
> instead? Should we put "if CYGWIN copy /bin/bash.exe to /bin/sh.exe"
> code in the Makefile or somewhere? Just an idea.
>

It might be better to test which shell is being used and tell the user
that Init.sh (and grass5) won't run with the ash shell - which I think
is what is used for the default sh.exe program in the cygwin setup. This
information should also be added to the INSTALL file and to the Cygwin
instructions. A lot of people prefer the borne shell anyway. Since
other shells may be available (csh, ksh, etc.) now or in the future it
is probably best to avoid making changes to a users setup.

With bash linked to, or copied to, /bin/sh , "sh --version" returns:

GNU bash, version 2.04.0(8)-release (i686-pc-cygwin)
Copyright 1999 Free Software Foundation, Inc.

Ash doesn't recognize this option and returns "Illegal option --". I
don't know how to get version information from it.

Hope this helps,

Hi Malcolm, Hi Justin,

thanks for the hints. I'll test for this later. But what is changed
internally to Init.sh that it does no longer work on CYGWIN. The CVS
Version before beta9 worked flawlessly with standard CYGWIN setup.

You'll have to tweak so many things with CYGWIN to get grass running
that i fear introducing more changes will deter users.

cu,

Andreas

--
Andreas Lange, 65187 Wiesbaden, Germany, Tel. +49 611 807850
Andreas.Lange@Rhein-Main.de - A.C.Lange@GMX.net

----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo@geog.uni-hannover.de with
subject 'unsubscribe grass5'

Hi Andreas and Malcolm

Andreas Lange wrote:

Malcolm Blue wrote:
> > Does this mean that CYGWIN does not have a sh program but a bash
> > one instead? Should we put "if CYGWIN copy /bin/bash.exe to
> > /bin/sh.exe" code in the Makefile or somewhere? Just an idea.
>
> It might be better to test which shell is being used and tell the
> user that Init.sh (and grass5) won't run with the ash shell - which
> I think is what is used for the default sh.exe program in the cygwin
> setup. This information should also be added to the INSTALL file and
> to the Cygwin instructions. A lot of people prefer the borne shell
> anyway. Since other shells may be available (csh, ksh, etc.) now or
> in the future it is probably best to avoid making changes to a users
> setup.
>

Hmmm. It appears that you may have misunderstood me. The fault is mine,
I was pretty vague with that post so I'll try to be more clear. At first
I thought the error message Andreas posted meant that CYGWIN could not
find the file Init.sh. After your reply, it reminded me that the error
message could be complaining about not finding the correct shell script
interpreter. Since you copied bash.exe.to sh.exe, I thought that CYGWIN
did not provide the sh interpreter which is required by our shell
scripts.

The way it is supposed to work is that programmers are supposed to write
their shell scripts as sh scripts since sh is supposed to be installed
in every version of UNIX. The sh interpreter is specified in the script
and thus, the script is portable. Therefore, it shouldn't matter which
shell people use, since the script is always supposed to use the sh
interpreter regardless of the shell it is called from.

So, the user should not have to change his/her setup, and the problem is
either in the script or with the CYGWIN installation. But I think I
found the problem, please see below. You may already know all this but I
thought a thourough explanation would be better.

thanks for the hints. I'll test for this later. But what is changed
internally to Init.sh that it does no longer work on CYGWIN. The CVS
Version before beta9 worked flawlessly with standard CYGWIN setup.

Andreas, I just checked the Init.sh file in CVS and it doesn't contain
the standard

#! /bin/sh

line as the first line. Could you please put this in your copy of
Init.sh and see if this fixes the problem? Thanks.

--
Sincerely,

Jazzman (a.k.a. Justin Hickey) e-mail: jhickey@hpcc.nectec.or.th
High Performance Computing Center
National Electronics and Computer Technology Center (NECTEC)
Bangkok, Thailand

People who think they know everything are very irritating to those
of us who do. ---Anonymous

Jazz and Trek Rule!!!

----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo@geog.uni-hannover.de with
subject 'unsubscribe grass5'

Hi Justin, Hi Malcolm,

i tested the adding of
#!/bin/sh to etc/Init.sh
and it _partially_ works now.

There are some really mysterious things happening on CYGWIN, i'll give a
rundown of them in the hope that someone helps me to get this running as
it is expected.

- there is no clear bin. But "tput clear" works. This works for me on
Linux, IRIX and CYGWIN, so IMHO it can be changed.

- on CYGWIN $SHELL is always "/bin/sh", even if running in bash. This is
the reason grass5 starts always with sh. If i do a "export SHELL=`which
bash`" before starting grass5, it does not work, as SHELL is set to
"D:/cygwin/bin/bash.exe", so that `basename $SHELL` is bash.exe.
If i add bash|bash.exe) in the shell check in Init.sh, everything starts
up as expected, but $ETC/run $SHELL gets into a dead loop. If i Ctrl-C,
i am in a grass session (but PS1 and others are not correctly set), if i
wait, the PATH-variable is expanded until the resource is exhausted and
i get a "fork: resource not available". I can manually start $ETC/run
$SHELL with SHELL=/bin/bash or SHELL=D:/cygwin/bin/bash.exe.
I am totally clueless whats happening here. I tested many combinations.
Only the /bin/sh setup works.

PATH is set to something like this (only snippet):
/usr/local/bin:/usr/bin:/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/bin:/usr/bin:/bin:/usr/local...

I just want a grass session running through the bash shell, as working
without command completion and command history is a pain. I fear that
simply copying bash.exe to sh.exe will break something else on the
CYGWIN system.

What i noted too: If i delete .grassrc, .gislock (after killing the dead
loop this is left behind) and the .bashrc etc. in the mapset i work in
and re-start grass5, i get not the message that no X window system is
running. This is only shown sometimes when starting up the session
again. Very strange. Is this stored somewhere else than in the .grassrc
file?

g.manual does not work on CYGWIN:
g.manual d.erase
fgets: error 0
Error reading manual page
No entry ...

cu,

Andreas

Justin Hickey wrote:

Hi Andreas and Malcolm

Andreas Lange wrote:
>
> Malcolm Blue wrote:
> > > Does this mean that CYGWIN does not have a sh program but a bash
> > > one instead? Should we put "if CYGWIN copy /bin/bash.exe to
> > > /bin/sh.exe" code in the Makefile or somewhere? Just an idea.
> >
> > It might be better to test which shell is being used and tell the
> > user that Init.sh (and grass5) won't run with the ash shell - which
> > I think is what is used for the default sh.exe program in the cygwin
> > setup. This information should also be added to the INSTALL file and
> > to the Cygwin instructions. A lot of people prefer the borne shell
> > anyway. Since other shells may be available (csh, ksh, etc.) now or
> > in the future it is probably best to avoid making changes to a users
> > setup.
> >

Hmmm. It appears that you may have misunderstood me. The fault is mine,
I was pretty vague with that post so I'll try to be more clear. At first
I thought the error message Andreas posted meant that CYGWIN could not
find the file Init.sh. After your reply, it reminded me that the error
message could be complaining about not finding the correct shell script
interpreter. Since you copied bash.exe.to sh.exe, I thought that CYGWIN
did not provide the sh interpreter which is required by our shell
scripts.

The way it is supposed to work is that programmers are supposed to write
their shell scripts as sh scripts since sh is supposed to be installed
in every version of UNIX. The sh interpreter is specified in the script
and thus, the script is portable. Therefore, it shouldn't matter which
shell people use, since the script is always supposed to use the sh
interpreter regardless of the shell it is called from.

So, the user should not have to change his/her setup, and the problem is
either in the script or with the CYGWIN installation. But I think I
found the problem, please see below. You may already know all this but I
thought a thourough explanation would be better.

> thanks for the hints. I'll test for this later. But what is changed
> internally to Init.sh that it does no longer work on CYGWIN. The CVS
> Version before beta9 worked flawlessly with standard CYGWIN setup.

Andreas, I just checked the Init.sh file in CVS and it doesn't contain
the standard

#! /bin/sh

line as the first line. Could you please put this in your copy of
Init.sh and see if this fixes the problem? Thanks.

--
Sincerely,

Jazzman (a.k.a. Justin Hickey) e-mail: jhickey@hpcc.nectec.or.th
High Performance Computing Center
National Electronics and Computer Technology Center (NECTEC)
Bangkok, Thailand

People who think they know everything are very irritating to those
of us who do. ---Anonymous

Jazz and Trek Rule!!!

----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo@geog.uni-hannover.de with
subject 'unsubscribe grass5'

--
Andreas Lange, 65187 Wiesbaden, Germany, Tel. +49 611 807850
Andreas.Lange@Rhein-Main.de - A.C.Lange@GMX.net

----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo@geog.uni-hannover.de with
subject 'unsubscribe grass5'

Hi Andreas

Andreas Lange wrote:

Hi Justin, Hi Malcolm,
- there is no clear bin. But "tput clear" works. This works for me on
Linux, IRIX and CYGWIN, so IMHO it can be changed.

OK, I'll make the change in CVS and see what happens.

- on CYGWIN $SHELL is always "/bin/sh", even if running in bash. This > is the reason grass5 starts always with sh. If i do a "export
SHELL=`which bash`" before starting grass5, it does not work, as SHELL
is set to "D:/cygwin/bin/bash.exe", so that `basename $SHELL` is
bash.exe. If i add bash|bash.exe) in the shell check in Init.sh,
everything starts up as expected, but $ETC/run $SHELL gets into a dead
loop. If i Ctrl-C, i am in a grass session (but PS1 and others are not
correctly set), if i wait, the PATH-variable is expanded until the
resource is exhausted and i get a "fork: resource not available". I
can manually start $ETC/run $SHELL with SHELL=/bin/bash or
SHELL=D:/cygwin/bin/bash.exe. I am totally clueless whats happening
here. I tested many combinations. Only the /bin/sh setup works.

PATH is set to something like this (only snippet):
/usr/local/bin:/usr/bin:/bin:/usr/local/bin:/usr/bin:/bin:...

Hmmm. It appears as if the $ETC/run $SHELL program is getting stuck in
the "search the path for exe file" part of the program. I have attached
a new version of run.c which uses execvp() instead of execv() which uses
the system to search the path. Please try this version of run.c and see
what happens. If it is successful, I will submit it to CVS since it will
get rid of most of the code in run.c. It seems to work for me on IRIX
but that doesn't mean anything. :slight_smile:

I just want a grass session running through the bash shell, as working
without command completion and command history is a pain. I fear that
simply copying bash.exe to sh.exe will break something else on the
CYGWIN system.

What i noted too: If i delete .grassrc, .gislock (after killing the
dead loop this is left behind) and the .bashrc etc. in the mapset i
work in and re-start grass5, i get not the message that no X window
system is running. This is only shown sometimes when starting up the
session again. Very strange. Is this stored somewhere else than in the
.grassrc file?

This is very strange indeed. The X Windows message is supposed to appear
if you do not have a DISPLAY variable defined. But I never saved that
variable to the .grassrc5 (and it shouldn't be saved there) so the
existance of .grassrc5 should not matter.

Hope this helps.

--
Sincerely,

Jazzman (a.k.a. Justin Hickey) e-mail: jhickey@hpcc.nectec.or.th
High Performance Computing Center
National Electronics and Computer Technology Center (NECTEC)
Bangkok, Thailand

People who think they know everything are very irritating to those
of us who do. ---Anonymous

Jazz and Trek Rule!!!

----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo@geog.uni-hannover.de with
subject 'unsubscribe grass5'

Ooops! I forgot to attach run.c. Here it is.

--
Sincerely,

Jazzman (a.k.a. Justin Hickey) e-mail: jhickey@hpcc.nectec.or.th
High Performance Computing Center
National Electronics and Computer Technology Center (NECTEC)
Bangkok, Thailand

People who think they know everything are very irritating to those
of us who do. ---Anonymous

Jazz and Trek Rule!!!

(attachments)

run.c (1.16 KB)

Hi Justin,

On Mon, Dec 18, 2000 at 03:51:20PM +0700, Justin Hickey wrote:

Hi Andreas

Andreas Lange wrote:
>
> Hi Justin, Hi Malcolm,
> - there is no clear bin. But "tput clear" works. This works for me on
> Linux, IRIX and CYGWIN, so IMHO it can be changed.

OK, I'll make the change in CVS and see what happens.

> - on CYGWIN $SHELL is always "/bin/sh", even if running in bash. This > is the reason grass5 starts always with sh. If i do a "export
> SHELL=`which bash`" before starting grass5, it does not work, as SHELL
> is set to "D:/cygwin/bin/bash.exe", so that `basename $SHELL` is
> bash.exe. If i add bash|bash.exe) in the shell check in Init.sh,
> everything starts up as expected, but $ETC/run $SHELL gets into a dead
> loop. If i Ctrl-C, i am in a grass session (but PS1 and others are not
> correctly set), if i wait, the PATH-variable is expanded until the
> resource is exhausted and i get a "fork: resource not available". I
> can manually start $ETC/run $SHELL with SHELL=/bin/bash or
> SHELL=D:/cygwin/bin/bash.exe. I am totally clueless whats happening
> here. I tested many combinations. Only the /bin/sh setup works.
>
> PATH is set to something like this (only snippet):
> /usr/local/bin:/usr/bin:/bin:/usr/local/bin:/usr/bin:/bin:...

Hmmm. It appears as if the $ETC/run $SHELL program is getting stuck in
the "search the path for exe file" part of the program. I have attached
a new version of run.c which uses execvp() instead of execv() which uses
the system to search the path. Please try this version of run.c and see
what happens. If it is successful, I will submit it to CVS since it will
get rid of most of the code in run.c. It seems to work for me on IRIX
but that doesn't mean anything. :slight_smile:

Hi Justin,

the run.c seems to work fine on Linux (how to hard-test?).

Yours

Markus

----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo@geog.uni-hannover.de with
subject 'unsubscribe grass5'

Hi Markus

Markus Neteler wrote:

the run.c seems to work fine on Linux (how to hard-test?).

Well, the way I tested it was to go into init.sh and change

$ETC/run $SHELL

(at the appropriate place) to

$ETC/run tcsh

(I use tcsh) and gmake5, grass5 then changed it to

$ETC/run /bin/tcsh

and gmake5, grass5. But I guess we should try other shells to make sure
they work as well.

--
Sincerely,

Jazzman (a.k.a. Justin Hickey) e-mail: jhickey@hpcc.nectec.or.th
High Performance Computing Center
National Electronics and Computer Technology Center (NECTEC)
Bangkok, Thailand

People who think they know everything are very irritating to those
of us who do. ---Anonymous

Jazz and Trek Rule!!!

----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo@geog.uni-hannover.de with
subject 'unsubscribe grass5'

On Mon, Dec 18, 2000 at 05:52:33PM +0700, Justin Hickey wrote:

Hi Markus

Markus Neteler wrote:
> the run.c seems to work fine on Linux (how to hard-test?).

Well, the way I tested it was to go into init.sh and change

$ETC/run $SHELL

(at the appropriate place) to

$ETC/run tcsh

(I use tcsh) and gmake5, grass5 then changed it to

$ETC/run /bin/tcsh

and gmake5, grass5. But I guess we should try other shells to make sure
they work as well.

Thanks for the hint.

I am using bash still without problems :slight_smile:

Markus

----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo@geog.uni-hannover.de with
subject 'unsubscribe grass5'