mbojan / rgraph6

Encoding graphs in graph6, sparse6, and digraph6 formats
https://mbojan.github.io/rgraph6/
GNU General Public License v3.0
12 stars 3 forks source link

CRAN reports C-level problems #31

Closed mbojan closed 2 years ago

mbojan commented 2 years ago

CRAN runs additional tests list of which is at https://cran.r-project.org/web/checks/check_issue_kinds.html The package currently fails the one called clang-UBSAN, which is described at https://www.stats.ox.ac.uk/pub/bdr/memtests/README.txt and in Writing R extension at https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Checking-memory-access

The log is at https://www.stats.ox.ac.uk/pub/bdr/memtests/clang-UBSAN/rgraph6/tests/testthat.Rout

@schochastics , can you help with that?

These need to be solved by 2022-03-10 or the package gets archived.

mbojan commented 2 years ago

The initial lines of the error message are:

/data/gannet/ripley/R/test-clang/Rcpp/include/Rcpp/internal/caster.h:30:25: runtime error: -1 is outside the range of representable values of type 'unsigned long'
    #0 0x7fdeea47b2eb in unsigned long Rcpp::internal::caster<double, unsigned long>(double) /data/gannet/ripley/R/test-clang/Rcpp/include/Rcpp/internal/caster.h:30:25
    #1 0x7fdeea47b2eb in unsigned long Rcpp::internal::primitive_as<unsigned long>(SEXPREC*) /data/gannet/ripley/R/test-clang/Rcpp/include/Rcpp/as.h:39:21
    #2 0x7fdeea45caae in unsigned long Rcpp::internal::as<unsigned long>(SEXPREC*, Rcpp::traits::r_type_primitive_tag) /data/gannet/ripley/R/test-clang/Rcpp/include/Rcpp/as.h:44:20
    #3 0x7fdeea45caae in unsigned long Rcpp::as<unsigned long>(SEXPREC*) /data/gannet/ripley/R/test-clang/Rcpp/include/Rcpp/as.h:152:16
    #4 0x7fdeea45caae in Rcpp::InputParameter<unsigned long>::operator unsigned long() /data/gannet/ripley/R/test-clang/Rcpp/include/Rcpp/InputParameter.h:34:38
    #5 0x7fdeea45caae in _rgraph6_d2b /data/gannet/ripley/R/packages/tests-clang-SAN/rgraph6/src/RcppExports.cpp:31:38

so the problem seems to be with d2b().

schochastics commented 2 years ago

Ah the good old archiving thread... I will (try to) fix it tomorrow!

mbojan commented 2 years ago

Ah the good old archiving thread... I will (try to) fix it tomorrow!

:))) Thanks!

schochastics commented 2 years ago

Ok I THINK I fixed it already. problem occurs at two points where we have d2b(n - 1) when n=0. Couldnt fix it in the C++ code without potentially introcuing new issues so I did a hardcode fix on the R side which should be fine. I will do some more testing till tomorrow ~lunchtime and will let you know if everything is stable

mbojan commented 2 years ago

OK, great! I never had these issues before. I'm wondering if it is possible to run these tests locally, or better yet, have them run by the CI? This would shorten the "ping-pong" with CRAN.

Other than that, it is somewhat strange that the submission went smoothly with a "on CRAN now" message in two days, and then after another two days this... With a two-week deadline... Not very nice.

schochastics commented 2 years ago

I think this might be one of those obscure tests that are not run automatically. I had similar ones before. I have no idea how to test this locally, but i will give it a shot tomorrow.

schochastics commented 2 years ago

@mbojan I couldn't test it in a satisfactory way, but I am confident that the error is fixed now. So you can submit to CRAN again and then we pray that no other weird environment throws errors.

mbojan commented 2 years ago

Aight, thanks @schochastics .

Still, I think I'll write the devs about these tests. There should be an unequivocal instruction how to setup these tests locally, if not a premade R CMD command or script that launches these. Otherwise it is a nonsense to expect contributions to pass tests that are unreproducible....

schochastics commented 2 years ago

I find the worst is when they give you like 2 weeks to fix these things. As if we have nothing else to do...

mbojan commented 2 years ago

Ha! So Duncan Murdoch writes that one can run these tests on R-hub! See https://builder.r-hub.io/advanced. However, I tried and the check fails at installing R dependencies with `Rcpp not found"... :/

schochastics commented 2 years ago

In my experience, rhub fails a lot for the more obscure systems unfortunately :(. Not sure why

mbojan commented 2 years ago

Fixed and sent to CRAN.