Skip to content

Quoting only non-standard paths on linux #1243

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

Merged
merged 2 commits into from
Jan 24, 2023
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 @@
2023-01-24 Lukasz Laniewski-Wollk <llaniewski@meil.pw.edu.pl>

* R/RcppLdpath.R: CxxFlags() now quotes only non-standard paths on linux

2023-01-08 Dirk Eddelbuettel <edd@debian.org>

* inst/include/Rcpp/String.h: Address clang++-14 conversion warning
Expand Down
10 changes: 9 additions & 1 deletion R/RcppLdpath.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ Rcpp.system.file <- function(...){
tools::file_path_as_absolute( base::system.file( ..., package = "Rcpp" ) )
}

## quote path if non-standard characters are used
Rcpp.quoteNonStandard <- function(path) {
## On unix, check if path has only characters that do not need quoting
noquote <- .Platform$OS.type == "unix" && grepl("^[[:alnum:]/._~+@%-]*$", path)
## If no quoting needed return unchanged else quote input
if (noquote) path else shQuote(path)
}

## Use R's internal knowledge of path settings to find the lib/ directory
## plus optinally an arch-specific directory on system building multi-arch
RcppLdPath <- function() {
Expand Down Expand Up @@ -51,7 +59,7 @@ RcppCxxFlags <- function(cxx0x=FALSE) {
if (.Platform$OS.type=="windows") {
path <- asBuildPath(path) # #nocov
}
paste0('-I"', path, '"')
paste0('-I', Rcpp.quoteNonStandard(path))
}

## Shorter names, and call cat() directly
Expand Down
10 changes: 10 additions & 0 deletions inst/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
\newcommand{\ghpr}{\href{https://github.com/RcppCore/Rcpp/pull/#1}{##1}}
\newcommand{\ghit}{\href{https://github.com/RcppCore/Rcpp/issues/#1}{##1}}

\section{Changes in Rcpp hotfix release version 1.0.11 (2023-07-xx)}{
\itemize{
\item Changes in Rcpp API:
\itemize{
\item \code{Rcpp:::CxxFlags()} now quotes only non-standard include path
on linux (closing \ghit{1242}).
}
}
}

\section{Changes in Rcpp release version 1.0.10 (2023-01-12)}{
\itemize{
\item Changes in Rcpp API:
Expand Down