Repository navigation
New CRAN Issue: boolean.h creating errors on r-devel Debian gcc #6779
Description
Activity
Thanks to Brian pinning down the responsible change in r-devel. I've been having trouble reproducing it but it seems something we need to handle anyway.
Did Brian give a date for a required update?
Probably the change should just be shipped with 1.17.0 at this point, as opposed to a new patch.
- changed the title
[-]New CRAN Issue:[/-][+]New CRAN Issue: boolean.h creating errors on r-devel Debian gcc[/+]on Jan 30, 2025 This was a message from Kurt but agree, pointing to the commit was really nice.
Forgot to include that, he said: 2025-02-20
Reacted by Michael ChiricoPerma-linking the mirrored version of the change:
Jan's dockerfiles repo is currently failing its pipeline (cc @jangorecki + @ben-schwen), so the codespaces are also using a too-old version of r-devel:
https://gitlab.com/jangorecki/dockerfiles/-/pipelines?page=2&scope=all
What r87656 broke is the ability to assume that
LGLSXPvectors containRbooleans and maybe have them storeNA_LOGICAL. (PreviouslyRbooleanwas anenum, which in practice meant a fancyint.) Now thatRbooleanis an alias for Cbool, it can only store 0 or 1, nothing else, and most likely differs in size fromint.Meanwhile,
LOGICAL()returns anint*, so now we cannot safely cast it toRboolean*. This seems to be a one-line fix, actually!Thanks! I think I've been fundamentally not understanding the
Rbooleantype, described in WRE:Further, the included header R_ext/Boolean.h has enumeration constants TRUE and FALSE of type Rboolean in order to provide a way of using “logical” variables in C consistently. This can conflict with other software: for example it conflicts with the headers in IJG’s jpeg-9 (but not earlier versions).
I had been thinking
Rbooleanis the "correct" type forLOGICAL(), i.e. that when we treatLOGICAL()asint*, we're exposing ourselves to R eventually changing storage type forLGLSXP. But i guess it's actually just a long-time workaround for the lack of "true" fundamental boolean types in C?Yes,
stdbool.honly appeared in C99, and everyone invented their own booleans in the preceding decades. I too thought thatRbooleans were deliberately defined in a type that was in practice compatible withLOGICAL(...)buffers. It's one of the things that would be great to see clarified in API documentation.Post-factum it's easier to notice that
LOGICAL_OR_NULLis explicitly documented to return anint*, or that any time an R API function takes anRbooleanargument, it doesn't test for NA_LOGICAL.Reacted by Michael ChiricoRaised on r-devel: https://stat.ethz.ch/pipermail/r-devel/2025-January/083813.html
Reacted by Tyson Barrett

Just got this message from CRAN and co:
Error is on r-devel for Debian gcc https://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-debian-gcc/data.table-00check.html tied to the change shown for Jan 29 https://developer.r-project.org/blosxom.cgi/R-devel/NEWS.
What I'm seeing as the diff is: