From 371d29f94db2f81306dda090d760ce915042477e Mon Sep 17 00:00:00 2001 From: blundellc Date: Fri, 27 Nov 2009 22:21:37 +0000 Subject: [PATCH] work around calloc error in R 2.10 git-svn-id: svn://svn.r-forge.r-project.org/svnroot/cran2deb@286 edb9625f-4e0d-4859-8d74-9fd3b1da38cb --- trunk/R/db.R | 17 ++++++++++++++++- trunk/data/populate_depend_aliases | 2 ++ trunk/data/populate_forcedep | 1 + 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/trunk/R/db.R b/trunk/R/db.R index 75c658c..c41fb52 100644 --- a/trunk/R/db.R +++ b/trunk/R/db.R @@ -307,6 +307,21 @@ db_date_format <- '%Y-%m-%d' db_time_format <- '%H:%M:%OS %Z' db_record_build <- function(package, deb_version, log, success=F) { + # if the log is more than 1kB, only keep the last 1kB. + # this is to work around a problem that seems to have appeared in R 2.10 causing calloc errors. + # if the log is not pruned then we get the following error: + # + # Error in gsub("(['\"])", "\\1\\1", text) : + # Calloc could not allocate (-197080581 of 1) memory + # Error in dbGetQuery(con, paste("INSERT OR REPLACE INTO builds", "(package,system,r_version,deb_epoch,deb_revision,db_version,success,date_stamp,time_stamp,scm_revision,log)", : + # error in evaluating the argument 'statement' in selecting a method for function 'dbGetQuery' + + log = paste(log,collapse='\n') + end = nchar(log) + max_log_len = 1024 + if (end > max_log_len) { + log = db_quote(substr(log,end-max_log_len,end)) + } con <- db_start() o<-options(digits.secs = 6) dbGetQuery(con,paste('INSERT OR REPLACE INTO builds' @@ -322,7 +337,7 @@ db_record_build <- function(package, deb_version, log, success=F) { ,',',db_quote(format(Sys.time(), db_date_format)) ,',',db_quote(format(Sys.time(), db_time_format)) ,',',db_quote(scm_revision) - ,',',db_quote(paste(log, collapse='\n')) + ,',',log ,')')) options(o) db_stop(con) diff --git a/trunk/data/populate_depend_aliases b/trunk/data/populate_depend_aliases index ee22eb0..de68484 100644 --- a/trunk/data/populate_depend_aliases +++ b/trunk/data/populate_depend_aliases @@ -121,3 +121,5 @@ alias_run tk-img libtk-img alias_build tk-img libtk-img-dev alias_build pkg-config pkg-config alias_run pkg-config pkg-config +alias_build rgtk2 r-cran-rgtk2 +alias_run rgtk2 r-cran-rgtk2 diff --git a/trunk/data/populate_forcedep b/trunk/data/populate_forcedep index 35662c5..2940480 100644 --- a/trunk/data/populate_forcedep +++ b/trunk/data/populate_forcedep @@ -49,3 +49,4 @@ force vr DoE.base force colorspace DoE.base force pkg-config mvgraph force glade RGtk2 +force rgtk2 rattle -- 2.39.2