Skip to content

Conversation

@fabern
Copy link
Member

@fabern fabern commented Oct 13, 2025

An issue with rchk popped up. CRAN still passing but might need to be addressed:

Function biomee_f_C
  [UP] calling allocating function Rf_allocArray(?,V) with a fresh pointer (dims <arg 2>) rsofun/src/wrappersc.c:231

See results: https://cran.r-project.org/web/checks/check_results_rsofun.html
See documentation: https://github.com/kalibera/cran-checks/blob/master/rchk/PROTECT.md

In spite of the location of the error shown at line 231, I can make the rchk pass locally (in a Docker container)

cd GitHub

# setup docker container for local testing
docker pull kalibera/rchk:latest

# check the current CRAN release: (should error)
docker run --rm kalibera/rchk:latest rsofun

# check the local version of the package (../geco-bern/rsofun)
mkdir packages
cd ../GitHub/packages 
R CMD build ../../GitHub/geco-bern/rsofun
cd ../../GitHub
docker run --rm -v `pwd`/packages:/rchk/packages kalibera/rchk:latest /rchk/packages/rsofun_5.1.0.9000.tar.gz

when adding a PROTECT statement to dims:

SEXP dims = PROTECT( allocVector(INTSXP, 4) );
...
UNPROTECT(6);

@marcadella, is it as simple as that?

@fabern fabern requested a review from marcadella October 13, 2025 06:45
@fabern fabern mentioned this pull request Oct 13, 2025
19 tasks
@marcadella
Copy link
Collaborator

Amazing, you already found it :) Yes, I think that should fix it.

@fabern
Copy link
Member Author

fabern commented Oct 13, 2025

Excellent. Thanks for taking the time to review this!

@fabern fabern merged commit 2859b51 into master Oct 13, 2025
7 checks passed
@fabern fabern deleted the fix-rchk-PROTECT branch October 13, 2025 08:39
@fabern
Copy link
Member Author

fabern commented Oct 13, 2025

Ah, and the line number 231 actually makes sense, since dims is used in 231 and that triggered the fresh pointer warning (even though the fix is then in the definition in 227).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants