jp-www@dcs.gla.ac.uk
2005-Jul-19 10:39 UTC
[Rd] segfault with grid and null unit (PR#8014)
Full_Name: Jonathan Paisley Version: 2.1.1 OS: Mac OS X 10.4.2 Submission from: (NULL) (81.178.107.67) I was following an example from library/grid/doc/grid.pdf ("Introduction to grid") and had the following code, where I'd mis-typed 1,3 instead of 1,2 as the first arguments to grid.layout. Sourcing this code causes the R GUI to crash. I've enclosed a partial backtrace from the crash below. =============require(grid) sometext = "hello there\nthis is a \ntest!" pushViewport( viewport( layout=grid.layout(1,3, widths=unit.c( unit(1,"strwidth",sometext) + unit(2,"cm"), unit(1,"null") ) ) ) ) ============= Date/Time: 2005-07-19 11:35:30.950 +0100 OS Version: 10.4.2 (Build 8C46) Report Version: 3 Command: R Path: /Volumes/George/MyApplications/R.app/Contents/MacOS/R Parent: WindowServer [146] Version: 1.12 (1622) PID: 10493 Thread: 0 Exception: EXC_BAD_ACCESS (0x0001) Codes: KERN_INVALID_ADDRESS (0x0001) at 0x68000001 Thread 0 Crashed: 0 libR.dylib 0x00303d1c Rf_isObject + 0 (util.c:623) 1 grid.so 0x060c6240 pureNullUnit + 40 (unit.c:270) 2 grid.so 0x060c6284 pureNullUnit + 108 (unit.c:273) 3 grid.so 0x060c3894 findRelWidths + 60 (layout.c:69) 4 grid.so 0x060c484c calcViewportLayout + 172 (layout.c:464) 5 grid.so 0x060ca888 calcViewportTransform + 1296 (viewport.c:356) 6 grid.so 0x060be0a0 doSetViewport + 256 (grid.c:200) 7 grid.so 0x060be5ac L_setviewport + 76 (grid.c:311) 8 libR.dylib 0x00249318 do_dotcall + 652 (dotcode.c:770) 9 libR.dylib 0x0024cc7c do_dotcallgr + 80 (dotcode.c:1450) 10 libR.dylib 0x00263b24 Rf_eval + 1536 (eval.c:405) 11 libR.dylib 0x00265b1c do_set + 224 (eval.c:1309)
On Jul 19, 2005, at 6:39 AM, jp-www at dcs.gla.ac.uk wrote:> Sourcing this code causes the R GUI to crash. I've enclosed a > partial backtrace > from the crash below.I can confirm that this crashes both on OS X (current R-devel) and Linux (2.1.1). The detailed stack trace (with debug symbols) from OS X follows. However, I can't find any documentation on "null" units (?unit doesn't mention them), so I wonder whether this is just a missing sanity check or something more profound ... #0 Rf_isObject (s=0x68000001) at ../../../../R-devel/src/main/util.c: 616 #1 0x003060e4 in Rf_inherits (s=0x68000001, name=0x966ad80 "unit.arithmetic") at ../../../../R-devel/src/main/util.c:624 #2 0x096651b8 in pureNullUnit (unit=0x68000001, index=0, dd=0x113eff0) at ../../../../../../R-devel/src/library/grid/src/ unit.c:270 #3 0x096651fc in pureNullUnit (unit=0x10ff78e8, index=2, dd=0x113eff0) at ../../../../../../R-devel/src/library/grid/src/ unit.c:273 #4 0x09662768 in findRelWidths (layout=0x108d7528, relativeWidths=0x11b0b4f8, dd=0x113eff0) at ../../../../../../R-devel/ src/library/grid/src/layout.c:70 #5 0x09663720 in calcViewportLayout (viewport=0x10bfad60, parentWidthCM=12.699999999999999, parentHeightCM=12.699999999999999, parentContext={xscalemin = 0, xscalemax = 1, yscalemin = 0, yscalemax = 1}, parentgc=0xbfff76f0, dd=0x113eff0) at ../../../../../../R-devel/ src/library/grid/src/layout.c:463 #6 0x09669888 in calcViewportTransform (vp=0x10bfad60, parent=0x10c6af38, incremental=3221190720, dd=0x113eff0) at ../../../../../../R-devel/src/library/grid/src/viewport.c:351 #7 0x0965cefc in doSetViewport (vp=0x10bfad60, topLevelVP=157724032, pushing=281456440, dd=0x113eff0) at ../../../../../../R-devel/src/ library/grid/src/grid.c:185 #8 0x0965d40c in L_setviewport (vp=0x10bfad60, hasParent=0x10d4da68) at ../../../../../../R-devel/src/library/grid/src/grid.c:302 #9 0x0024a0b0 in do_dotcall (call=0x119008d8, op=0x966ad80, args=0x18681b0, env=0x80808080) at ../../../../R-devel/src/main/ dotcode.c:788 #10 0x0024da14 in do_dotcallgr (call=0x119008d8, op=0x18c5794, args=0x11902244, env=0x11900ccc) at ../../../../R-devel/src/main/ dotcode.c:1468 #11 0x00264964 in Rf_eval (e=0x119008d8, rho=0x11900ccc) at ../../../../R-devel/src/main/eval.c:405 Cheers, Simon> =============> require(grid) > > sometext = "hello there\nthis is a \ntest!" > > pushViewport( > viewport( > layout=grid.layout(1,3, > widths=unit.c( > unit(1,"strwidth",sometext) + > unit(2,"cm"), > unit(1,"null") > ) > ) > ) > ) > =============> > Date/Time: 2005-07-19 11:35:30.950 +0100 > OS Version: 10.4.2 (Build 8C46) > Report Version: 3 > > Command: R > Path: /Volumes/George/MyApplications/R.app/Contents/MacOS/R > Parent: WindowServer [146] > > Version: 1.12 (1622) > > PID: 10493 > Thread: 0 > > Exception: EXC_BAD_ACCESS (0x0001) > Codes: KERN_INVALID_ADDRESS (0x0001) at 0x68000001 > > Thread 0 Crashed: > 0 libR.dylib 0x00303d1c Rf_isObject + 0 (util.c: > 623) > 1 grid.so 0x060c6240 pureNullUnit + 40 > (unit.c:270) > 2 grid.so 0x060c6284 pureNullUnit + 108 > (unit.c:273) > 3 grid.so 0x060c3894 findRelWidths + 60 > (layout.c:69) > 4 grid.so 0x060c484c calcViewportLayout + 172 > (layout.c:464) > 5 grid.so 0x060ca888 calcViewportTransform + > 1296 > (viewport.c:356) > 6 grid.so 0x060be0a0 doSetViewport + 256 > (grid.c:200) > 7 grid.so 0x060be5ac L_setviewport + 76 > (grid.c:311) > 8 libR.dylib 0x00249318 do_dotcall + 652 > (dotcode.c:770) > 9 libR.dylib 0x0024cc7c do_dotcallgr + 80 > (dotcode.c:1450) > 10 libR.dylib 0x00263b24 Rf_eval + 1536 (eval.c: > 405) > 11 libR.dylib 0x00265b1c do_set + 224 (eval.c:1309) > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > > >
jp-www@dcs.gla.ac.uk
2005-Jul-19 23:23 UTC
[Rd] segfault with grid and null unit (PR#8014)
On 19 Jul 2005, at 23:49, paul murrell wrote:> > The issue is that you have specified a layout with three columns, > but only two > column widths. What should happen is that the widths should be > recycled, but > this was not working for non-trivial units (as in your example). I > have fixed > this for R 2.2.0. I have also added a mention of "null" units to ? > unit, plus a > link to the existing mention in ?grid.layoutThanks for the info, and also for the recent documentation on the grid package, which I have been devouring today. I stumbled across that bug when I was copying (by hand) the "Adding lattice to grid" example from "grid.pdf" and mis-typed 3 instead of 2. Jonathan