[R-pkg-devel] strange errors (non-ascii symbols) on win-builder R-devel

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Tue Jan 24 19:12:21 CET 2023


On Tue, 24 Jan 2023 17:33:10 +0000
Maxim Nazarov <maxim.nazarov using openanalytics.eu> wrote:

> this seems to come from the C code

I'm 99% sure this comes from the following changes to the package:

--- minpack.lm_1.2-2/src/fcn_message.c  2020-03-23 10:54:03.000000000 +0300
+++ minpack.lm_1.2-3/src/fcn_message.c  2023-01-17 09:30:05.000000000 +0300
@@ -3,24 +3,24 @@
 char *fcn_message(char *msg, int info, int n, int nit)
 {
     if      (info == 1)
-        sprintf(msg, "Relative error in the sum of squares is at most `ftol'.");
+        Rprintf(msg, "Relative error in the sum of squares is at most `ftol'.");
     else if (info == 2)

(And so on for other values of `info`.)

sprintf() takes a string pointer to write into as its first argument.
Rprintf(), on the other hand, prints straight to the R console; its
first argument is the format string. Given a valid pointer to an
uninitialised string instead of the format string, Rprintf prints stack
garbage to the console, ignoring the following arguments. My guess is
that the maintainers either intended to remove the msg argument
altogether or needed to use snprintf() and pass the buffer size to
fcn_message().

-- 
Best regards,
Ivan



More information about the R-package-devel mailing list