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
Quoting only non-standard paths on linux #1243
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding changelog and news, and flipping from = to <-. I would probably still reorder the logic in function to (untested)
Rcpp.quoteNonStandard <- function(path, quoteAll = .Platform$OS.type!="unix") {
## Check if path has only characters that do not need quoting
sel <- grepl("^[[:alnum:]/._~+@%-]*$", path)
## If no quoting needed return unchanged else quote input
if (sel) path else shQuote(path)
}
Simpler?
ef8a394
to
82bcfc0
Compare
I simplified the function for single path input, and removed the option, as it was not used. Hope this looks good now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 -- looks great! I'll wait a bit in case Kevin or Inaki find something objectionable but will otherwise merge and roll up a first 1.0.10.1 with this.
For the regexp, I suggest following some well-established reference. For example, this is what pkgconfig escapes in paths:
So the inverse would be allowed characters. |
Good idea in theory. In practice ... maybe I am lacking coffee (only one cup in) but what exactly are you proposing? A per-character loop? A re-written regexp? Can you sketch something I actually think the regexp is reasonably careful as is. |
A re-written regexp. Following the ASCII table and the reference above, it seems after all that the only difference would be |
Extra eyes on the ball are a good thing. Thanks for checking! |
This closes #1242
Checklist
R CMD check
still passes all tests