Issue 66 in rpostgresql: Remove snprintf calls

2 views
Skip to first unread message

rpost...@googlecode.com

unread,
Oct 30, 2014, 2:11:47 PM10/30/14
to rpostgr...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 66 by zach.mayer: Remove snprintf calls
https://code.google.com/p/rpostgresql/issues/detail?id=66

RS-pgsql-pqexec.c, line 90:
snprintf(errResultMsg, len + 80, "could not Retrieve the result : %s",
omsg);

Use of snprintf and printf is a serious problem in an R package as it
generates output bypasses the R session completely and therefore cannot be
suppressed, captured, or handled as an error.

It would be far better to promote these errors to R "messages", "warnings"
or "errors" so they can be handled appropriately by the R session.

At the very least, removing this line would be a good start.

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

rpost...@googlecode.com

unread,
Oct 30, 2014, 2:19:02 PM10/30/14
to rpostgr...@googlegroups.com

Comment #1 on issue 66 by zach.mayer: Remove snprintf calls
https://code.google.com/p/rpostgresql/issues/detail?id=66

This is in the CRAN version of the package btw. Inspecting the package
source from the SVN reveals snprintf calls all over the place. At the very
least, these calls should be replaced with Rprintf, REprintf, or warning.

See also page 3 of "An Introduction to the .C Interface to R"
(http://www.biostat.jhsph.edu/~rpeng/docs/interface.pdf)

and this question on stack overflow:
http://stackoverflow.com/questions/8842573/suppress-c-warning-messages-in-r

rpost...@googlecode.com

unread,
Oct 30, 2014, 4:02:22 PM10/30/14
to rpostgr...@googlegroups.com

Comment #2 on issue 66 by zach.mayer: Remove snprintf calls
https://code.google.com/p/rpostgresql/issues/detail?id=66

I apologize for my confusion, please ignore this bug report. The error I'm
seeing appears to come from the Postres driver itself, rather than
RPostgreSQL.
Reply all
Reply to author
Forward
0 new messages