-
-
Notifications
You must be signed in to change notification settings - Fork 208
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
Additional file path normalization to protect a windows path #1235
Conversation
While at it, do we need more |
I don't think this is the right fix. Here's what I see on my Windows VM:
In other words, A cross-platform fix would be to use |
Very good. Can you recurse into the discussion in #1234 and see with OP? What I suggested works for him there ... |
"Empirically speaking" this is a rare case anyway as we had a bazillion uses of |
Here is the whole block (as I currently have i.e. with the PR). There is a # grab components we need to build command
r <- normalizePath(file.path(R.home("bin"), "R"), winslash = "/", mustWork = FALSE)
lib <- context$dynlibFilename
deps <- context$cppDependencySourcePaths
src <- context$cppSourceFilename
# prepare the command (output if we are in showOutput mode)
args <- c(
r, "CMD", "SHLIB",
if (windowsDebugDLL) "-d",
if (rebuild) "--preclean",
if (dryRun) "--dry-run",
"-o", shQuote(lib),
if (length(deps))
paste(shQuote(deps), collapse = " "),
shQuote(src)
)
cmd <- paste(args, collapse = " ")
if (showOutput)
cat(cmd, "\n") # #nocov
# execute the build -- suppressWarnings b/c when showOutput = FALSE
# we are going to explicitly check for an error and print the output
result <- suppressWarnings(system(cmd, intern = !showOutput)) |
I'm surprised too, to be honest. That said, if there really was an issue affecting Windows users en-masse we surely would've heard a lot more about it by now! |
Yep! All I can think of is that OP's use case of Given the above I have less appetite for switching wholesale to Lunch time here in flyover country. Will ponder ... |
Really sorry, it was my mistake. I changed some code after that to debug, and forgot to restore the original code.
|
Ah, no worries, and extra brownie points to @kevinushey for catching this. I will amend and (conditionally on being on Windows) wrap |
Can you please try with these two lines r <- file.path(R.home("bin"), "R")
if (.Platform$OS.type == "windows") r <- shQuote(r) in lieu of the faulty one you indentified? |
It worked perfectly!
|
I did not see the short path like yours, here is mine:
I checked the help page of
I followed this link, and run this command
It means that (at least on my Windows) the 8.3 short form is enabled only "per volume on the system", which I guess it means it is only enabled for the system drive C by default, while I installed R in D. |
It's brilliant because the (underappreciated) 'R on Windows FAQ' has recommended for 20-some years to not do that: install in a path with space. Yet R always did, up until the 4.2.* series which (IIRC) finally converted that. I have not worked on Windows in many years so I am a little removed from that. And agreed on the D:/ vs C:/ difference here -- and that is likely why we generally have not seen this issue bubble up. |
We (informally) had a review here as @kevinushey spotted a thinko on my part but if anyone has a moment for a more 'formal' review and tick-off I'd appreciate it -- cleaner than me pushing through with a merge. |
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.
LGTM!
Motivation
Issue #1234 demonstrated that we had a left-over non-normalized path, this PR addresses this.
Checklist
R CMD check
still passes all tests