Bug 16581 - options("deparse.max.lines") ignored when exiting debug
Summary: options("deparse.max.lines") ignored when exiting debug
Status: CLOSED FIXED
Alias: None
Product: R
Classification: Unclassified
Component: Misc (show other bugs)
Version: R 3.2.2
Hardware: All All
: P5 minor
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2015-10-27 13:13 UTC by Robert McGehee
Modified: 2015-12-14 13:47 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert McGehee 2015-10-27 13:13:24 UTC
Hi,
I noticed that the option "deparse.max.lines" is respected when entering into a debugged function, but ignored when leaving it. I noticed this when performing a debug on a very large query (produced by a massive do.call). I had to shut down my R system as the call was taking too long to print, despite having set "deparse.max.lines" to a small value.

Here's a reproducible example on R 3.2.2. Notice that when entering the debug, the call is limited to two lines, as requested by options("deparse.max.lines"=2). However, when exiting the debug, the entire call is printed (~14 lines). In my real-life case, debug tried printing over a million rows to screen, which is not what I wanted.

Thanks, 
Robert McGehee

> options("deparse.max.lines"=2)
> simplefun <- function(x) return(0)
> debug(simplefun)
> do.call("simplefun", list(x=rnorm(50)))
debugging in: simplefun(x = c(0.0836379369316631, 0.723436502988469, 0.50057244452165, 
-0.502246446671443, -1.49882492026654, -0.641537561689636, 2.12505154689625, 
  ...
debug: return(0)
Browse[2]> c
exiting from: simplefun(x = c(0.0836379369316631, 0.723436502988469, 0.50057244452165, 
-0.502246446671443, -1.49882492026654, -0.641537561689636, 2.12505154689625, 
1.064188157418, -1.80511037955853, -1.05912594024347, -1.12637923669252, 
1.65463063602428, -1.14873047310942, -1.53750765759401, 0.184977735858026, 
-0.465876561371472, -0.552345167260564, -0.0694183598255609, 
-0.25215194876745, -0.647146163939578, -1.1560738488788, 0.229725261938909, 
-1.85968903360029, 1.07007661464846, -0.288538392841055, -0.602481115629231, 
-0.0278181142627086, 2.264500503711, -0.330485592801632, 0.777646646172124, 
0.269004405415372, 0.470445541364572, -0.411479723096713, -0.4486766838305, 
-1.0660246214557, 0.637960210272543, 0.757835296471967, 0.14567520370828, 
-2.03785633031121, 0.796401242738838, -0.706703371959669, 1.50030827188652, 
0.341569871740278, -1.71254914802363, 2.41309762107789, 1.23968806881619, 
1.69580899329325, 0.0223930098950418, 1.60973940983649, 1.04340995143073
))
[1] 0
Comment 1 Duncan Murdoch 2015-10-27 17:08:59 UTC
Thanks for the report and the simple example.  I'll fix it soon in R-devel and R-patched.
Comment 2 Duncan Murdoch 2015-10-27 17:38:33 UTC
Fixed in r69578 in R-devel and R-patched.