[Rd] Segmentation fault, devPS.c, 0.99.0 (PR#413)

Roger Bivand
2000-02-08T15:01:53Z

Duncan:

I'll check the site you referred to.

On the machine with problems, powering down and restarting, then running R
-d gdb, run --vanilla < GRASS-Ex.R - as Peter suggested, led to the same
sig11, which makes me feel that maybe it's not just memory, because R is
certainly loaded somewhere else in physical space with no GUI running, and
nothing coming from cache. If it's any help, a rerun with the GUI up to
copy & paste output gives:

rst.pt> rast.put(G, lname = nameR[2], layer = tr3, title = "Cubic trend
surface")
CREATING SUPPORT FILES FOR ex.tr3.in

rst.pt> rast.put(G, lname = nameR[3], layer = kr3, title = "Kriged
surface")
CREATING SUPPORT FILES FOR ex.kr3.in

rst.pt> rast.put(G, lname = nameR[4], layer = predlo.pcbs,
    title = "Loess surface")
CREATING SUPPORT FILES FOR ex.loess.in

rst.pt> rast.put(G, lname = nameR[5], layer = codes(kr3.o),
    cat = T, title = "Kriged surface categories")
CREATING SUPPORT FILES FOR ex.kr3o.in

rst.pt> for (i in 1:5) system(paste("r.info map=", nameR[i],
    sep = ""))
 ...
> system("s.surf.rst input=ex.pcbslog.in elev=ex.rst tension=160
smooth=0.0 segmax=700")


Version: GRASS5.0 beta, last update: Nov 9 1999
input is x|y|%z1 %z2..., output is FP raster files

Authors: original version L.Mitas, H.Mitasova
         GRASS implementation I.Kosinovsky, D.P. Gerdes

 ...
Percent complete:  100%
history initiated
> exget <- rast.get(G, rlist=c("ex.akspl.in",
"ex.kr3.in", "ex.loess.in",
"ex.rst"))
> oldpar <- par(mfrow=c(2,2))
> plot(G, exget$ex.akspl.in)
----------------------------------------------------
# Copyright 1999-2000 by Roger S. Bivand
#
#
# plot.grassmeta provides a simple interface between grass data
# objects and the image() function; category layers may be plotted
# by taking codes() of the layer, and setting zlim to non-default values.
# If layer is not set, a blank base map is plotted, for instance for use
# with points().
#
plot.grassmeta <- function(G, layer=NULL, xlab="",
ylab="", ...) {
	if (class(G) != "grassmeta") stop("Data not a grass
object")
	require(MASS)
	eqscplot(G$xlim, G$ylim, xlab=xlab, ylab=ylab, type="n", ...)
	if (!is.null(layer)) {
		if (length(layer) != G$Ncells)
			stop("GRASS object metadata do not match layer
length")
		image(x=G$xseq, y=G$yseq,
			z=t(matrix(layer[G$reverse], nrow=G$Nrow,
ncol=G$Ncol, byrow=T)),
			add=T, ...)
	}
}
----------------------------------------------------

Program received signal SIGSEGV, Segmentation fault.
0x4021df2a in _IO_vfprintf (s=0x20203665, format=0x811ad81 "ep\n",
    ap=0xbfffde58) at vfprintf.c:1024
1024	vfprintf.c: No such file or directory.
(gdb) up
#1  0x40225f47 in fprintf (stream=0x20203665, format=0x811ad81 "ep\n")
    at fprintf.c:32
32	fprintf.c: No such file or directory.
(gdb) up
#2  0x806ca78 in PostScriptEndPage (fp=0x20203665) at devPS.c:513
513	    fprintf(fp, "ep\n");
(gdb) p *fp
Cannot access memory at address 0x20203665.
(gdb) p fp
$1 = (FILE *) 0x20203665
(gdb) up
#3  0x806d953 in PS_NewPage (dd=0x81df2d0) at devPS.c:1015
1015	    if(pd->pageno > 1) PostScriptEndPage(pd->psfp);
(gdb) p pd->psfp
$2 = (FILE *) 0x20203665
(gdb) p pd->pageno
$3 = 1920216697
(gdb) up
#4  0x8087c75 in Rf_GNewPlot (recording=1, ask=-2147483648) at
graphics.c:1781
1781		    dd->dp.newPage(dd);

(including the function where the problem occurs). The (FILE *) looks
healthy enough to me, so I'll accept that the problem is a machine
idiosyncracy. I'll work out a way for the examples to "know" if
they are
being run from GRASS-Ex.R, and if so, drop most of the graphic output,
leaving it in for regular example() execution.

Thanks for useful advice,

Roger

--
Roger Bivand
Department of Geography,
Norwegian School of Economics and Business Administration,
Breiviksveien 40, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand@nhh.no