cpp11 icon indicating copy to clipboard operation
cpp11 copied to clipboard

Found non-API calls to R: `SETLENGTH`, `SET_TRUELENGTH`

Open jwood000 opened this issue 1 year ago • 2 comments

Recently, my package RcppAlgos started getting NOTEs on several builds from CRAN checks:

https://cran.r-project.org/web/checks/check_results_RcppAlgos.html

The NOTE is: "Found non-API calls to R: SETLENGTH, SET_TRUELENGTH"

I did many grep checks in my code repository and could not find and occurrence of SETLENGTH or SET_TRUELENGTH. I then googled the NOTE and several packages popped up. All of them that I checked depend on cpp11.

I then found this issue for arrow, apache/arrow#41404, which talks about this problem as well.

Both of these calls appear occurring in the r_vector header: https://github.com/r-lib/cpp11/blob/51f4cd5ad9425a491dedf951a3679346d416e51c/inst/include/cpp11/r_vector.hpp#L898-L903

I also found this from r-source/wch in src/library/tools/R/sotools.R (check out lines 561 to 669):

https://github.com/wch/r-source/blob/becbbf2a71ed56d4f7503d2dc4ac391d8c05eac6/src/library/tools/R/sotools.R#L561-L669

I'm not really sure what action to take here, I just wanted to bring this to your attention.

Regards, Joseph

jwood000 avatar May 01 '24 14:05 jwood000

Can the first SETLENGTH be replaced by

x = Rf_xlengthgets(x, length); 

?

chainsawriot avatar May 24 '24 20:05 chainsawriot

Or this

https://github.com/r-lib/brio/commit/19cedeaafab31210b84c25075791abf3af5d11f5#diff-4b539828f8475a0f5ae0e041e4bbfae0ce140219c19fdfd79da7cc1863170dac

chainsawriot avatar May 24 '24 20:05 chainsawriot