[GRASS-dev] hardcoded 'xterm': wrapper?

Markus Neteler neteler at itc.it
Sun Aug 27 17:24:09 EDT 2006


On Sun, Aug 27, 2006 at 09:39:03PM +0200, Markus Neteler wrote:
> On Sun, Aug 27, 2006 at 07:58:22PM +0100, Glynn Clements wrote:
> > 
> > Markus Neteler wrote:
> > 
> > > > > Debian folks are unhappy with the hardcoded 'xterm' in
> > > > > many places and suggest to replace it with a wrapper script so
> > > > > that they have to change it in a single place later.
> > > > > 
> > > > > They do:
> > > > > http://svn.debian.org/wsvn/pkg-grass/packages/grass/branches/6.1/debian/patches/xterm-fix.dpatch?op=file&rev=0&sc=0
> > > > > 
> > > > > Should we invent a 'grass-xterm' script (in $ETC?) for
> > > > > that? What would be the needed content (thinking portability)?
> > > > 
> > > > That's one option; another is an environment variable, GRASS_XTERM. If
> > > > a wrapper script is used, it should check $GRASS_XTERM before falling
> > > > back to x-terminal-emulator or xterm.
> > > 
> > > Based on above diff I have prepared a wrapper script and a patch:
> > > 
> > > http://mpa.itc.it/markus/xterm_wrapper/
> > > 
> > > I am not sure if and where the 'exec's are needed (see patch)
> > 
> > I suggest ending the script with:
> > 
> > 	# run command
> > 	exec $GRASS_XTERM "$@"
> > 
> > The lines which are executed after xterm completes aren't meaningful
> > unless you're running from a terminal, which won't be the case in any
> > situation where the script is actually used (the only reason for
> > spawning an xterm is if you don't already have a terminal, i.e. when
> > running commands from d.m/gis.m).
> > 
> > The wrapper should probably go into $GISBASE/etc, in which case the
> > patch needs to use $GISBASE/etc/grass-xterm-wrapper (or
> > $env(GISBASE)/etc/grass-xterm-wrapper for Tcl code) rather than just
> > grass-xterm-wrapper.
> > 
> > Also, Init.sh should probably set GRASS_XTERM to x-terminal-emulator
> > if it is available. IIRC, x-terminal-emulator runs the user's
> > preferred terminal emulator (xterm, kterm etc), so it should always be
> > preferred over xterm if it's available.
> 
> Thanks for your comments. I have implemented all of them,
> revised patch at
> 
> http://mpa.itc.it/markus/xterm_wrapper/
> 
> One problem remains:
> etc/grass-run.sh seems to fail (now?). I tested:
> 
> gis.m
> -> Raster
>    -> Map calculator
>      -> Formula: 1
>         Resulting output map: mytest
> 
>         -> Run runs ok, but
>            Run in Xterm fails with
> 
>  /home/neteler/soft/61grass_cvsexp/dist.i686-pc-linux-gnu/etc/grass-run.sh: line 30: : command not found
> 
> this line contains "$@". Seems to be tricky with a script calling
> a program calling a script ...

For the ease of testing I have submitting the patch
to CVS-HEAD. I don't expect problems but it remains above issue
with etc/grass-run.sh.

Markus




More information about the grass-dev mailing list