Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

rchk issues #190

Closed
chainsawriot opened this issue Jun 2, 2024 · 7 comments
Closed

rchk issues #190

chainsawriot opened this issue Jun 2, 2024 · 7 comments

Comments

@chainsawriot
Copy link
Collaborator

chainsawriot commented Jun 2, 2024

https://raw.githubusercontent.com/kalibera/cran-checks/master/rchk/results/readODS.out

Cannot reproduce it locally.

docker pull kalibera/rchk:latest
docker run kalibera/rchk:latest readODS
@chainsawriot
Copy link
Collaborator Author

The Docker version doesn't match.

Rchk version: 1cae90e208e97a5c41f1c3e128d99b197478443e
R version: 84255/R Under development (unstable) (2023-04-13 r84255)
LLVM version: 14.0.0

@chainsawriot
Copy link
Collaborator Author

@chainsawriot
Copy link
Collaborator Author

template <typename T>
inline r_vector<T>::operator SEXP() const {
auto* p = const_cast<r_vector<T>*>(this);
if (data_ == R_NilValue) {
p->resize(0);
return data_;
}
if (length_ < capacity_) {
p->data_ = truncate(p->data_, length_, capacity_);
SEXP nms = names();
auto nms_size = Rf_xlength(nms);
if ((nms_size > 0) && (length_ < nms_size)) {
nms = truncate(nms, length_, capacity_);
names() = nms;
}
}
return data_;
}

Changing to this

template <typename T>
inline r_vector<T>::operator SEXP() const {
  auto* p = const_cast<r_vector<T>*>(this);
  if (data_ == R_NilValue) {
    p->resize(0);
    return data_;
  }
  if (length_ < capacity_) {
    p->data_ = truncate(p->data_, length_, capacity_);
    SEXP nms;
    PROTECT(nms = names());
    auto nms_size = Rf_xlength(nms);
    if ((nms_size > 0) && (length_ < nms_size)) {
      nms = truncate(nms, length_, capacity_);
      names() = nms;
    }
    UNPROTECT(1);
  }
  return data_;
}

does not raise the rchk issues. But I also need to check valgrind.

@chainsawriot
Copy link
Collaborator Author

can't run rchk on duckdb. Don't know whether I should inform the developers of duckdb, which also uses the same method.

@chainsawriot
Copy link
Collaborator Author

valgrind is triple zero.

@chainsawriot
Copy link
Collaborator Author

chainsawriot commented Jun 3, 2024

Now I can directly attribute the rchk issues to the fix.

r-hub2/educated-yogic-starfish-rrrrrr@04a1cab

Before and after.

@chainsawriot
Copy link
Collaborator Author

And this cancels the rchk issues.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant