Closed mihem closed 2 weeks ago
Thanks for reporting the issue! This seems to be a Linux problem that I didn't see coming.
TODO:
fs
package to deal with file paths?Hi @mihem
I added Linux to the test suite and there were no problems during checks: https://github.com/DanChaltiel/autoimport/actions/runs/11833281274 This means I unfortunately cannot reproduce this issue.
I switched from base R to fs
for all that pertains to paths, I think this should prevent all double /
problems.
Could you rerun the function and tell me if it fixed it?
Thanks!
Hi @DanChaltiel Thanks for the fast reply. Yeah, I think Linux checks are obligatory for CRAN submission.
I updated autocomplete (also removed the cache to be on the safe side), but the error was the same
Warning in file.rename(new_path[[i()]], old_path[[i()]]) :
cannot rename file '/tmp/RtmpDGriP5/autoimport_temp_target_dir/visualization.R' to 'R//visualization.R', reason 'Invalid cross-device link'
To make this reproducible I created a dummy example: https://github.com/mihem/testAutoimport
I actually found two further bugs then https://github.com/DanChaltiel/autoimport/issues/27 https://github.com/DanChaltiel/autoimport/issues/28
Also when running autoimport
I get:
→ Accepting modification of './R/fun.R'
Warning in file.rename(new_path[[i()]], old_path[[i()]]) :
cannot rename file '/tmp/RtmpRzzNfW/autoimport_temp_target_dir/fun.R' to './R/fun.R', reason 'Invalid cross-device link'
So the problem with the 2 // is not a problem here (don't now why i still have that problem in my real project then). But the problem with renaming remains.
I tried to debug it a little:
tmp <- tempfile(fileext = ".R")
writeLines("Temporary content", tmp)
file.rename(tmp, "./R/fun.R")
fails with the same error
Warning message:
In file.rename(tmp, "./R/fun.R") :
cannot rename file '/tmp/RtmpRzzNfW/file3df64f7683501c.R' to './R/fun.R', reason 'Invalid cross-device link'
While file.copy
or fs::file_move
work fine:
file.copy(tmp, "./R/fun.R", overwrite = TRUE)
fs::file_move(tmp, "./R/fun.R")
@DanChaltiel thanks for this package. I found this super useful and great user experience (e.g. with shiny diff). However, I'll encounter an issue when renaming the file
Describe the bug ater running
autoimport::autoimport
the first message look allright to meI have to make a few choices and so, everything seems to works fine, but then at the end:
So there is a problem with renaming, maybe because there are suddently two forward slashes?