Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Readonly file io error #1346

Merged
merged 3 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2024-11-25 Simon Guest <simon.guest@tesujimath.org>

* src/attributes.cpp: fix CPP source having to be writable

2024-11-03 Marco Colombo <mar.colombo13@gmail.com>

* vignettes/rmd/Rcpp-FAQ.Rmd: Fixed typos
Expand Down
2 changes: 1 addition & 1 deletion src/attributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3279,7 +3279,7 @@ namespace {

// copy the source file to the build dir
Rcpp::Function filecopy = Rcpp::Environment::base_env()["file.copy"];
filecopy(cppSourcePath_, generatedCppSourcePath(), true);
filecopy(cppSourcePath_, generatedCppSourcePath(), true, Rcpp::_["copy.mode"] = false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. I'll look some more at that tomorrow over morning coffee -- this ensures we get 0644 irrespective of original permissionss?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have by now caught up onto help(file.copy) -- this is perfect. Had worried that this code, because it dates back to before we had filesystem semantics from C++17 and all that, would have to do dance to do this portably. But farming out to a call to then underlying R instance we always have is golden, and that function has that option. Very nice.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I generally have a mild dislike of Rcpp::_[...] over the preferred Rcpp::Named("...") but they are equivalent, and the former is used in the file already. So may change that another time....


// parse attributes
SourceFileAttributesParser sourceAttributes(cppSourcePath_, "", true);
Expand Down