Fri, Feb 16 2007
16:23:37
|
|
Request created by guest (as #5497)
|
|
Subject: r.in.wms
Power Mac G5
PowerMac7,2
PowerPC 970 (2.2)
# CPU: 2
CPU: 1.8 GHz
Caché level 2 by CPU: 512 KB
Memory: 1 GB
bus: 900 MHz
ROM: 5.1.4f0
Binary downloaded from www.kynchaos.com GRASS 6.3.0-CVS-07020401
r.in.wms fails with the following:
GRASS 6.3.0-CVS-07020401
(Projecte):/Applications/Grass/GRASS_63_cvs_070205.app/Contents/Resources >
r.in.wms layers=global_mosaic mapserver=http://wms.jpl.nasa.gov/wms.cgi
output=wms_global_mosaic srs=EPSG:4230
wms.request
'folder=/Volumes/LaCieDisk/Users/Shared/agus_compartido/grassdata/wms_download'
'prefix=wms_global_mosaic' 'mapserver=http://wms.jpl.nasa.gov/wms.cgi'
'layers=global_mosaic' 'srs=EPSG:4230' 'format=geotiff'
'wmsquery=version=1.1.1' 'maxcols=1024' 'maxrows=1024'
###############################
Calculating tiles
###############################
usage: units [-f unitsfile] [-q] [-v] [from-unit to-unit]
/Applications/Grass/GRASS_63_cvs_070205.app/Contents/Resources/scripts/r.tileset:
line 1: [0]=SOURCE_PROJ: command not found
/Applications/Grass/GRASS_63_cvs_070205.app/Contents/Resources/scripts/r.tileset:
line 1: [1]=1: command not found
/Applications/Grass/GRASS_63_cvs_070205.app/Contents/Resources/scripts/r.tileset:
line 1: [2]=DEST_PROJ: command not found
/Applications/Grass/GRASS_63_cvs_070205.app/Contents/Resources/scripts/r.tileset:
line 1: [3]=SOURCE_TO_DEST: command not found
/Applications/Grass/GRASS_63_cvs_070205.app/Contents/Resources/scripts/r.tileset:
line 1: [0]=DEST_PROJ: command not found
/Applications/Grass/GRASS_63_cvs_070205.app/Contents/Resources/scripts/r.tileset:
line 1: [1]=SOURCE_PROJ: command not found
/Applications/Grass/GRASS_63_cvs_070205.app/Contents/Resources/scripts/r.tileset:
line 1: [2]=1: command not found
/Applications/Grass/GRASS_63_cvs_070205.app/Contents/Resources/scripts/r.tileset:
line 1: [3]=DEST_TO_SOURCE: command not found
(standard_in) 2: parse error
(standard_in) 2: parse error
Rel. 4.4.8, 3 May 2004
<cs2cs>:
projection initialization failure
cause: no arguments in initialization list
program abnormally terminated
(standard_in) 1: illegal character: U
(standard_in) 2: parse error
(standard_in) 2: parse error
(standard_in) 2: parse error
(standard_in) 2: parse error
Rel. 4.4.8, 3 May 2004
<cs2cs>:
projection initialization failure
cause: no arguments in initialization list
program abnormally terminated
(standard_in) 1: illegal character: U
(standard_in) 2: parse error
(standard_in) 2: parse error
(standard_in) 2: parse error
(standard_in) 2: parse error
Rel. 4.4.8, 3 May 2004
<cs2cs>:
projection initialization failure
cause: no arguments in initialization list
program abnormally terminated
(standard_in) 1: illegal character: U
(standard_in) 2: parse error
(standard_in) 2: parse error
(standard_in) 2: parse error
(standard_in) 2: parse error
Rel. 4.4.8, 3 May 2004
<cs2cs>:
projection initialization failure
cause: no arguments in initialization list
program abnormally terminated
(standard_in) 1: illegal character: U
(standard_in) 2: parse error
(standard_in) 2: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
/Applications/Grass/GRASS_63_cvs_070205.app/Contents/Resources/scripts/r.tileset:
line 1: =${0[p_source_proj_p]}: bad substitution
/Applications/Grass/GRASS_63_cvs_070205.app/Contents/Resources/scripts/r.tileset:
line 1: =${1[p_source_units]}: bad substitution
/Applications/Grass/GRASS_63_cvs_070205.app/Contents/Resources/scripts/r.tileset:
line 1: =${2[p_dest_proj_p]}: bad substitution
/Applications/Grass/GRASS_63_cvs_070205.app/Contents/Resources/scripts/r.tileset:
line 1: =${3[p_dest_units]}: bad substitution
(standard_in) 1: illegal character: S
(standard_in) 1: illegal character: O
(standard_in) 1: illegal character: U
(standard_in) 1: illegal character: R
(standard_in) 1: illegal character: _
(standard_in) 1: parse error
(standard_in) 1: illegal character: O
(standard_in) 1: illegal character: X
(standard_in) 1: illegal character: _
(standard_in) 1: illegal character: S
(standard_in) 1: illegal character: T
(standard_in) 1: illegal character: _
(standard_in) 1: illegal character: P
(standard_in) 1: illegal character: O
(standard_in) 1: illegal character: I
(standard_in) 1: illegal character: N
(standard_in) 1: illegal character: T
(standard_in) 1: illegal character: S
(standard_in) 1: illegal character: S
(standard_in) 1: illegal character: O
(standard_in) 1: illegal character: U
(standard_in) 1: illegal character: R
(standard_in) 1: illegal character: _
(standard_in) 1: parse error
(standard_in) 1: illegal character: O
(standard_in) 1: illegal character: X
(standard_in) 1: illegal character: _
(standard_in) 1: illegal character: S
(standard_in) 1: illegal character: T
(standard_in) 1: illegal character: _
(standard_in) 1: illegal character: P
(standard_in) 1: illegal character: O
(standard_in) 1: illegal character: I
(standard_in) 1: illegal character: N
(standard_in) 1: illegal character: T
(standard_in) 1: illegal character: S
Rel. 4.4.8, 3 May 2004
<cs2cs>:
projection initialization failure
cause: no arguments in initialization list
program abnormally terminated
(standard_in) 1: illegal character: U
(standard_in) 2: parse error
(standard_in) 2: parse error
/Applications/Grass/GRASS_63_cvs_070205.app/Contents/Resources/scripts/r.tileset:
line 1: =: command not found
/Applications/Grass/GRASS_63_cvs_070205.app/Contents/Resources/scripts/r.tileset:
line 1: =${0[p_source_proj_p]}: bad substitution
/Applications/Grass/GRASS_63_cvs_070205.app/Contents/Resources/scripts/r.tileset:
line 1: =${1[p_source_units]}: bad substitution
/Applications/Grass/GRASS_63_cvs_070205.app/Contents/Resources/scripts/r.tileset:
line 1: =${2[p_dest_proj_p]}: bad substitution
/Applications/Grass/GRASS_63_cvs_070205.app/Contents/Resources/scripts/r.tileset:
line 1: =${3[p_dest_units]}: bad substitution
(standard_in) 1: illegal character: S
(standard_in) 1: illegal character: O
(standard_in) 1: illegal character: U
(standard_in) 1: illegal character: R
(standard_in) 1: illegal character: _
(standard_in) 1: parse error
(standard_in) 1: illegal character: O
(standard_in) 1: illegal character: X
(standard_in) 1: illegal character: _
(standard_in) 1: illegal character: S
(standard_in) 1: illegal character: T
(standard_in) 1: illegal character: _
(standard_in) 1: illegal character: P
(standard_in) 1: illegal character: O
(standard_in) 1: illegal character: I
(standard_in) 1: illegal character: N
(standard_in) 1: illegal character: T
(standard_in) 1: illegal character: S
(standard_in) 1: illegal character: S
(standard_in) 1: illegal character: O
(standard_in) 1: illegal character: U
(standard_in) 1: illegal character: R
(standard_in) 1: illegal character: _
(standard_in) 1: parse error
(standard_in) 1: illegal character: O
(standard_in) 1: illegal character: X
(standard_in) 1: illegal character: _
(standard_in) 1: illegal character: S
(standard_in) 1: illegal character: T
(standard_in) 1: illegal character: _
(standard_in) 1: illegal character: P
(standard_in) 1: illegal character: O
(standard_in) 1: illegal character: I
(standard_in) 1: illegal character: N
(standard_in) 1: illegal character: T
(standard_in) 1: illegal character: S
Rel. 4.4.8, 3 May 2004
<cs2cs>:
projection initialization failure
cause: no arguments in initialization list
program abnormally terminated
(standard_in) 1: illegal character: U
(standard_in) 2: parse error
(standard_in) 2: parse error
/Applications/Grass/GRASS_63_cvs_070205.app/Contents/Resources/scripts/r.tileset:
line 1: =: command not found
/Applications/Grass/GRASS_63_cvs_070205.app/Contents/Resources/scripts/r.tileset:
line 1: =${0[p_source_proj_p]}: bad substitution
/Applications/Grass/GRASS_63_cvs_070205.app/Contents/Resources/scripts/r.tileset:
line 1: =${1[p_source_units]}: bad substitution
/Applications/Grass/GRASS_63_cvs_070205.app/Contents/Resources/scripts/r.tileset:
line 1: =${2[p_dest_proj_p]}: bad substitution
/Applications/Grass/GRASS_63_cvs_070205.app/Contents/Resources/scripts/r.tileset:
line 1: =${3[p_dest_units]}: bad substitution
(standard_in) 1: illegal character: S
(standard_in) 1: illegal character: O
(standard_in) 1: illegal character: U
(standard_in) 1: illegal character: R
(standard_in) 1: illegal character: _
(standard_in) 1: parse error
(standard_in) 1: illegal character: O
(standard_in) 1: illegal character: X
(standard_in) 1: illegal character: _
(standard_in) 1: illegal character: S
(standard_in) 1: illegal character: T
(standard_in) 1: illegal character: _
(standard_in) 1: illegal character: P
(standard_in) 1: illegal character: O
(standard_in) 1: illegal character: I
(standard_in) 1: illegal character: N
(standard_in) 1: illegal character: T
(standard_in) 1: illegal character: S
(standard_in) 1: illegal character: S
(standard_in) 1: illegal character: O
(standard_in) 1: illegal character: U
(standard_in) 1: illegal character: R
(standard_in) 1: illegal character: _
(standard_in) 1: parse error
(standard_in) 1: illegal character: O
(standard_in) 1: illegal character: X
(standard_in) 1: illegal character: _
(standard_in) 1: illegal character: S
(standard_in) 1: illegal character: T
(standard_in) 1: illegal character: _
(standard_in) 1: illegal character: P
(standard_in) 1: illegal character: O
(standard_in) 1: illegal character: I
(standard_in) 1: illegal character: N
(standard_in) 1: illegal character: T
(standard_in) 1: illegal character: S
Rel. 4.4.8, 3 May 2004
<cs2cs>:
projection initialization failure
cause: no arguments in initialization list
program abnormally terminated
(standard_in) 1: illegal character: U
(standard_in) 2: parse error
(standard_in) 2: parse error
/Applications/Grass/GRASS_63_cvs_070205.app/Contents/Resources/scripts/r.tileset:
line 1: =: command not found
/Applications/Grass/GRASS_63_cvs_070205.app/Contents/Resources/scripts/r.tileset:
line 1: =${0[p_source_proj_p]}: bad substitution
/Applications/Grass/GRASS_63_cvs_070205.app/Contents/Resources/scripts/r.tileset:
line 1: =${1[p_source_units]}: bad substitution
/Applications/Grass/GRASS_63_cvs_070205.app/Contents/Resources/scripts/r.tileset:
line 1: =${2[p_dest_proj_p]}: bad substitution
/Applications/Grass/GRASS_63_cvs_070205.app/Contents/Resources/scripts/r.tileset:
line 1: =${3[p_dest_units]}: bad substitution
(standard_in) 1: illegal character: S
(standard_in) 1: illegal character: O
(standard_in) 1: illegal character: U
(standard_in) 1: illegal character: R
(standard_in) 1: illegal character: _
(standard_in) 1: parse error
(standard_in) 1: illegal character: O
(standard_in) 1: illegal character: X
(standard_in) 1: illegal character: _
(standard_in) 1: illegal character: S
(standard_in) 1: illegal character: T
(standard_in) 1: illegal character: _
(standard_in) 1: illegal character: P
(standard_in) 1: illegal character: O
(standard_in) 1: illegal character: I
(standard_in) 1: illegal character: N
(standard_in) 1: illegal character: T
(standard_in) 1: illegal character: S
(standard_in) 1: illegal character: S
(standard_in) 1: illegal character: O
(standard_in) 1: illegal character: U
(standard_in) 1: illegal character: R
(standard_in) 1: illegal character: _
(standard_in) 1: parse error
(standard_in) 1: illegal character: O
(standard_in) 1: illegal character: X
(standard_in) 1: illegal character: _
(standard_in) 1: illegal character: S
(standard_in) 1: illegal character: T
(standard_in) 1: illegal character: _
(standard_in) 1: illegal character: P
(standard_in) 1: illegal character: O
(standard_in) 1: illegal character: I
(standard_in) 1: illegal character: N
(standard_in) 1: illegal character: T
(standard_in) 1: illegal character: S
Rel. 4.4.8, 3 May 2004
<cs2cs>:
projection initialization failure
cause: no arguments in initialization list
program abnormally terminated
(standard_in) 1: illegal character: U
(standard_in) 2: parse error
(standard_in) 2: parse error
/Applications/Grass/GRASS_63_cvs_070205.app/Contents/Resources/scripts/r.tileset:
line 1: =: command not found
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
###################################
Requesting 0 tiles!
###################################
wms.download
'requestfile=/Volumes/LaCieDisk/Users/Shared/agus_compartido/grassdata/wms_download/wms_global_mosai
c_.wget'
'wgetoptions=-c -t 5 --user-agent=MSIE5.5'
###############################
Downloading tiles
###############################
#################################
All tiles downloaded successfully
#################################
r.in.gdalwarp -c 'output=wms_global_mosaic' 'method=nearest' 's_srs=EPSG:4230'
ERROR: Required parameter <input> not set:
(Raster file or files to be imported. If multiple files are specified they
will be patched together.).
|
|
Sat, Feb 17 2007
13:35:15
|
|
Status changed to resolved by msieczka (as #5497)
|
|
Sat, Feb 17 2007
13:35:15
|
|
Mail sent by msieczka (as #5497)
|
|
Hi
Please read http://grass.itc.it/bugtracking/index.php
I'm closing this ticket as RT is no longer in actiove use. PLease report it to
current GRASS bug tracker at GForge.
Maciek
|
|
Sat, Feb 17 2007
13:35:24
|
|
Area changed to grass6 by msieczka (as #5497)
|
|
Sun, Feb 18 2007
16:47:52
|
|
Request created by guest
|
|
Subject: bash scripts starting with #!/bin/sh
Platform: GNU/Linux/x86
grass obtained from: Other (CDROM etc)
grass binary for platform: Downloaded precompiled Binaries
GRASS Version: 6.2.1
I experienced problems with Ubuntu 6.10 installation. The r.in.wms script refused
to work with errors like this:
/usr/lib/grass/etc/r.in.wms//wms.request: 326: SIZE_ARRAY[0]=: not found
/usr/lib/grass/scripts/r.tileset: 193: declare: not found
/usr/lib/grass/scripts/r.tileset: 258: Syntax error: Bad for loop variable
It took me about a couple of hours to find out that the reason is that Ubuntu
developers decided to change the symbolic link /bin/sh from /bin/bash to /bin/dash,
which is POSIX-compliant, but much less feature-rich than bash.
Setting it back to /bin/bash solved the problem, but still indicating the right
interpreter in the headers will also be great. |
|
Sun, Feb 18 2007
23:57:18
|
|
Request 5497 merged into 5499 by msieczka (as #5497)
|
|
Mon, Feb 19 2007
00:30:47
|
|
Mail sent by msieczka
|
|
guest wrote (Sun, Feb 18 2007 16:47:52):
> I experienced problems with Ubuntu 6.10 installation. The r.in.wms script
> refused to work with errors like this:
> /usr/lib/grass/etc/r.in.wms//wms.request: 326: SIZE_ARRAY[0]=: not found
> /usr/lib/grass/scripts/r.tileset: 193: declare: not found
> /usr/lib/grass/scripts/r.tileset: 258: Syntax error: Bad for loop variable
>
> It took me about a couple of hours to find out that the reason is that
> Ubuntu developers decided to change the symbolic link /bin/sh from /bin/bash
> to /bin/dash, which is POSIX-compliant, but much less feature-rich than
> bash.
>
> Setting it back to /bin/bash solved the problem, but still indicating the
> right interpreter in the headers will also be great.
Hi,
Thanks for the report and the hint of what is going on. Well spotted.
However, please don't report to this tracker in future - read the
http://grass.itc.it/bugtracking/index.php. We are working on disabling the old
RT for good.
Since the issue has been reported twice to RT anyway, I'll let myself to
continue here, especially that it seems big.
AFAIK, GRASS shell scripts are supposed to work with any POSIX 1003.2
compliant sh interpreter. Apparently some still don't, eg. r.tileset and
r.in.wms as we can see.
As the bash->dash switch in Ubuntu 6.1 seems inrevertable (see:
https://launchpad.net/ubuntu/+source/dash/+bug/61463, the comment by Matthew
Garrett at 2006-11-29 05:23:16 UTC, in particular), and it looks justified
from technical point of view, we have 3 options it seems:
1. Have (some) GRASS sh scripts broken for Ubuntu (what if other distros
follow Ubuntu?). What with platforms not providing bash?
2. Revise all the scripts and fix all bashisms; buts:
- who would do it?
- it takes quite some knowledge to decide what needs to be fixed, and it could
take much time
- what with the addons? remove all that are not POSIX-compliant? fix them
ourselves? Anyway, much work.
3. Change all GRASS sh scripts to require #/bin/bash. Least work. But what
with platforms not providing bash?
Maciek
|
|
Mon, Feb 19 2007
00:36:19
|
|
Mail sent by glynn@gclements.plus.com
|
|
Return-Path |
<glynn@gclements.plus.com>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
From |
Glynn Clements <glynn@gclements.plus.com>
|
MIME-Version |
1.0
|
Content-Type |
text/plain; charset=us-ascii
|
Content-Transfer-Encoding |
7bit
|
Message-ID |
<17880.58095.281624.559380@cerise.gclements.plus.com>
|
Date |
Sun, 18 Feb 2007 23:36:15 +0000
|
To |
Request Tracker <grass-bugs@intevation.de>
|
Cc |
grass-dev@grass.itc.it
|
Subject |
Re: [GRASS-dev] [bug #5499] (grass) bash scripts starting with #!/bin/sh
|
In-Reply-To |
<20070218154752.C0D161005BC@lists.intevation.de>
|
References |
<20070218154752.C0D161005BC@lists.intevation.de>
|
X-Mailer |
VM 7.07 under 21.4 (patch 20) "Double Solitaire" XEmacs Lucid
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, score=-4.665 tagged_above=-999 required=3 tests=[BAYES_00=-5, DNS_FROM_RFC_ABUSE=0.2, FORGED_RCVD_HELO=0.135]
|
X-Spam-Score |
-4.665
|
X-Spam-Level |
|
Request Tracker wrote:
> this bug's URL: http://intevation.de/rt/webrt?serial_num=5499
> -------------------------------------------------------------------------
>
> Subject: bash scripts starting with #!/bin/sh
>
> Platform: GNU/Linux/x86
> grass obtained from: Other (CDROM etc)
> grass binary for platform: Downloaded precompiled Binaries
> GRASS Version: 6.2.1
>
> I experienced problems with Ubuntu 6.10 installation. The r.in.wms script refused
to work with errors like this:
> /usr/lib/grass/etc/r.in.wms//wms.request: 326: SIZE_ARRAY[0]=: not found
> /usr/lib/grass/scripts/r.tileset: 193: declare: not found
> /usr/lib/grass/scripts/r.tileset: 258: Syntax error: Bad for loop variable
>
> It took me about a couple of hours to find out that the reason is that
> Ubuntu developers decided to change the symbolic link /bin/sh from
> /bin/bash to /bin/dash, which is POSIX-compliant, but much less
> feature-rich than bash.
>
> Setting it back to /bin/bash solved the problem, but still indicating
> the right interpreter in the headers will also be great.
The problem is that you can't rely upon bash being installed in a
specific location[1]. On Linux, it's the "primary" shell, so it's
/bin. On Unices which include it as an "extra", it's likely to be in
/usr/bin. If it isn't part of the core OS, it could be anywhere,
although /usr/local/bin, /sw/bin and /opt/sw/bin are all plausible.
[1] Actually, you can't rely upon bash being installed at all. GRASS
isn't specifically a Linux package; at least, it isn't supposed to be.
The only thing which you can absolutely rely upon is that /bin/sh will
be a POSIX-compatible Bourne shell. Anyone writing scripts would do
well to bear this in mind (IOW, please avoid using bash-specific
features).
--
Glynn Clements <glynn@gclements.plus.com>
|
|
Mon, Feb 19 2007
01:35:12
|
|
Mail sent by glynn@gclements.plus.com
|
|
Return-Path |
<glynn@gclements.plus.com>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
From |
Glynn Clements <glynn@gclements.plus.com>
|
MIME-Version |
1.0
|
Content-Type |
text/plain; charset=us-ascii
|
Content-Transfer-Encoding |
7bit
|
Message-ID |
<17880.61624.726813.848862@cerise.gclements.plus.com>
|
Date |
Mon, 19 Feb 2007 00:35:04 +0000
|
To |
Maciek Sieczka via RT <grass-bugs@intevation.de>
|
Cc |
adiez@uv.es, egor@altlinux.ru, grass-dev@grass.itc.it
|
Subject |
Re: [GRASS-dev] [bug #5499] (grass) bash scripts starting with #!/bin/sh
|
In-Reply-To |
<20070218233048.26C6C1006B5@lists.intevation.de>
|
References |
<20070218233048.26C6C1006B5@lists.intevation.de>
|
X-Mailer |
VM 7.07 under 21.4 (patch 20) "Double Solitaire" XEmacs Lucid
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, score=-4.665 tagged_above=-999 required=3 tests=[BAYES_00=-5, DNS_FROM_RFC_ABUSE=0.2, FORGED_RCVD_HELO=0.135]
|
X-Spam-Score |
-4.665
|
X-Spam-Level |
|
Maciek Sieczka via RT wrote:
> AFAIK, GRASS shell scripts are supposed to work with any POSIX 1003.2
> compliant sh interpreter. Apparently some still don't, eg. r.tileset and
> r.in.wms as we can see.
>
> As the bash->dash switch in Ubuntu 6.1 seems inrevertable (see:
> https://launchpad.net/ubuntu/+source/dash/+bug/61463, the comment by Matthew
> Garrett at 2006-11-29 05:23:16 UTC, in particular), and it looks justified
> from technical point of view,
Note that NetBSD has always used "ash" as its /bin/sh, as do a number
of embedded Linux distributions. Also, most commercial Unices use
something other than bash as their /bin/sh.
In general, assuming /bin/sh == bash is a bad idea.
> we have 3 options it seems:
>
> 1. Have (some) GRASS sh scripts broken for Ubuntu (what if other distros
> follow Ubuntu?). What with platforms not providing bash?
The only sensible option, IMHO.
> 2. Revise all the scripts and fix all bashisms; buts:
> - who would do it?
> - it takes quite some knowledge to decide what needs to be fixed, and it could
> take much time
> - what with the addons? remove all that are not POSIX-compliant? fix them
> ourselves? Anyway, much work.
Change them to #!/usr/local/bin/bash. Users who have bash will have to
change the path; users who don't have bash will at least get a
reasonably straightforward error message, e.g.:
/usr/local/bin/bash: bad interpreter: No such file or directory
rather than obscure problems with the script (or, worse still, no
error but bogus results).
Either way, most users will have an incentive to either fix the script
or at least provide us with a continual stream of reminders that our
scripts are broken.
> 3. Change all GRASS sh scripts to require #/bin/bash. Least work. But what
> with platforms not providing bash?
Or not installing it in /bin (i.e. probably anything where bash isn't
the primary shell, e.g. most commercial Unices).
Note that /bin (and /sbin, /lib etc) are meant for programs which need
to work when /usr doesn't exist (e.g. if /usr is on NFS, anything
which is required to configure and enable networking can't go under
/usr). If bash isn't a core part of the OS (i.e. it isn't /bin/sh),
there's a good chance that it won't be in /bin.
--
Glynn Clements <glynn@gclements.plus.com>
|
|
Mon, Feb 19 2007
05:44:39
|
|
Mail sent by hamish_nospam@yahoo.com
|
|
Return-Path |
<hamish_nospam@yahoo.com>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
Date |
Mon, 19 Feb 2007 17:44:20 +1300
|
From |
Hamish <hamish_nospam@yahoo.com>
|
To |
Maciek Sieczka via RT <grass-bugs@intevation.de>
|
Cc |
adiez@uv.es, egor@altlinux.ru, grass-dev@grass.itc.it
|
Subject |
Re: [GRASS-dev] [bug #5499] (grass) bash scripts starting with #!/bin/sh
|
Message-Id |
<20070219174420.33ba16b6.hamish_nospam@yahoo.com>
|
In-Reply-To |
<20070218233048.26C6C1006B5@lists.intevation.de>
|
References |
<20070218233048.26C6C1006B5@lists.intevation.de>
|
X-Mailer |
Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-pc-linux-gnu)
|
X-Face |
M<EoB)"*Z~u!,vFhXmw}R_KbdBta*P_=T|rbBL'e1/CQ9;/1g\BU3&!=y8ria$2Uk!HT&BB 8i?|X_+7~1jsy}F~g$2va%3fV`*=L(*cem[@3\yg,G,@rg6/QMJ
|
Mime-Version |
1.0
|
Content-Type |
text/plain; charset=US-ASCII
|
Content-Transfer-Encoding |
7bit
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, score=0.204 tagged_above=-999 required=3 tests=[BAYES_00=-5, DNS_FROM_RFC_ABUSE=0.2, DNS_FROM_RFC_POST=1.708, DNS_FROM_RFC_WHOIS=1.447, FORGED_YAHOO_RCVD=1.849]
|
X-Spam-Score |
0.204
|
X-Spam-Level |
|
> > I experienced problems with Ubuntu 6.10 installation. The r.in.wms
> > script refused to work with errors like this:
> > /usr/lib/grass/etc/r.in.wms//wms.request: 326: SIZE_ARRAY[0]=: not
> > found /usr/lib/grass/scripts/r.tileset: 193: declare: not found
> > /usr/lib/grass/scripts/r.tileset: 258: Syntax error: Bad for loop
> > variable
> >
> > It took me about a couple of hours to find out that the reason is
> > that Ubuntu developers decided to change the symbolic link /bin/sh
> > from /bin/bash to /bin/dash, which is POSIX-compliant, but much less
> > feature-rich than bash.
> >
> > Setting it back to /bin/bash solved the problem, but still
> > indicating the right interpreter in the headers will also be great.
Maciek:
> AFAIK, GRASS shell scripts are supposed to work with any POSIX 1003.2
> compliant sh interpreter. Apparently some still don't, eg. r.tileset
> and r.in.wms as we can see.
>
> As the bash->dash switch in Ubuntu 6.1 seems inrevertable (see:
> https://launchpad.net/ubuntu/+source/dash/+bug/61463, the comment by
> Matthew Garrett at 2006-11-29 05:23:16 UTC, in particular), and it
> looks justified from technical point of view, we have 3 options it
> seems:
>
> 1. Have (some) GRASS sh scripts broken for Ubuntu (what if other
> distros follow Ubuntu?). What with platforms not providing bash?
Markus and others have gone to a lot of trouble to remove all bashisms
from all the scripts/. AFAIK this is an isolated problem with r.tileset.
All we need to do is fix that and the job is done, all other scripts
should be free of Bashisms already.
> 2. Revise all the scripts and fix all bashisms; buts:
> - who would do it?
Preferably the module's author. "No Bashisms" is in SUBMITTING_SCRIPTS.
But shell scripts are pretty easy to debug by adding -x.
Everyone can play along at home by changing the first line of the script
to "#!/bin/ash -x" and follow the output trail.
> - it takes quite some knowledge to decide what needs to be fixed,
perhaps. some hints on common bashisms:
--
export VAR=foo
must be written as
VAR=foo
export VAR
--
$((exp)) doesn't work. use `expr` instead
--
use "=" not "==" for string compares
--
> and it could take much time
probably not, if it is limited to r.in.wms + its support scripts.
> - what with the addons? remove all that are not POSIX-compliant? fix
> them ourselves? Anyway, much work.
Not our problem. They are provided as-is by their authors.
> 3. Change all GRASS sh scripts to require #/bin/bash. Least work. But
> what with platforms not providing bash?
Not needed as it is only one script (family) that is broken?
Anyway, bug #5499 is from r.tileset:
if [ -z "$GIS_OPT_DESTSCALE" ] ; then
eval `g.proj -p | $GREP meters | $SED "s/\\s*:\\s*/=/"`
DEST_SCALE=$meters;
G63> g.proj -p | grep meters | sed "s/\\s*:\\s*/=/"
units = meters
meters = 1.0
^^^ it's trying to run that string as a program....
-x debug output:
+ eval units = meters meters = 1.0
++ units = meters meters = 1.0
Too many arguments (maybe you need quotes).
Try `units --help' for more information.
r.tileset --help
..
Parameters:
destscale Conversion factor from units to meters in source projection
I propose this fix:
Index: r.tileset
===================================================================
RCS file:
/home/grass/grassrepository/grass6/scripts/r.tileset/r.tileset,v
retrieving revision 1.3
diff -u -r1.3 r.tileset
--- r.tileset 19 Aug 2006 12:52:24 -0000 1.3
+++ r.tileset 19 Feb 2007 04:26:44 -0000
@@ -393,7 +393,7 @@
message 0 "Getting projection scale:"
if [ -z "$GIS_OPT_DESTSCALE" ] ; then
- eval `g.proj -p | $GREP meters | $SED "s/\\s*:\\s*/=/"`
+ eval `g.proj -p | $GREP '^meters' | $SED -e "s/\\s*:\\s*/=/" -e "s/ //g"`
DEST_SCALE=$meters;
else
DEST_SCALE=$GIS_OPT_DESTSCALE
(my regex sucks, what does the "\\s*" part of "\\s*:\\s*" match?)
And adding exit code checks at vital junctures in the r.in.wms script so
it stops as soon as it breaks.
r.in.wms then goes on, but gdalwarp fails because
$GISDBASE/wms_download/wms_global_mosaic__0.geotiff is text not an image:
<?xml version='1.0' encoding="UTF-8" standalone="no" ?>
<!DOCTYPE ServiceExceptionReport SYSTEM "http://www.digitalearth.gov/wmt/xml/exception_1_1_0.dtd
">
<ServiceExceptionReport version="1.1.0">
<ServiceException code="InvalidSRS">
The SRS "EPSG:4230" is invalid.
</ServiceException>
</ServiceExceptionReport>
(...proof that more sanity checks needed in the script!)
Hamish
|
|
Mon, Feb 19 2007
17:41:54
|
|
Mail sent by glynn@gclements.plus.com
|
|
Return-Path |
<glynn@gclements.plus.com>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
From |
Glynn Clements <glynn@gclements.plus.com>
|
MIME-Version |
1.0
|
Content-Type |
text/plain; charset=us-ascii
|
Content-Transfer-Encoding |
7bit
|
Message-ID |
<17881.54091.269868.854802@cerise.gclements.plus.com>
|
Date |
Mon, 19 Feb 2007 16:41:47 +0000
|
To |
Hamish <hamish_nospam@yahoo.com>
|
Cc |
Maciek Sieczka via RT <grass-bugs@intevation.de>, grass-dev@grass.itc.it, egor@altlinux.ru, adiez@uv.es
|
Subject |
Re: [GRASS-dev] [bug #5499] (grass) bash scripts starting with #!/bin/sh
|
In-Reply-To |
<20070219174420.33ba16b6.hamish_nospam@yahoo.com>
|
References |
<20070218233048.26C6C1006B5@lists.intevation.de> <20070219174420.33ba16b6.hamish_nospam@yahoo.com>
|
X-Mailer |
VM 7.07 under 21.4 (patch 20) "Double Solitaire" XEmacs Lucid
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, score=-4.665 tagged_above=-999 required=3 tests=[BAYES_00=-5, DNS_FROM_RFC_ABUSE=0.2, FORGED_RCVD_HELO=0.135]
|
X-Spam-Score |
-4.665
|
X-Spam-Level |
|
Hamish wrote:
> (my regex sucks, what does the "\\s*" part of "\\s*:\\s*" match?)
My guess would be that it's supposed to match any "whitespace"
character, but that's non-standard (it works in GNU sed 4.1.5, but
doesn't appear to be documented in the sed Info file). More portable
solutions include:
1. Just use a space.
2. Use a set containing a space or a tab, i.e. [ <tab>] where <tab> is
a literal tab character.
3. Use [:space:] or [:blank:]. The latter matches space or tab, while
the former matches a locale-dependent set; in the C/POSIX locale, it
matches space, tab, newline, carriage-return, form-feed and
vertical-tab.
--
Glynn Clements <glynn@gclements.plus.com>
|
|
Tue, Feb 20 2007
05:08:30
|
|
Mail sent by hamish_nospam@yahoo.com
|
|
Return-Path |
<hamish_nospam@yahoo.com>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
Date |
Tue, 20 Feb 2007 15:42:24 +1300
|
From |
Hamish <hamish_nospam@yahoo.com>
|
To |
grass-dev@grass.itc.it
|
Cc |
grass-bugs@intevation.de
|
Subject |
Re: [GRASS-dev] [bug #5499] (grass) bash scripts starting with #!/bin/sh
|
Message-Id |
<20070220154224.4b0527c5.hamish_nospam@yahoo.com>
|
In-Reply-To |
<17880.58095.281624.559380@cerise.gclements.plus.com>
|
References |
<20070218154752.C0D161005BC@lists.intevation.de> <17880.58095.281624.559380@cerise.gclements.plus.com>
|
X-Mailer |
Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-pc-linux-gnu)
|
X-Face |
M<EoB)"*Z~u!,vFhXmw}R_KbdBta*P_=T|rbBL'e1/CQ9;/1g\BU3&!=y8ria$2Uk!HT&BB 8i?|X_+7~1jsy}F~g$2va%3fV`*=L(*cem[@3\yg,G,@rg6/QMJ
|
Mime-Version |
1.0
|
Content-Type |
text/plain; charset=US-ASCII
|
Content-Transfer-Encoding |
7bit
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, score=0.204 tagged_above=-999 required=3 tests=[BAYES_00=-5, DNS_FROM_RFC_ABUSE=0.2, DNS_FROM_RFC_POST=1.708, DNS_FROM_RFC_WHOIS=1.447, FORGED_YAHOO_RCVD=1.849]
|
X-Spam-Score |
0.204
|
X-Spam-Level |
|
> > I experienced problems with Ubuntu 6.10 installation. The r.in.wms
> > script refused to work with errors like this:
> > /usr/lib/grass/etc/r.in.wms//wms.request: 326: SIZE_ARRAY[0]=: not
> > found
The broken PROJ_UNITS parsing in r.tileset is fixed in 6.3 CVS and
backported to the 6.2.x branch.
The bash vs. ash issue in r.in.wms is not fixed.
is this valid Bourne sh or is it a Bash extension?
SIZE_ARRAY[0]=""
this link indicates that they are Bash only:
http://tldp.org/LDP/abs/html/arrays.html
more on arrays (concept is new to me)
http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_10_02.html
Hamish
|
|
Tue, Feb 20 2007
17:46:19
|
|
Mail sent by glynn@gclements.plus.com
|
|
Return-Path |
<glynn@gclements.plus.com>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
From |
Glynn Clements <glynn@gclements.plus.com>
|
MIME-Version |
1.0
|
Content-Type |
text/plain; charset=us-ascii
|
Content-Transfer-Encoding |
7bit
|
Message-ID |
<17883.9678.63357.53654@cerise.gclements.plus.com>
|
Date |
Tue, 20 Feb 2007 16:46:06 +0000
|
To |
Hamish <hamish_nospam@yahoo.com>
|
Cc |
grass-dev@grass.itc.it, grass-bugs@intevation.de
|
Subject |
Re: [GRASS-dev] [bug #5499] (grass) bash scripts starting with #!/bin/sh
|
In-Reply-To |
<20070220154224.4b0527c5.hamish_nospam@yahoo.com>
|
References |
<20070218154752.C0D161005BC@lists.intevation.de> <17880.58095.281624.559380@cerise.gclements.plus.com> <20070220154224.4b0527c5.hamish_nospam@yahoo.com>
|
X-Mailer |
VM 7.07 under 21.4 (patch 20) "Double Solitaire" XEmacs Lucid
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, score=-4.665 tagged_above=-999 required=3 tests=[BAYES_00=-5, DNS_FROM_RFC_ABUSE=0.2, FORGED_RCVD_HELO=0.135]
|
X-Spam-Score |
-4.665
|
X-Spam-Level |
|
Hamish wrote:
> > > I experienced problems with Ubuntu 6.10 installation. The r.in.wms
> > > script refused to work with errors like this:
> > > /usr/lib/grass/etc/r.in.wms//wms.request: 326: SIZE_ARRAY[0]=: not
> > > found
>
> The broken PROJ_UNITS parsing in r.tileset is fixed in 6.3 CVS and
> backported to the 6.2.x branch.
>
>
> The bash vs. ash issue in r.in.wms is not fixed.
>
>
> is this valid Bourne sh or is it a Bash extension?
>
> SIZE_ARRAY[0]=""
Arrays are a bash extension.
AFAICT, the array is never actually used, so removing that line should
be harmless.
--
Glynn Clements <glynn@gclements.plus.com>
|
|
Tue, Feb 20 2007
20:49:22
|
|
Mail sent by msieczka
|
|
hamish_nospam@yahoo.com wrote (Mon, Feb 19 2007 05:44:39):
> Everyone can play along at home by changing the first line of the script
> to "#!/bin/ash -x" and follow the output trail.
Soereng,
Do you think you could add a test for BASHisms in GRASS scripts, by forcing
them to use eg. dash in your testsuite (link /bin/sh to your dash executable,
instead of bash)? That would let us spot all eventual problems at one attempt.
Best,
Maciek
|
|
Wed, Feb 21 2007
00:01:02
|
|
Mail sent by hamish_nospam@yahoo.com
|
|
Return-Path |
<hamish_nospam@yahoo.com>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
Date |
Wed, 21 Feb 2007 12:00:34 +1300
|
From |
Hamish <hamish_nospam@yahoo.com>
|
To |
Maciek Sieczka via RT <grass-bugs@intevation.de>
|
Cc |
adiez@uv.es, egor@altlinux.ru, soerengebbert@gmx.de, grass-dev@grass.itc.it
|
Subject |
Re: [GRASS-dev] [bug #5499] (grass) bash scripts starting with #!/bin/sh
|
Message-Id |
<20070221120034.2df8d79f.hamish_nospam@yahoo.com>
|
In-Reply-To |
<20070220194922.AA417101F17@lists.intevation.de>
|
References |
<20070220194922.AA417101F17@lists.intevation.de>
|
X-Mailer |
Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-pc-linux-gnu)
|
X-Face |
M<EoB)"*Z~u!,vFhXmw}R_KbdBta*P_=T|rbBL'e1/CQ9;/1g\BU3&!=y8ria$2Uk!HT&BB 8i?|X_+7~1jsy}F~g$2va%3fV`*=L(*cem[@3\yg,G,@rg6/QMJ
|
Mime-Version |
1.0
|
Content-Type |
text/plain; charset=US-ASCII
|
Content-Transfer-Encoding |
7bit
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, score=0.204 tagged_above=-999 required=3 tests=[BAYES_00=-5, DNS_FROM_RFC_ABUSE=0.2, DNS_FROM_RFC_POST=1.708, DNS_FROM_RFC_WHOIS=1.447, FORGED_YAHOO_RCVD=1.849]
|
X-Spam-Score |
0.204
|
X-Spam-Level |
|
Hamish:
> > Everyone can play along at home by changing the first line of the
> > script to "#!/bin/ash -x" and follow the output trail.
Maciek:
> Do you think you could add a test for BASHisms in GRASS scripts, by
> forcing them to use eg. dash in your testsuite (link /bin/sh to your
> dash executable, instead of bash)? That would let us spot all eventual
> problems at one attempt.
easier:
for CMD in `\ls -1 "$GISBASE"/scripts/?\.*` ; do
ash -n "$CMD"
done
/usr/local/src/grass/grass63/dist.i686-pc-linux-gnu/scripts/i.spectral:
252: Syntax error: Bad substitution
/usr/local/src/grass/grass63/dist.i686-pc-linux-gnu/scripts/r.tileset:
258: Syntax error: Bad for loop variable
So i.spectral includes a Bashism too. It is limited to the COORD[]
array, so probably not too hard for someone to fix that.
r.tileset covered in another email to follow.
Hamish
|
|
Wed, Feb 21 2007
02:15:02
|
|
Mail sent by hamish_nospam@yahoo.com
|
|
Return-Path |
<hamish_nospam@yahoo.com>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
Date |
Wed, 21 Feb 2007 14:14:18 +1300
|
From |
Hamish <hamish_nospam@yahoo.com>
|
To |
Glynn Clements <glynn@gclements.plus.com>
|
Cc |
grass-dev@grass.itc.it, grass-bugs@intevation.de
|
Subject |
Re: [GRASS-dev] [bug #5499] (grass) bash scripts starting with #!/bin/sh
|
Message-Id |
<20070221141418.673a81d5.hamish_nospam@yahoo.com>
|
In-Reply-To |
<17883.9678.63357.53654@cerise.gclements.plus.com>
|
References |
<20070218154752.C0D161005BC@lists.intevation.de> <17880.58095.281624.559380@cerise.gclements.plus.com> <20070220154224.4b0527c5.hamish_nospam@yahoo.com> <17883.9678.63357.53654@cerise.gclements.plus.com>
|
X-Mailer |
Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-pc-linux-gnu)
|
X-Face |
M<EoB)"*Z~u!,vFhXmw}R_KbdBta*P_=T|rbBL'e1/CQ9;/1g\BU3&!=y8ria$2Uk!HT&BB 8i?|X_+7~1jsy}F~g$2va%3fV`*=L(*cem[@3\yg,G,@rg6/QMJ
|
Mime-Version |
1.0
|
Content-Type |
text/plain; charset=US-ASCII
|
Content-Transfer-Encoding |
7bit
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, score=0.204 tagged_above=-999 required=3 tests=[BAYES_00=-5, DNS_FROM_RFC_ABUSE=0.2, DNS_FROM_RFC_POST=1.708, DNS_FROM_RFC_WHOIS=1.447, FORGED_YAHOO_RCVD=1.849]
|
X-Spam-Score |
0.204
|
X-Spam-Level |
|
Glynn Clements wrote:
[r.in.wms/wms.request]
> Arrays are a bash extension.
>
> AFAICT, the array is never actually used, so removing that line should
> be harmless.
done in CVS, along with some other cleanups. r.in.wms still needs a lot
more error checking built into it*, but is now free of bashisms.
[*] it now exits gracefully if r.tileset (by way of wms.request) failed.
[r.tileset]
> > Setting it back to /bin/bash solved the problem, but still
> > indicating the right interpreter in the headers will also be great.
Glynn:
> The problem is that you can't rely upon bash being installed in a
> specific location[1]. On Linux, it's the "primary" shell, so it's
> /bin. On Unices which include it as an "extra", it's likely to be in
> /usr/bin. If it isn't part of the core OS, it could be anywhere,
> although /usr/local/bin, /sw/bin and /opt/sw/bin are all plausible.
>
> [1] Actually, you can't rely upon bash being installed at all. GRASS
> isn't specifically a Linux package; at least, it isn't supposed to be.
>
> The only thing which you can absolutely rely upon is that /bin/sh will
> be a POSIX-compatible Bourne shell. Anyone writing scripts would do
> well to bear this in mind (IOW, please avoid using bash-specific
> features).
I don't think it is practical for r.tileset to be free of Bash without
a complete rewrite. It's really a Bash program and not a shell script.
If it were to be rewritten, perhaps do it in python, but as bash will
be more widely installed than python I see little point in doing that.
Python (or perl) will have the same "where'd it get installed?"
problems too, probably more so. r.tileset is more complicated than you
really want a shell script to be, but isn't so deep that it should be
written in C either. Somewhere in between.
Options I can think of:
1) change the r.tileset shebang to #!/bin/bash. Let the packagers of
platforms that don't supply bash in the normal place worry about
modifying the script + Make a note in the r.tileset help page.
At least there will be a useful help message and graceful exit if the
path is wrong.
2) keep #!/bin/sh, but add this within the script:
if [ -z "$BASH" ] ; then
echo "$0: This script requires Bash." 1>&2
exit 1
fi
3) Rewrite it in a language other than Bash.
#1 seems the most correct. #2 seems the most practical, but dirty.
Can we name any popular modern platform which doesn't keep bash in
/bin/bash?
Hamish
|
|
Wed, Feb 21 2007
02:32:06
|
|
Mail sent by soerengebbert@gmx.de
|
|
Return-Path |
<soerengebbert@gmx.de>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
X-Provags-ID |
V01U2FsdGVkX19g5zx4mUFg+7uOxLsnldERb1CfBYfK4E31+VS9Dr wf1A==
|
Message-ID |
<45DBA100.3070803@gmx.de>
|
Date |
Wed, 21 Feb 2007 02:31:44 +0100
|
From |
=?ISO-8859-1?Q?S=F6ren_Gebbert?= <soerengebbert@gmx.de>
|
User-Agent |
IceDove 1.5.0.9 (X11/20061220)
|
MIME-Version |
1.0
|
To |
Hamish <hamish_nospam@yahoo.com>
|
Cc |
Glynn Clements <glynn@gclements.plus.com>, grass-bugs@intevation.de, grass-dev@grass.itc.it
|
Subject |
Re: [GRASS-dev] [bug #5499] (grass) bash scripts starting with #!/bin/sh
|
References |
<20070218154752.C0D161005BC@lists.intevation.de> <17880.58095.281624.559380@cerise.gclements.plus.com> <20070220154224.4b0527c5.hamish_nospam@yahoo.com> <17883.9678.63357.53654@cerise.gclements.plus.com> <20070221141418.673a81d5.hamish_nospam@yahoo.com>
|
In-Reply-To |
<20070221141418.673a81d5.hamish_nospam@yahoo.com>
|
Content-Type |
text/plain; charset=ISO-8859-1; format=flowed
|
Content-Transfer-Encoding |
7bit
|
X-Y-GMX-Trusted |
0
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, score=-5 tagged_above=-999 required=3 tests=[BAYES_00=-5]
|
X-Spam-Score |
-5
|
X-Spam-Level |
|
Hi,
> #1 seems the most correct. #2 seems the most practical, but dirty.
>
> Can we name any popular modern platform which doesn't keep bash in
> /bin/bash?
IBM AIX 5 in the basic installation environment has "only" a ksh.
I would like to see python or perl to be THE scripting language of
grass, because sh and even the bash have IMHO very limited capabilities
to create sophisticated and maintainable code.
In case i learn python one day (i only know some basics), i will rewrite
the grass test suite in python. The current bash based design is not
very good maintainable ... .
Soeren
>
>
>
> Hamish
>
> _______________________________________________
> grass-dev mailing list
> grass-dev@grass.itc.it
> http://grass.itc.it/mailman/listinfo/grass-dev
>
|
|
Wed, Feb 21 2007
08:53:04
|
|
Mail sent by glynn@gclements.plus.com
|
|
Return-Path |
<glynn@gclements.plus.com>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
From |
Glynn Clements <glynn@gclements.plus.com>
|
MIME-Version |
1.0
|
Content-Type |
text/plain; charset=us-ascii
|
Content-Transfer-Encoding |
7bit
|
Message-ID |
<17883.64092.837618.89851@cerise.gclements.plus.com>
|
Date |
Wed, 21 Feb 2007 07:53:00 +0000
|
To |
Hamish <hamish_nospam@yahoo.com>
|
Cc |
grass-bugs@intevation.de, grass-dev@grass.itc.it
|
Subject |
Re: [GRASS-dev] [bug #5499] (grass) bash scripts starting with #!/bin/sh
|
In-Reply-To |
<20070221141418.673a81d5.hamish_nospam@yahoo.com>
|
References |
<20070218154752.C0D161005BC@lists.intevation.de> <17880.58095.281624.559380@cerise.gclements.plus.com> <20070220154224.4b0527c5.hamish_nospam@yahoo.com> <17883.9678.63357.53654@cerise.gclements.plus.com> <20070221141418.673a81d5.hamish_nospam@yahoo.com>
|
X-Mailer |
VM 7.07 under 21.4 (patch 20) "Double Solitaire" XEmacs Lucid
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, score=-4.665 tagged_above=-999 required=3 tests=[BAYES_00=-5, DNS_FROM_RFC_ABUSE=0.2, FORGED_RCVD_HELO=0.135]
|
X-Spam-Score |
-4.665
|
X-Spam-Level |
|
Hamish wrote:
> 2) keep #!/bin/sh, but add this within the script:
>
> if [ -z "$BASH" ] ; then
> echo "$0: This script requires Bash." 1>&2
> exit 1
> fi
Or:
if [ -z "$BASH" ] ; then
exec bash "$0" "$@"
echo "$0: This script requires Bash." 1>&2
exit 1
fi
AFAICT, that should work so long as bash is called "bash" (and not
e.g. "bash2" or "bash-3.1.17") and is somewhere in the path.
--
Glynn Clements <glynn@gclements.plus.com>
|
|
Tue, Feb 27 2007
04:43:35
|
|
Mail sent by hamish_nospam@yahoo.com
|
|
Return-Path |
<hamish_nospam@yahoo.com>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
Date |
Tue, 27 Feb 2007 16:42:52 +1300
|
From |
Hamish <hamish_nospam@yahoo.com>
|
To |
Glynn Clements <glynn@gclements.plus.com>
|
Cc |
grass-bugs@intevation.de, grass-dev@grass.itc.it
|
Subject |
Re: [GRASS-dev] [bug #5499] (grass) bash scripts starting with #!/bin/sh
|
Message-Id |
<20070227164252.3ed17f36.hamish_nospam@yahoo.com>
|
In-Reply-To |
<17883.64092.837618.89851@cerise.gclements.plus.com>
|
References |
<20070218154752.C0D161005BC@lists.intevation.de> <17880.58095.281624.559380@cerise.gclements.plus.com> <20070220154224.4b0527c5.hamish_nospam@yahoo.com> <17883.9678.63357.53654@cerise.gclements.plus.com> <20070221141418.673a81d5.hamish_nospam@yahoo.com> <17883.64092.837618.89851@cerise.gclements.plus.com>
|
X-Mailer |
Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-pc-linux-gnu)
|
X-Face |
M<EoB)"*Z~u!,vFhXmw}R_KbdBta*P_=T|rbBL'e1/CQ9;/1g\BU3&!=y8ria$2Uk!HT&BB 8i?|X_+7~1jsy}F~g$2va%3fV`*=L(*cem[@3\yg,G,@rg6/QMJ
|
Mime-Version |
1.0
|
Content-Type |
text/plain; charset=US-ASCII
|
Content-Transfer-Encoding |
7bit
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, score=0.204 tagged_above=-999 required=3 tests=[BAYES_00=-5, DNS_FROM_RFC_ABUSE=0.2, DNS_FROM_RFC_POST=1.708, DNS_FROM_RFC_WHOIS=1.447, FORGED_YAHOO_RCVD=1.849]
|
X-Spam-Score |
0.204
|
X-Spam-Level |
|
Glynn Clements wrote:
>
> Hamish wrote:
>
> > 2) keep #!/bin/sh, but add this within the script:
> >
> > if [ -z "$BASH" ] ; then
> > echo "$0: This script requires Bash." 1>&2
> > exit 1
> > fi
>
> Or:
> if [ -z "$BASH" ] ; then
> exec bash "$0" "$@"
> echo "$0: This script requires Bash." 1>&2
> exit 1
> fi
>
> AFAICT, that should work so long as bash is called "bash" (and not
> e.g. "bash2" or "bash-3.1.17") and is somewhere in the path.
should we worry about the case where bash has been symlinked to ash
and the thing loops?
As long as it works with mac,cygwin,90% linuxes, I'm still leaning
towards simply changing the shebang to #!/bin/bash. I am happy to assume
BSD,IRIX,AIX,fringe linux folks will be capable enough to modify it
themselves if that's needed.
Hamish
|
|
Tue, Feb 27 2007
21:03:56
|
|
Mail sent by glynn@gclements.plus.com
|
|
Return-Path |
<glynn@gclements.plus.com>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
From |
Glynn Clements <glynn@gclements.plus.com>
|
MIME-Version |
1.0
|
Content-Type |
text/plain; charset=us-ascii
|
Content-Transfer-Encoding |
7bit
|
Message-ID |
<17892.36520.202187.532500@cerise.gclements.plus.com>
|
Date |
Tue, 27 Feb 2007 20:03:52 +0000
|
To |
Hamish <hamish_nospam@yahoo.com>
|
Cc |
grass-bugs@intevation.de, grass-dev@grass.itc.it
|
Subject |
Re: [GRASS-dev] [bug #5499] (grass) bash scripts starting with #!/bin/sh
|
In-Reply-To |
<20070227164252.3ed17f36.hamish_nospam@yahoo.com>
|
References |
<20070218154752.C0D161005BC@lists.intevation.de> <17880.58095.281624.559380@cerise.gclements.plus.com> <20070220154224.4b0527c5.hamish_nospam@yahoo.com> <17883.9678.63357.53654@cerise.gclements.plus.com> <20070221141418.673a81d5.hamish_nospam@yahoo.com> <17883.64092.837618.89851@cerise.gclements.plus.com> <20070227164252.3ed17f36.hamish_nospam@yahoo.com>
|
X-Mailer |
VM 7.07 under 21.4 (patch 20) "Double Solitaire" XEmacs Lucid
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, score=-4.665 tagged_above=-999 required=3 tests=[BAYES_00=-5, DNS_FROM_RFC_ABUSE=0.2, FORGED_RCVD_HELO=0.135]
|
X-Spam-Score |
-4.665
|
X-Spam-Level |
|
Hamish wrote:
> > > 2) keep #!/bin/sh, but add this within the script:
> > >
> > > if [ -z "$BASH" ] ; then
> > > echo "$0: This script requires Bash." 1>&2
> > > exit 1
> > > fi
> >
> > Or:
> > if [ -z "$BASH" ] ; then
> > exec bash "$0" "$@"
> > echo "$0: This script requires Bash." 1>&2
> > exit 1
> > fi
> >
> > AFAICT, that should work so long as bash is called "bash" (and not
> > e.g. "bash2" or "bash-3.1.17") and is somewhere in the path.
>
> should we worry about the case where bash has been symlinked to ash
> and the thing loops?
No. It *could* happen, but it seems extremely unlikely.
I can't see what benefit symlinking bash to ash would achieve; any
script with #!/bin/bash (etc) is almost certain not to work with ash.
--
Glynn Clements <glynn@gclements.plus.com>
|
|
Sun, Mar 18 2007
12:12:54
|
|
Mail sent by msieczka
|
|
Hi!
I have found checkbashisms script. In Debian and alike it's provided with
devscripts package. Version 2.9.10 run on GRASS scripts from 6.3 CVS
18.03.2007 yields following warnings. I'm no expert and can't say which are
real. Just letting others know.
$ grass63
$ for i in `ls /usr/local/grass-6.3.cvs/scripts/`; do checkbashisms
/usr/local/grass-6.3.cvs/scripts/$i; done
possible bashism in /usr/local/grass-6.3.cvs/scripts/d.correlate line 75: '[
"$name" == '
possible bashism in /usr/local/grass-6.3.cvs/scripts/d.correlate line 81: '[
"$ok" == '
possible bashism in /usr/local/grass-6.3.cvs/scripts/d.polar line 137: '[
$TOTALVALIDNUMBER == '
possible bashism in /usr/local/grass-6.3.cvs/scripts/g.mlist line 118: '[
"$itype" == '
possible bashism in /usr/local/grass-6.3.cvs/scripts/i.in.spotvgt line 200:
'${NAME}_$PID,${NAME}'
script /usr/local/grass-6.3.cvs/scripts/r.tileset is already a bash script;
skipping
possible bashism in /usr/local/grass-6.3.cvs/scripts/r.univar.sh line 116:
'function abs'
possible bashism in /usr/local/grass-6.3.cvs/scripts/v.univar.sh line 147:
'function abs'
Maciek
|
|
Sun, Mar 18 2007
12:51:51
|
|
Mail sent by msieczka
|
|
Another bunch of possible bashism, in regard too Hamish'es hints on how to
avoid them.
Hamish wrote:
> use "=" not "==" for string compares
These do not conform:
d.correlate: if [ "$name" == "" ] ; then
d.correlate:if [ "$ok" == "no" ] ; then
d.polar:if [ $TOTALVALIDNUMBER == 0 ] ; then
d.vect.thematic: if [ "`db.columns table=$table database=$database
driver=$driver| grep -i grassrgb`" == "" ] ; then
g.mlist: if [ "$itype" == "all" ] ; then
r.fillnulls:r.mapcalc "MASK=if($TMP1.buf==2,1,null())"
r.plane: if (dist==0) {
r.plane: if (typeflag==""){
v.rast.stats: r.mapcalc "MASK=if(${VECTOR}_${TMPNAME} == $i, 1, null())" 2>
/dev/null
Also, I guess (and only guess) that -+ and += would fail for non-Bash. There
are some in r.tileset:
r.tileset: for ((min_i=0;min_i<min_n;min_i+=1)) ; do
r.tileset: for ((max_i=0;max_i<max_n;max_i+=1)) ; do
r.tileset: for ((pp_i=0;pp_i<pp_max;pp_i+=2)) ; do
r.tileset: for ((sl_i=0;sl_i<sl_max;sl_i+=2)) ; do
r.tileset:for ((xi=0;xi<ximax;xi+=1)); do
r.tileset: for ((yi=0;yi<yimax;yi+=1)); do
Should min_i+=1 be replaced with `expr $min_i + 1` etc.?
Maciek
|
|
Sun, Mar 18 2007
14:25:14
|
|
Mail sent by glynn@gclements.plus.com
|
|
Return-Path |
<glynn@gclements.plus.com>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
From |
Glynn Clements <glynn@gclements.plus.com>
|
MIME-Version |
1.0
|
Content-Type |
text/plain; charset=us-ascii
|
Content-Transfer-Encoding |
7bit
|
Message-ID |
<17917.15794.608179.721167@cerise.gclements.plus.com>
|
Date |
Sun, 18 Mar 2007 13:25:06 +0000
|
To |
Maciek Sieczka via RT <grass-bugs@intevation.de>
|
Cc |
adiez@uv.es, egor@altlinux.ru, grass-dev@grass.itc.it
|
Subject |
Re: [GRASS-dev] [bug #5499] (grass) bash scripts starting with #!/bin/sh
|
In-Reply-To |
<20070318115151.46B831005D5@lists.intevation.de>
|
References |
<20070318115151.46B831005D5@lists.intevation.de>
|
X-Mailer |
VM 7.07 under 21.4 (patch 20) "Double Solitaire" XEmacs Lucid
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, score=-4.665 tagged_above=-999 required=3 tests=[BAYES_00=-5, DNS_FROM_RFC_ABUSE=0.2, FORGED_RCVD_HELO=0.135]
|
X-Spam-Score |
-4.665
|
X-Spam-Level |
|
Maciek Sieczka via RT wrote:
> Also, I guess (and only guess) that -+ and += would fail for non-Bash. There
> are some in r.tileset:
>
> r.tileset: for ((min_i=0;min_i<min_n;min_i+=1)) ; do
The "for ((...))" syntax is a bash-ism. If you want portability, you
have to use e.g.:
min_i=0
while $min_i -lt min_n ; do
...
min_i=`expr $min_i + 1`
done
> Should min_i+=1 be replaced with `expr $min_i + 1` etc.?
Hamish decided that r.tileset was too bash-specific to fix, and just
put #!/bin/bash at the top.
--
Glynn Clements <glynn@gclements.plus.com>
|
|
Mon, Mar 19 2007
00:50:01
|
|
Mail sent by hamish_nospam@yahoo.com
|
|
Return-Path |
<hamish_nospam@yahoo.com>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
Date |
Mon, 19 Mar 2007 11:49:35 +1200
|
From |
Hamish <hamish_nospam@yahoo.com>
|
To |
Maciek Sieczka via RT <grass-bugs@intevation.de>
|
Cc |
adiez@uv.es, egor@altlinux.ru, grass-dev@grass.itc.it
|
Subject |
Re: [GRASS-dev] [bug #5499] (grass) bash scripts starting with #!/bin/sh
|
Message-Id |
<20070319114935.78bb3cf2.hamish_nospam@yahoo.com>
|
In-Reply-To |
<20070318115151.46B831005D5@lists.intevation.de>
|
References |
<20070318115151.46B831005D5@lists.intevation.de>
|
X-Mailer |
Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-pc-linux-gnu)
|
X-Face |
M<EoB)"*Z~u!,vFhXmw}R_KbdBta*P_=T|rbBL'e1/CQ9;/1g\BU3&!=y8ria$2Uk!HT&BB 8i?|X_+7~1jsy}F~g$2va%3fV`*=L(*cem[@3\yg,G,@rg6/QMJ
|
Mime-Version |
1.0
|
Content-Type |
text/plain; charset=US-ASCII
|
Content-Transfer-Encoding |
7bit
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, score=0.204 tagged_above=-999 required=3 tests=[BAYES_00=-5, DNS_FROM_RFC_ABUSE=0.2, DNS_FROM_RFC_POST=1.708, DNS_FROM_RFC_WHOIS=1.447, FORGED_YAHOO_RCVD=1.849]
|
X-Spam-Score |
0.204
|
X-Spam-Level |
|
[this matters as the new Ubuntu uses [d]ash for #!/bin/sh not bash]
Maciek Sieczka via RT wrote:
> Another bunch of possible bashism, in regard too Hamish'es hints on
> how to avoid them.
(as collected from this list mostly)
> Hamish wrote:
> > use "=" not "==" for string compares
>
> These do not conform:
>
> d.correlate: if [ "$name" == "" ] ; then
# use -z to test if string is zero-length, -n to test if non-zero length
if [ -z "$name" ] ; then
> d.correlate:if [ "$ok" == "no" ] ; then
# only use a single "=" for string compares
if [ "$ok" = "no" ] ; then
> d.polar:if [ $TOTALVALIDNUMBER == 0 ] ; then
# use -eq integer compare
if [ "$TOTALVALIDNUMBER" -eq 0 ] ; then
> d.vect.thematic: if [ "`db.columns table=$table database=$database
> driver=$driver | grep -i grassrgb`" == "" ] ; then
Use -z. Note d.vect.thematic also uses "let" in a several places which
needs to be changed to `expr`.
> g.mlist: if [ "$itype" == "all" ] ; then
=
> r.fillnulls:r.mapcalc "MASK=if($TMP1.buf==2,1,null())"
"==" is ok within a r.mapcalc expression. Not a bug.
> r.plane: if (dist==0) {
-eq
> r.plane: if (typeflag==""){
-z
> v.rast.stats: r.mapcalc "MASK=if(${VECTOR}_${TMPNAME} == $i, 1,
> null())" 2> /dev/null
ok within r.mapcalc. Not a bug.
> Also, I guess (and only guess) that -+ and += would fail for non-Bash.
> There are some in r.tileset:
As Glynn already noted, r.tileset is written as a bash program, not a
unix shell script, and it is more work than I want to undertake to
rewrite it.
Hamish
|
|
Mon, Mar 19 2007
03:46:24
|
|
Mail sent by glynn@gclements.plus.com
|
|
Return-Path |
<glynn@gclements.plus.com>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
From |
Glynn Clements <glynn@gclements.plus.com>
|
MIME-Version |
1.0
|
Content-Type |
text/plain; charset=us-ascii
|
Content-Transfer-Encoding |
7bit
|
Message-ID |
<17917.63863.697638.279178@cerise.gclements.plus.com>
|
Date |
Mon, 19 Mar 2007 02:46:15 +0000
|
To |
Hamish <hamish_nospam@yahoo.com>
|
Cc |
Maciek Sieczka via RT <grass-bugs@intevation.de>, grass-dev@grass.itc.it, egor@altlinux.ru, adiez@uv.es
|
Subject |
Re: [GRASS-dev] [bug #5499] (grass) bash scripts starting with #!/bin/sh
|
In-Reply-To |
<20070319114935.78bb3cf2.hamish_nospam@yahoo.com>
|
References |
<20070318115151.46B831005D5@lists.intevation.de> <20070319114935.78bb3cf2.hamish_nospam@yahoo.com>
|
X-Mailer |
VM 7.07 under 21.4 (patch 20) "Double Solitaire" XEmacs Lucid
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, score=-4.665 tagged_above=-999 required=3 tests=[BAYES_00=-5, DNS_FROM_RFC_ABUSE=0.2, FORGED_RCVD_HELO=0.135]
|
X-Spam-Score |
-4.665
|
X-Spam-Level |
|
Hamish wrote:
> > r.plane: if (dist==0) {
>
> -eq
>
> > r.plane: if (typeflag==""){
>
> -z
These two are part of an "awk" program, so should be left unchanged.
--
Glynn Clements <glynn@gclements.plus.com>
|
|
Mon, Mar 19 2007
23:17:48
|
|
Mail sent by dca.gis@gmail.com
|
|
Return-Path |
<dca.gis@gmail.com>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
DKIM-Signature |
a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=L0E1E+jHZURNztaP02Y9Jh/7o8hNX9Mtbz0cV4JrFkEXd/WZz4ATuNx/esdJzt7RgWN3KFOB/kqpxr1wio6nfp1yRskqTUYBN2gXf+71H+ZoPvzK6I/Ct8n1Xb/8kz6yhZ/NoNEeio8FfgdvU6fU5jdfq+4VJY1FLnOvGHRGeOw=
|
DomainKey-Signature |
a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=k7xWtLbmZKMi9LY91FK8Gy3usIWNxjclFnpgokcI3elPvLqEaT4e14CkuuUiskJBLIWepdgbkCGh1GG5A33bgFWT7GoQOnje0l63KV1TbudsiXQL2tVGd3j2ORnP3Z1DVENjcCoSuQ3Lf58cN5WCpEMot/Ejn8TtD3yA23metQ0=
|
Message-ID |
<1a486f560703191517v12b2860evbaff20a09e47e985@mail.gmail.com>
|
Date |
Mon, 19 Mar 2007 17:17:45 -0500
|
From |
"Daniel Calvelo" <dca.gis@gmail.com>
|
To |
"Maciek Sieczka via RT" <grass-bugs@intevation.de>
|
Subject |
Re: [GRASS-dev] [bug #5499] (grass) bash scripts starting with #!/bin/sh
|
Cc |
adiez@uv.es, egor@altlinux.ru, grass-dev@grass.itc.it
|
In-Reply-To |
<20070318111254.C39B61005DF@lists.intevation.de>
|
MIME-Version |
1.0
|
Content-Type |
text/plain; charset=ISO-8859-1; format=flowed
|
Content-Transfer-Encoding |
7bit
|
Content-Disposition |
inline
|
References |
<20070318111254.C39B61005DF@lists.intevation.de>
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, score=-5 tagged_above=-999 required=3 tests=[BAYES_00=-5]
|
X-Spam-Score |
-5
|
X-Spam-Level |
|
On 3/18/07, Maciek Sieczka via RT <grass-bugs@intevation.de> wrote:
> Hi!
Hi Maciek.
> I have found checkbashisms script. In Debian and alike it's provided with
> devscripts package. Version 2.9.10 run on GRASS scripts from 6.3 CVS
> 18.03.2007 yields following warnings. I'm no expert and can't say which are
> real. Just letting others know.
>
> $ grass63
>
> $ for i in `ls /usr/local/grass-6.3.cvs/scripts/`; do checkbashisms
> /usr/local/grass-6.3.cvs/scripts/$i; done
>
> possible bashism in /usr/local/grass-6.3.cvs/scripts/d.correlate line 75: '[
> "$name" == '
> possible bashism in /usr/local/grass-6.3.cvs/scripts/d.correlate line 81: '[
> "$ok" == '
> possible bashism in /usr/local/grass-6.3.cvs/scripts/d.polar line 137: '[
> $TOTALVALIDNUMBER == '
> possible bashism in /usr/local/grass-6.3.cvs/scripts/g.mlist line 118: '[
> "$itype" == '
Those are done, and on CVS.
> possible bashism in /usr/local/grass-6.3.cvs/scripts/i.in.spotvgt line 200:
> '${NAME}_$PID,${NAME}'
This is a false positive, it is an argument to g.rename
> script /usr/local/grass-6.3.cvs/scripts/r.tileset is already a bash script;
> skipping
> possible bashism in /usr/local/grass-6.3.cvs/scripts/r.univar.sh line 116:
> 'function abs'
> possible bashism in /usr/local/grass-6.3.cvs/scripts/v.univar.sh line 147:
> 'function abs'
Those are false positives; the functions are defined within inlined awk scripts.
> Maciek
>
>
> -------------------------------------------- Managed by Request Tracker
>
> _______________________________________________
> grass-dev mailing list
> grass-dev@grass.itc.it
> http://grass.itc.it/mailman/listinfo/grass-dev
>
--
-- Daniel Calvelo Aros
|
|
Mon, Mar 19 2007
23:22:49
|
|
Mail sent by dca.gis@gmail.com
|
|
Return-Path |
<dca.gis@gmail.com>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
DKIM-Signature |
a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=nKTf74sDXgbsdg8rcC+wJXofXSrBKzyPKsKKrJWhCApC5EKq1EOrbqkMeKlookO0q6/RXulKNHqDckGmvHE/ZYm2RFhBX4RlT57M16nCDmMqYvm3akNJF8PRqQc1cKI/n6uBOM0G6nBBW+mC6rlAmMp8zHp5D5HikAyOhzg8ljY=
|
DomainKey-Signature |
a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=I1ZI6wxuchxS7I7h9ZTiOiyexh6Ybic5n3/yksHLZcx46g0Cfay9JVoA8jRNfplYIrxPiIMiZrvU7ZDxyM6Its9qpMtbkmJOPhv5SDmPJmtDWjSMS1zRExgLgRVJf+UGQ6gVlSFZNnljF8S++M1OptCwzdKq8Z+oZnF7qznwIJE=
|
Message-ID |
<1a486f560703191522r64ad368dmf1cf56692ef3d1a1@mail.gmail.com>
|
Date |
Mon, 19 Mar 2007 17:22:45 -0500
|
From |
"Daniel Calvelo" <dca.gis@gmail.com>
|
To |
Hamish <hamish_nospam@yahoo.com>
|
Subject |
Re: [GRASS-dev] [bug #5499] (grass) bash scripts starting with #!/bin/sh
|
Cc |
"Maciek Sieczka via RT" <grass-bugs@intevation.de>, grass-dev@grass.itc.it, egor@altlinux.ru, adiez@uv.es
|
In-Reply-To |
<20070319114935.78bb3cf2.hamish_nospam@yahoo.com>
|
MIME-Version |
1.0
|
Content-Type |
text/plain; charset=ISO-8859-1; format=flowed
|
Content-Transfer-Encoding |
7bit
|
Content-Disposition |
inline
|
References |
<20070318115151.46B831005D5@lists.intevation.de> <20070319114935.78bb3cf2.hamish_nospam@yahoo.com>
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, score=-5 tagged_above=-999 required=3 tests=[BAYES_00=-5]
|
X-Spam-Score |
-5
|
X-Spam-Level |
|
Ok, I've changed d.correlate, d.polar, d.vect.thematic and g.mlist.
The other hits were either awk, r.mapcalc, or r.tileset :)
BTW there are lots of 'if test "$GISBASE" = ""; then' ; was this a
preferred method to -z for some reason? Is there some risk involved?
Daniel.
On 3/18/07, Hamish <hamish_nospam@yahoo.com> wrote:
> [this matters as the new Ubuntu uses [d]ash for #!/bin/sh not bash]
>
> Maciek Sieczka via RT wrote:
> > Another bunch of possible bashism, in regard too Hamish'es hints on
> > how to avoid them.
>
> (as collected from this list mostly)
>
> > Hamish wrote:
> > > use "=" not "==" for string compares
> >
> > These do not conform:
> >
> > d.correlate: if [ "$name" == "" ] ; then
>
> # use -z to test if string is zero-length, -n to test if non-zero length
> if [ -z "$name" ] ; then
>
> > d.correlate:if [ "$ok" == "no" ] ; then
>
> # only use a single "=" for string compares
> if [ "$ok" = "no" ] ; then
>
> > d.polar:if [ $TOTALVALIDNUMBER == 0 ] ; then
>
> # use -eq integer compare
> if [ "$TOTALVALIDNUMBER" -eq 0 ] ; then
>
> > d.vect.thematic: if [ "`db.columns table=$table database=$database
> > driver=$driver | grep -i grassrgb`" == "" ] ; then
>
> Use -z. Note d.vect.thematic also uses "let" in a several places which
> needs to be changed to `expr`.
>
> > g.mlist: if [ "$itype" == "all" ] ; then
>
> =
>
> > r.fillnulls:r.mapcalc "MASK=if($TMP1.buf==2,1,null())"
>
> "==" is ok within a r.mapcalc expression. Not a bug.
>
> > r.plane: if (dist==0) {
>
> -eq
>
> > r.plane: if (typeflag==""){
>
> -z
>
> > v.rast.stats: r.mapcalc "MASK=if(${VECTOR}_${TMPNAME} == $i, 1,
> > null())" 2> /dev/null
>
> ok within r.mapcalc. Not a bug.
>
>
> > Also, I guess (and only guess) that -+ and += would fail for non-Bash.
> > There are some in r.tileset:
>
> As Glynn already noted, r.tileset is written as a bash program, not a
> unix shell script, and it is more work than I want to undertake to
> rewrite it.
>
>
>
> Hamish
>
> _______________________________________________
> grass-dev mailing list
> grass-dev@grass.itc.it
> http://grass.itc.it/mailman/listinfo/grass-dev
>
--
-- Daniel Calvelo Aros
|
|
Mon, Mar 19 2007
23:27:18
|
|
Mail sent by tutey@o2.pl
|
|
Return-Path |
<tutey@o2.pl>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
Message-ID |
<45FF0E3D.20203@o2.pl>
|
Date |
Mon, 19 Mar 2007 23:27:09 +0100
|
From |
Maciej Sieczka <tutey@o2.pl>
|
User-Agent |
Thunderbird 1.5.0.10 (X11/20070306)
|
MIME-Version |
1.0
|
To |
Daniel Calvelo <dca.gis@gmail.com>
|
Cc |
Hamish <hamish_nospam@yahoo.com>, Maciek Sieczka via RT <grass-bugs@intevation.de>, adiez@uv.es, grass-dev@grass.itc.it, egor@altlinux.ru, Glynn Clements <glynn@gclements.plus.com>
|
Subject |
Re: [GRASS-dev] [bug #5499] (grass) bash scripts starting with #!/bin/sh
|
References |
<20070318115151.46B831005D5@lists.intevation.de> <20070319114935.78bb3cf2.hamish_nospam@yahoo.com> <1a486f560703191522r64ad368dmf1cf56692ef3d1a1@mail.gmail.com>
|
In-Reply-To |
<1a486f560703191522r64ad368dmf1cf56692ef3d1a1@mail.gmail.com>
|
Content-Type |
text/plain; charset=ISO-8859-2
|
Content-Transfer-Encoding |
7bit
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, score=-3.157 tagged_above=-999 required=3 tests=[BAYES_00=-5, DNS_FROM_RFC_POST=1.708, FORGED_RCVD_HELO=0.135]
|
X-Spam-Score |
-3.157
|
X-Spam-Level |
|
Daniel Calvelo wrote:
> Ok, I've changed d.correlate, d.polar, d.vect.thematic and g.mlist.
> The other hits were either awk, r.mapcalc, or r.tileset :)
Cool! Thanks Daniel.
> BTW there are lots of 'if test "$GISBASE" = ""; then' ; was this a
> preferred method to -z for some reason? Is there some risk involved?
I don't know myslef. Maybe Glynn knows?
Maciek
|
|
Tue, Mar 20 2007
03:15:06
|
|
Mail sent by glynn@gclements.plus.com
|
|
Return-Path |
<glynn@gclements.plus.com>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
From |
Glynn Clements <glynn@gclements.plus.com>
|
MIME-Version |
1.0
|
Content-Type |
text/plain; charset=us-ascii
|
Content-Transfer-Encoding |
7bit
|
Message-ID |
<17919.17314.862224.49904@cerise.gclements.plus.com>
|
Date |
Tue, 20 Mar 2007 02:14:58 +0000
|
To |
"Daniel Calvelo" <dca.gis@gmail.com>
|
Cc |
Hamish <hamish_nospam@yahoo.com>, Maciek Sieczka via RT <grass-bugs@intevation.de>, adiez@uv.es, grass-dev@grass.itc.it, egor@altlinux.ru
|
Subject |
Re: [GRASS-dev] [bug #5499] (grass) bash scripts starting with #!/bin/sh
|
In-Reply-To |
<1a486f560703191522r64ad368dmf1cf56692ef3d1a1@mail.gmail.com>
|
References |
<20070318115151.46B831005D5@lists.intevation.de> <20070319114935.78bb3cf2.hamish_nospam@yahoo.com> <1a486f560703191522r64ad368dmf1cf56692ef3d1a1@mail.gmail.com>
|
X-Mailer |
VM 7.07 under 21.4 (patch 20) "Double Solitaire" XEmacs Lucid
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, score=-4.665 tagged_above=-999 required=3 tests=[BAYES_00=-5, DNS_FROM_RFC_ABUSE=0.2, FORGED_RCVD_HELO=0.135]
|
X-Spam-Score |
-4.665
|
X-Spam-Level |
|
Daniel Calvelo wrote:
> Ok, I've changed d.correlate, d.polar, d.vect.thematic and g.mlist.
> The other hits were either awk, r.mapcalc, or r.tileset :)
>
> BTW there are lots of 'if test "$GISBASE" = ""; then' ; was this a
> preferred method to -z for some reason? Is there some risk involved?
If there's a shell out there which has a problem with -z, it isn't
going to like the configure scripts which autoconf generates, as they
use -z to test for an empty string.
--
Glynn Clements <glynn@gclements.plus.com>
|
|
Tue, Mar 20 2007
08:56:55
|
|
Mail sent by hamish_nospam@yahoo.com
|
|
Return-Path |
<hamish_nospam@yahoo.com>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
Date |
Tue, 20 Mar 2007 19:56:46 +1200
|
From |
Hamish <hamish_nospam@yahoo.com>
|
To |
"Daniel Calvelo" <dca.gis@gmail.com>
|
Cc |
grass-bugs@intevation.de
|
Subject |
Re: [GRASS-dev] [bug #5499] (grass) bash scripts starting with #!/bin/sh
|
Message-Id |
<20070320195646.2fd03fc9.hamish_nospam@yahoo.com>
|
In-Reply-To |
<1a486f560703191517v12b2860evbaff20a09e47e985@mail.gmail.com>
|
References |
<20070318111254.C39B61005DF@lists.intevation.de> <1a486f560703191517v12b2860evbaff20a09e47e985@mail.gmail.com>
|
X-Mailer |
Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-pc-linux-gnu)
|
X-Face |
M<EoB)"*Z~u!,vFhXmw}R_KbdBta*P_=T|rbBL'e1/CQ9;/1g\BU3&!=y8ria$2Uk!HT&BB 8i?|X_+7~1jsy}F~g$2va%3fV`*=L(*cem[@3\yg,G,@rg6/QMJ
|
Mime-Version |
1.0
|
Content-Type |
text/plain; charset=US-ASCII
|
Content-Transfer-Encoding |
7bit
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, score=0.204 tagged_above=-999 required=3 tests=[BAYES_00=-5, DNS_FROM_RFC_ABUSE=0.2, DNS_FROM_RFC_POST=1.708, DNS_FROM_RFC_WHOIS=1.447, FORGED_YAHOO_RCVD=1.849]
|
X-Spam-Score |
0.204
|
X-Spam-Level |
|
Daniel Calvelo wrote:
>
> Those are done, and on CVS.
d.correlate, d.polar, g.mlist, and d.vect.thematic bashism removals
backported to 6.2 branch.
Thanks Daniel.
Hamish
|
|
Thu, Mar 22 2007
04:10:06
|
|
Comments added by hbowman
|
|
So (hopefully) r.tileset is the only remaining bash script.
Shebang changed to #!/bin/bash in CVS head + the 6.2 branch; the outstanding
issues with it are primarily some for((;;)) loops and the use of $array[0]
variables.
Glynn showed how to make a safe for loop:
min_i=0
while $min_i -lt $min_n ; do
...
min_i=`expr $min_i + 1`
done
but I don't know of a way around the $array[0] variables.
Hamish
|
|
Wed, Mar 28 2007
15:50:39
|
|
Mail sent by msieczka
|
|
Hi. More on that.
In current 6.3 CVS there are several instances of "echo -e", which is a
bashism. In dash "echo -e" will just print '-e' string.
Most of those will propably get fixed in the process of echo->g.message fixes,
but there are some in build scripts even.
Offenders include:
gem/docs/make-html.sh:echo -e "Did you export a fresh .tex file from LyX first?\n"
lib/gis/Makefile: echo -e "#include <stdlib.h>\n#include
<fcntl.h>\n#undef _fmode\nint _fmode = _O_BINARY;" > $(OBJDIR)/fmode.c
lib/init/grass-run.src: echo -e "\033]0;${TITLE}\007\c"
lib/init/grass-run.src: echo -e "\r"
scripts/g.mlist/g.mlist: echo -e ""
scripts/v.db.addcol/v.db.addcol: echo -e "\nERROR: There is no table
connected to this map !\nRun v.db.connect or v.db.addtable first.\n"
scripts/v.db.addcol/v.db.addcol: echo -e "\nERROR: There is an empty
column !\nDid you leave a trailing comma?\n"
scripts/v.db.update/v.db.update: echo -e "\nThere is no table connected to
this map !\nRun v.db.connect or v.db.addtable first.\n"
scripts/v.dissolve/v.dissolve: echo -e "\nERROR: There is no table
connected to this map!"
scripts/v.in.gpsbabel/v.in.gpsbabel: echo -e "$ROUTE_ID \t$NUMBER
\t$R_NAME \t$START_PNT ">> "$TMP.route_atts"
scripts/v.in.gpsbabel/v.in.gpsbabel: echo -e "$TRACK_ID \t$S_TIME
\t$S_LAT \t$S_LON \t$E_TIME \t$E_LAT \t$E_LON">> "$TMP.track_atts"
scripts/v.db.dropcol/v.db.dropcol: echo -e "\nERROR: There is no table
connected to this map! Cannot delete any column."
tools/build_html_index.sh:echo -e "\n<!-- GEM Extensions StartHTML. Do not
delete or change this comment! -->\n" >> $FILENAME
Maciek
|
|
Mon, Apr 30 2007
13:34:23
|
|
Mail sent by msieczka
|
|
msieczka wrote (Wed, Mar 28 2007 15:50:39):
> In current 6.3 CVS there are several instances of "echo -e", which is a
> bashism. In dash "echo -e" will just print '-e' string.
> lib/gis/Makefile: echo -e "#include <stdlib.h>\n#include
> <fcntl.h>\n#undef _fmode\nint _fmode = _O_BINARY;" > $(OBJDIR)/fmode.c
>
> lib/init/grass-run.src: echo -e "\033]0;${TITLE}\007\c"
>
> lib/init/grass-run.src: echo -e "\r"
These two instances make the grass-run.sh affected as well. "-e" is a bashism.
Since grass-run.sh has a "#!/bin/sh" shebang, even in bash in runs in a POSIX
shell compliant, thus prints spurious "-e"'s into the terminal.
Maciek
|
|
Tue, May 1 2007
10:15:12
|
|
Mail sent by hamish_nospam@yahoo.com
|
|
Return-Path |
<hamish_nospam@yahoo.com>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
Date |
Tue, 1 May 2007 20:15:01 +1200
|
From |
Hamish <hamish_nospam@yahoo.com>
|
To |
Maciek Sieczka via RT <grass-bugs@intevation.de>
|
Cc |
grass-dev@grass.itc.it
|
Subject |
Re: [GRASS-dev] [bug #5499] (grass) bash scripts starting with #!/bin/sh
|
Message-Id |
<20070501201501.0173a79c.hamish_nospam@yahoo.com>
|
In-Reply-To |
<20070430113423.E22401006AB@lists.intevation.de>
|
References |
<20070430113423.E22401006AB@lists.intevation.de>
|
X-Mailer |
Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-pc-linux-gnu)
|
X-Face |
M<EoB)"*Z~u!,vFhXmw}R_KbdBta*P_=T|rbBL'e1/CQ9;/1g\BU3&!=y8ria$2Uk!HT&BB 8i?|X_+7~1jsy}F~g$2va%3fV`*=L(*cem[@3\yg,G,@rg6/QMJ
|
Mime-Version |
1.0
|
Content-Type |
text/plain; charset=US-ASCII
|
Content-Transfer-Encoding |
7bit
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, score=-3.151 tagged_above=-999 required=3.5 tests=[BAYES_00=-5, FORGED_YAHOO_RCVD=1.849]
|
X-Spam-Score |
-3.151
|
X-Spam-Level |
|
Maciek Sieczka via RT wrote:
> > In current 6.3 CVS there are several instances of "echo -e", which
> > is a bashism. In dash "echo -e" will just print '-e' string.
>
> > lib/gis/Makefile: echo -e "#include <stdlib.h>\n#include
> > <fcntl.h>\n#undef _fmode\nint _fmode = _O_BINARY;" >
> > $(OBJDIR)/fmode.c
left to someone else to fix. (I'm not big on Makefile fu)
> > lib/init/grass-run.src: echo -e "\033]0;${TITLE}\007\c"
> > lib/init/grass-run.src: echo -e "\r"
>
> These two instances make the grass-run.sh affected as well. "-e" is a
> bashism. Since grass-run.sh has a "#!/bin/sh" shebang, even in bash in
> runs in a POSIX shell compliant, thus prints spurious "-e"'s into the
> terminal.
fixed in CVS.
Hamish
|
|
Tue, May 1 2007
11:33:35
|
|
Mail sent by glynn@gclements.plus.com
|
|
Return-Path |
<glynn@gclements.plus.com>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
From |
Glynn Clements <glynn@gclements.plus.com>
|
MIME-Version |
1.0
|
Content-Type |
text/plain; charset=us-ascii
|
Content-Transfer-Encoding |
7bit
|
Message-ID |
<17975.2403.288208.341332@cerise.gclements.plus.com>
|
Date |
Tue, 1 May 2007 10:33:23 +0100
|
To |
Maciek Sieczka via RT <grass-bugs@intevation.de>
|
Cc |
adiez@uv.es, egor@altlinux.ru, grass-dev@grass.itc.it
|
Subject |
Re: [GRASS-dev] [bug #5499] (grass) bash scripts starting with #!/bin/sh
|
In-Reply-To |
<20070430113423.E22401006AB@lists.intevation.de>
|
References |
<20070430113423.E22401006AB@lists.intevation.de>
|
X-Mailer |
VM 7.07 under 21.4 (patch 20) "Double Solitaire" XEmacs Lucid
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, score=-4.865 tagged_above=-999 required=3.5 tests=[BAYES_00=-5, FORGED_RCVD_HELO=0.135]
|
X-Spam-Score |
-4.865
|
X-Spam-Level |
|
Maciek Sieczka via RT wrote:
> > In current 6.3 CVS there are several instances of "echo -e", which is a
> > bashism. In dash "echo -e" will just print '-e' string.
>
> > lib/gis/Makefile: echo -e "#include <stdlib.h>\n#include
> > <fcntl.h>\n#undef _fmode\nint _fmode = _O_BINARY;" > $(OBJDIR)/fmode.c
I suggest putting the code into e.g. fmode.dat then using:
cat fmode.dat > $(OBJDIR)/fmode.c
It can't be a normal .c file, as the default rules automatically
compile all .c files and link the resulting objects into the library.
--
Glynn Clements <glynn@gclements.plus.com>
|
|
Wed, May 9 2007
21:30:28
|
|
Mail sent by mneteler
|
|
Glynn's suggestion is in CVS.
Markus |
|
Tue, May 15 2007
12:06:44
|
|
Comments added by hbowman
|
|
i.spectral updated to #!/bin/bash in 6.3 and 6.2 CVSs. (it uses array[])
Hamish
|
|
Tue, May 15 2007
12:35:32
|
|
Comments added by hbowman
|
|
Cc: grass-dev@grass.itc.it, dca.gis@gmail.com
Re removing bashisms.
i.spectral: uses $array[0]. Don't know how to fix that, changed to use
#!/bin/bash; backported to 6.2.
v.in.gpsbabel: uses "echo -e" in two places, like:
echo -e "$ROUTE_ID \t$NUMBER \t$R_NAME \t$START_PNT ">> "$TMP.route_atts"
how to fix that?
echo "$ROUTE_ID |$NUMBER |$R_NAME |$START_PNT " \
| tr '|' '\t' >> "$TMP.route_atts"
??
Daniel:
> BTW there are lots of 'if test "$GISBASE" = ""; then' ; was this a
> preferred method to -z for some reason? Is there some risk involved?
Vague memories that [..=""] was causing problems on Cygwin long long ago.
It has been updated to use [ -z "$foo" ] in many places, not the other way around.
Hamish
|
|
Tue, May 15 2007
13:04:34
|
|
Comments added by hbowman
|
|
AFAICT only v.in.gpsbabel remains to be fixed.
Hamish
|
|
Thu, May 24 2007
11:53:00
|
|
Status changed to resolved by hbowman
|
|
Thu, May 24 2007
11:53:00
|
|
Comments added by hbowman
|
|
v.in.gpsbabel updated in CVS.
Closing bug. (hopefully got 'em all)
Hamish
|
|