Re: [R-pkg-devel] Cryptic error on Windows but not Debian

2023-11-18 Thread Simon Urbanek
Chris, this was not a change in interpretation, but rather CRAN's tools have gotten better at detecting such bad behavior. I would like to point out that there is absolutely no reason to mangle user's .Renviron since the package can always set any environment variables it needs from its (legal

Re: [R-pkg-devel] Check warning around sprintf: Compiled code should not call entry points which might terminate R nor write to stdout/stderr instead of to the console, nor use Fortran I/O nor system

2023-11-18 Thread Ivan Krylov
19 ноября 2023 г. 04:01:22 GMT+03:00, "Iago Giné-Vázquez" пишет: >The package contains both C and Fortran code and in the criteria.c there is >only a sprintf use, as follows: > >sprintf(msg,"criteria: error (%d) -> %s\n", inErr, errStr); >Rf_error(msg); Rf_error() takes format arguments like s

Re: [R-pkg-devel] Cryptic error on Windows but not Debian

2023-11-18 Thread Adam
Thank you, Chris. I plan to explore the method you described as simply removing the authorize function would be a shame. Your description of the past was certainly worthwhile and enlightening. Best, Adam On Sat, Nov 18, 2023 at 6:40 PM Kenny, Christopher < christopherke...@fas.harvard.edu> wrote

Re: [R-pkg-devel] Check warning around sprintf: Compiled code should not call entry points which might terminate R nor write to stdout/stderr instead of to the console, nor use Fortran I/O nor system

2023-11-18 Thread Ben Bolker
You may also be able to use Rprintf ? https://teuder.github.io/rcpp4everyone_en/060_printing_massages.html On 2023-11-18 8:07 p.m., Iris Simmons wrote: Yes, the reason for the error is the use of sprintf. You can instead use snprintf where n is the maximum number of bytes to write, including

Re: [R-pkg-devel] Check warning around sprintf: Compiled code should not call entry points which might terminate R nor write to stdout/stderr instead of to the console, nor use Fortran I/O nor system

2023-11-18 Thread Iago Giné-Vázquez
Thank you very much, Iris. Indeed that removed the warning. Kind regards, Iago Sent with [Proton Mail](https://proton.me/) secure email. On Sunday, 19 November 2023 at 02:07, Iris Simmons wrote: > Yes, the reason for the error is the use of sprintf. You can instead use > snprintf where n is t

Re: [R-pkg-devel] Check warning around sprintf: Compiled code should not call entry points which might terminate R nor write to stdout/stderr instead of to the console, nor use Fortran I/O nor system

2023-11-18 Thread Iris Simmons
Yes, the reason for the error is the use of sprintf. You can instead use snprintf where n is the maximum number of bytes to write, including the terminating nul character. For example: char msg[8191]; snprintf(msg, 8191, "criteria: error (%d) -> %s\n", inErr, errStr); Rf_error(msg); or however la

[R-pkg-devel] Check warning around sprintf: Compiled code should not call entry points which might terminate R nor write to stdout/stderr instead of to the console, nor use Fortran I/O nor system RNGs

2023-11-18 Thread Iago Giné-Vázquez
Dear all, I am updating a CRAN-archived R package, so it can get back to CRAN. But there is a warning produced in Linux OS that I am not sure to understand and I do not know how to solve, even after looking at ‘Writing portable packages’ in the ‘Writing R Extensions’ manual and after searching

Re: [R-pkg-devel] Cryptic error on Windows but not Debian

2023-11-18 Thread Kenny, Christopher
Rather than using tools::R_user_dir(), you can also ask the user for a path where they would like to save the information to. This allows you to test it with a temporary directory file, but would allow the user to specify their .Renviron file, if they so choose. This acts as a middle ground mana

Re: [R-pkg-devel] Cryptic error on Windows but not Debian

2023-11-18 Thread Adam
Thank you so much for clarifying this. Best, Adam On Sat, Nov 18, 2023 at 6:14 PM Simon Urbanek wrote: > Adam, > > no, it is your code in mm_authorize() that violates the CRAN policy, it is > not about the test. You may not touch user's .Renviron and there is no > reason to resort to such dras

Re: [R-pkg-devel] Cryptic error on Windows but not Debian

2023-11-18 Thread Simon Urbanek
Adam, no, it is your code in mm_authorize() that violates the CRAN policy, it is not about the test. You may not touch user's .Renviron and there is no reason to resort to such drastic measures. If you want to cache user's credentials, you have to do it in a file located via tools::R_user_dir()

Re: [R-pkg-devel] Cryptic error on Windows but not Debian

2023-11-18 Thread Adam
Thank you dearly, Simon, for pointing out the policy. May a test do the following? 1. Save the user's original value for env var X. 2. Write a new value for env var X during a test. 3. Write back the original value for env var X at the end of the test. An example: test_that("mm_authorize() sets

Re: [R-pkg-devel] Cryptic error on Windows but not Debian

2023-11-18 Thread Simon Urbanek
Adam, > On Nov 19, 2023, at 9:39 AM, Adam wrote: > > Dear Ivan, > > Thank you for explaining in such depth. I had not submitted to CRAN before. > I will look into tools::R_user_dir(). > > - May you point me toward the policy that the package should not edit > .Renviron? It is the policy yo

Re: [R-pkg-devel] Cryptic error on Windows but not Debian

2023-11-18 Thread Adam
Dear Ivan, Thank you for explaining in such depth. I had not submitted to CRAN before. I will look into tools::R_user_dir(). - May you point me toward the policy that the package should not edit .Renviron? I thought I was following best practices, but maybe things have changed. For instance, this

Re: [R-pkg-devel] Cryptic error on Windows but not Debian

2023-11-18 Thread Ivan Krylov
В Fri, 17 Nov 2023 17:08:13 -0500 Adam пишет: > 1. The example should not be running in the first place, as it has > @examplesIf megamation:::mm_has_creds(), which should be FALSE for > CRAN (it depends on env. variables) The tarball I have fished from CRAN says version 0.2.0, but your GitHub re

[R-pkg-devel] Cryptic error on Windows but not Debian

2023-11-18 Thread Adam
I pass on Debian but have an ERROR on Windows dev. version of R. I'm confused for 2 reasons: 1. The example should not be running in the first place, as it has @examplesIf megamation:::mm_has_creds(), which should be FALSE for CRAN (it depends on env. variables) 2. I see the example printed twice