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

Maxim Nazarov m@x|m@n@z@rov @end|ng |rom open@n@|yt|c@@eu
Thu Jan 26 11:33:33 CET 2023


Thank you, Duncan and Ivan for helpful feedback.
I reached out to the maintainer of the package, and she was able to quickly resolve the issue and resubmit.
Consequently my re-submission was accepted.

Kind regards,
Maxim Nazarov


----- Original Message -----
From: "Duncan Murdoch" <murdoch.duncan using gmail.com>
To: "Ivan Krylov" <krylov.r00t using gmail.com>, "Maxim Nazarov" <maxim.nazarov using openanalytics.eu>
Cc: "r-package-devel" <r-package-devel using r-project.org>
Sent: Tuesday, 24 January, 2023 20:55:21
Subject: Re: [R-pkg-devel] strange errors (non-ascii symbols) on win-builder R-devel

On 24/01/2023 1:12 p.m., Ivan Krylov wrote:
> 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().
> 

Package maintainers recently got a message telling us not to use 
sprintf() any more.  I guess the minpack.lm maintainer either didn't 
read the whole message carefully enough and used Rprintf as a substitute 
instead of snprintf(), or intended to use snprintf(), but typed 
Rprintf() out of habit.

Duncan Murdoch



More information about the R-package-devel mailing list