paleolimbot commented on code in PR #14271:
URL: https://github.com/apache/arrow/pull/14271#discussion_r997414990
##########
r/src/array.cpp:
##########
@@ -69,7 +69,10 @@ void arrow::r::validate_slice_length(R_xlen_t length,
int64_t available) {
cpp11::stop("Slice 'length' cannot be negative");
}
if (length > available) {
- cpp11::warning("Slice 'length' greater than available length");
+ // For an unknown reason, cpp11::warning() crashes here; however, this
+ // should throw an exception if Rf_warning() jumps, so we need
+ // cpp11::safe[]().
+ cpp11::safe[Rf_warning]("Slice 'length' greater than available length");
Review Comment:
I created https://github.com/r-lib/cpp11/issues/295 for this...I don't think
this is an Arrow issue or a cpp11 issue, but that seemed like the most useful
place to document it. In investigating this I also noticed that
`cpp11::warning(std::string("Slice 'length' greater than available length"))`
is also fine (it's only the `const char*` version that crashes).
I was able to rule out memory protection (in the altrep code)...you can
cause the issue without ever creating an ALTREP vector (I tested using a dummy
function that just calls `cpp11::warning()`).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]