Sun, Mar 25 2001
23:58:58
|
|
Request created by guest
|
|
Subject: r.reclass requires write permission on the source
Platform: Linux/Intel
Linux distro:: RedHat
linux cpu:: Intel (i486, i586, pentium ...)
Xwindows version:: Xfree 4.0.x
Xwindows manager:: fvwm2
TclTk version:: tcl/tk 8.0.5
grass downloaded at:: CVS Server, Germany
grass binary for platform:: I compiled the sources myself
grass sources source:: yes, I am using the latest GRASS from CVS
c compiler name:: gcc
You can't reclassify a map on which you don't have write permission.
G_put_reclass() segfaults if the fopen (for append) on the
"reclassed_to" file fails.
NB: the code in question (src/libes/gis/reclass.c) is:
fd = fopen(buf1, "a+");
fseek (fd, 0L, SEEK_SET);
if (fd == NULL)
{
G_warning ("Unable to create dependency file in [%s in %s]",
buf2, reclass->mapset);
return -1;
}
It never makes it to the null test, as fseek() segfaults.
However, fixing this won't help, as reclass() (in
src/raster/r.reclass/cmd/reclass.c) considers a failure in G_put_reclass()
to be fatal.
In the longer term, the dependency tracking needs a re-think.
|
|
Tue, Mar 27 2001
22:40:23
|
|
Mail sent by glynn@sensei.co.uk
|
|
Return-Path |
<glynn@sensei.co.uk>
|
Delivered-To |
grass-bugs@intevation.de
|
From |
Glynn Clements <glynn@sensei.co.uk>
|
MIME-Version |
1.0
|
Content-Type |
multipart/mixed; boundary="FdhH7ULrel"
|
Content-Transfer-Encoding |
7bit
|
Message-ID |
<15040.63911.191357.603077@cerise.nosuchdomain.co.uk>
|
Date |
Tue, 27 Mar 2001 21:35:51 +0100
|
To |
Request Tracker <grass-bugs@intevation.de>, grass5@geog.uni
|
Subject |
Re: [bug #229] (grass) r.reclass requires write permission on the source
|
In-Reply-To |
<20010325215859.678253C0CC@intevation.de>
|
References |
<20010325215859.678253C0CC@intevation.de>
|
X-Mailer |
VM 6.91 under 21.2 (beta46) "Urania" XEmacs Lucid |
--FdhH7ULrel
Content-Type: text/plain; charset=us-ascii
Content-Description: message body and .signature
Content-Transfer-Encoding: 7bit
I've since produced a patch (attached). This ignores failed attempts
to update the "reclassed_to" file. Of course, if the base layer is
subsequently removed or renamed, the reclassed version will cease to
work. I don't really see any way around this.
--
Glynn Clements <glynn@sensei.co.uk>
--FdhH7ULrel
Content-Type: text/plain
Content-Description: Patch
Content-Disposition: inline;
filename="grass-libes-gis-reclass.c-diff"
Content-Transfer-Encoding: 7bit
Index: src/libes/gis/reclass.c
===================================================================
RCS file: /home/grass/grassrepository/grass/src/libes/gis/reclass.c,v
retrieving revision 1.3
diff -u -r1.3 reclass.c
--- src/libes/gis/reclass.c 2001/02/19 16:48:07 1.3
+++ src/libes/gis/reclass.c 2001/03/27 20:29:39
@@ -255,14 +255,14 @@
G__location_path(), reclass->mapset, buf2);
fd = fopen(buf1, "a+");
- fseek (fd, 0L, SEEK_SET);
-
if (fd == NULL)
{
G_warning ("Unable to create dependency file in [%s in %s]",
buf2, reclass->mapset);
- return -1;
+ return 1;
}
+
+ fseek (fd, 0L, SEEK_SET);
sprintf (buf2, "%s@%s\n", name, G_mapset());
for (i=0; !feof(fd) && fgets(buf3, 255, fd); )
--FdhH7ULrel--
|
|
Fri, Jul 27 2001
19:50:39
|
|
Status changed to resolved by gclements
|
|