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

file.copy destroy the file if path == new_path in ubuntu 20.04 #400

Open
VincentGuyader opened this issue Dec 6, 2022 · 0 comments
Open
Labels
bug an unexpected problem or unintended behavior

Comments

@VincentGuyader
Copy link

cat("babana",file = "ici.txt")
file.info("ici.txt")
#>         size isdir mode               mtime               ctime
#> ici.txt    6 FALSE  664 2022-12-06 16:44:31 2022-12-06 16:44:31
#>                       atime  uid  gid   uname grname
#> ici.txt 2022-12-06 16:44:31 1001 1001 vincent thinkr
fs::file_copy(
  path = "ici.txt",
  new_path = "ici.txt",
  overwrite = TRUE
)
file.info("ici.txt")
#>         size isdir mode               mtime               ctime
#> ici.txt    0 FALSE  664 2022-12-06 16:44:31 2022-12-06 16:44:31
#>                       atime  uid  gid   uname grname
#> ici.txt 2022-12-06 16:44:31 1001 1001 vincent thinkr

See the file size to 0

Created on 2022-12-06 by the reprex package (v2.0.1)

Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.2.0 (2022-04-22)
#>  os       Ubuntu 20.04.4 LTS
#>  system   x86_64, linux-gnu
#>  ui       X11
#>  language (EN)
#>  collate  en_US.UTF-8
#>  ctype    en_US.UTF-8
#>  tz       Etc/UTC
#>  date     2022-12-06
#>  pandoc   2.17.1.1 @ /usr/lib/rstudio-server/bin/quarto/bin/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version    date (UTC) lib source
#>  cli           3.4.1      2022-09-23 [1] CRAN (R 4.2.0)
#>  crayon        1.5.2      2022-09-29 [1] CRAN (R 4.2.0)
#>  digest        0.6.29     2021-12-01 [2] RSPM (R 4.2.0)
#>  ellipsis      0.3.2      2021-04-29 [2] RSPM (R 4.2.0)
#>  evaluate      0.15       2022-02-18 [2] RSPM (R 4.2.0)
#>  fansi         1.0.3      2022-03-24 [2] RSPM (R 4.2.0)
#>  fastmap       1.1.0      2021-01-25 [2] RSPM (R 4.2.0)
#>  fs            1.5.2.9000 2022-12-06 [1] Github (r-lib/fs@238032f)
#>  glue          1.6.2      2022-02-24 [1] CRAN (R 4.2.0)
#>  highr         0.9        2021-04-16 [2] RSPM (R 4.2.0)
#>  htmltools     0.5.2      2021-08-25 [2] RSPM (R 4.2.0)
#>  knitr         1.39       2022-04-26 [2] RSPM (R 4.2.0)
#>  lifecycle     1.0.3      2022-10-07 [1] CRAN (R 4.2.0)
#>  magrittr      2.0.3      2022-03-30 [1] CRAN (R 4.2.0)
#>  pillar        1.7.0      2022-02-01 [2] RSPM (R 4.2.0)
#>  pkgconfig     2.0.3      2019-09-22 [2] RSPM (R 4.2.0)
#>  purrr         0.3.5      2022-10-06 [1] CRAN (R 4.2.0)
#>  R.cache       0.15.0     2021-04-30 [2] RSPM
#>  R.methodsS3   1.8.2      2022-06-13 [2] RSPM
#>  R.oo          1.25.0     2022-06-12 [2] RSPM
#>  R.utils       2.11.0     2021-09-26 [2] RSPM
#>  reprex        2.0.1      2021-08-05 [2] RSPM (R 4.2.0)
#>  rlang         1.0.6      2022-09-24 [1] CRAN (R 4.2.0)
#>  rmarkdown     2.14       2022-04-25 [2] RSPM (R 4.2.0)
#>  rstudioapi    0.14       2022-08-22 [1] CRAN (R 4.2.0)
#>  sessioninfo   1.2.2      2021-12-06 [2] RSPM (R 4.2.0)
#>  stringi       1.7.6      2021-11-29 [2] RSPM (R 4.2.0)
#>  stringr       1.4.0      2019-02-10 [2] RSPM (R 4.2.0)
#>  styler        1.7.0      2022-03-13 [2] RSPM
#>  tibble        3.1.7      2022-05-03 [2] RSPM (R 4.2.0)
#>  utf8          1.2.2      2021-07-24 [2] RSPM (R 4.2.0)
#>  vctrs         0.4.1      2022-04-13 [2] RSPM (R 4.2.0)
#>  withr         2.5.0      2022-03-03 [1] CRAN (R 4.2.0)
#>  xfun          0.31       2022-05-10 [2] RSPM (R 4.2.0)
#>  yaml          2.3.6      2022-10-18 [1] CRAN (R 4.2.0)
#> 
#>  [1] /home/vincent/R/x86_64-pc-linux-gnu-library/4.2
#>  [2] /usr/local/lib/R/site-library
#>  [3] /usr/local/lib/R/library
#>  [4] /home/rstudio/_libpathcommun_
#> 
#> ──────────────────────────────────────────────────────────────────────────────

everything is OK on windows 10:

cat("babana",file = "ici.txt")
file.info("ici.txt")
#>         size isdir mode               mtime               ctime
#> ici.txt    6 FALSE  666 2022-12-06 17:47:53 2022-12-06 17:47:53
#>                       atime exe
#> ici.txt 2022-12-06 17:47:53  no
fs::file_copy(
  path = "ici.txt",
  new_path = "ici.txt",
  overwrite = TRUE
)
file.info("ici.txt")
#>         size isdir mode               mtime               ctime
#> ici.txt    6 FALSE  666 2022-12-06 17:47:53 2022-12-06 17:47:53
#>                       atime exe
#> ici.txt 2022-12-06 17:47:53  no

Created on 2022-12-06 with reprex v2.0.2

Session info
sessioninfo::session_info()
#> - Session info ---------------------------------------------------------------
#>  setting  value
#>  version  R version 4.1.2 (2021-11-01)
#>  os       Windows 10 x64 (build 19044)
#>  system   x86_64, mingw32
#>  ui       RTerm
#>  language (EN)
#>  collate  French_France.1252
#>  ctype    French_France.1252
#>  tz       Europe/Paris
#>  date     2022-12-06
#>  pandoc   2.19.2 @ C:/Program Files/RStudio/bin/quarto/bin/tools/ (via rmarkdown)
#> 
#> - Packages -------------------------------------------------------------------
#>  package     * version date (UTC) lib source
#>  cli           3.4.1   2022-09-23 [1] CRAN (R 4.1.3)
#>  digest        0.6.29  2021-12-01 [1] CRAN (R 4.1.2)
#>  evaluate      0.18    2022-11-07 [1] CRAN (R 4.1.3)
#>  fansi         1.0.3   2022-03-24 [1] CRAN (R 4.1.3)
#>  fastmap       1.1.0   2021-01-25 [1] CRAN (R 4.1.0)
#>  fs            1.5.2   2021-12-08 [1] CRAN (R 4.1.2)
#>  glue          1.6.2   2022-02-24 [1] CRAN (R 4.1.3)
#>  highr         0.9     2021-04-16 [1] CRAN (R 4.1.0)
#>  htmltools     0.5.3   2022-07-18 [1] CRAN (R 4.1.3)
#>  knitr         1.41    2022-11-18 [1] CRAN (R 4.1.3)
#>  lifecycle     1.0.3   2022-10-07 [1] CRAN (R 4.1.3)
#>  magrittr      2.0.3   2022-03-30 [1] CRAN (R 4.1.3)
#>  pillar        1.8.1   2022-08-19 [1] CRAN (R 4.1.3)
#>  pkgconfig     2.0.3   2019-09-22 [1] CRAN (R 4.1.0)
#>  purrr         0.3.5   2022-10-06 [1] CRAN (R 4.1.3)
#>  R.cache       0.16.0  2022-07-21 [1] CRAN (R 4.1.3)
#>  R.methodsS3   1.8.2   2022-06-13 [1] CRAN (R 4.1.3)
#>  R.oo          1.25.0  2022-06-12 [1] CRAN (R 4.1.3)
#>  R.utils       2.12.2  2022-11-11 [1] CRAN (R 4.1.3)
#>  reprex        2.0.2   2022-08-17 [1] CRAN (R 4.1.3)
#>  rlang         1.0.6   2022-09-24 [1] CRAN (R 4.1.3)
#>  rmarkdown     2.18    2022-11-09 [1] CRAN (R 4.1.3)
#>  rstudioapi    0.14    2022-08-22 [1] CRAN (R 4.1.3)
#>  sessioninfo   1.2.2   2021-12-06 [1] CRAN (R 4.1.2)
#>  stringi       1.7.6   2021-11-29 [1] CRAN (R 4.1.2)
#>  stringr       1.4.1   2022-08-20 [1] CRAN (R 4.1.3)
#>  styler        1.8.1   2022-11-07 [1] CRAN (R 4.1.3)
#>  tibble        3.1.8   2022-07-22 [1] CRAN (R 4.1.3)
#>  utf8          1.2.2   2021-07-24 [1] CRAN (R 4.1.2)
#>  vctrs         0.5.1   2022-11-16 [1] CRAN (R 4.1.3)
#>  withr         2.5.0   2022-03-03 [1] CRAN (R 4.1.3)
#>  xfun          0.35    2022-11-16 [1] CRAN (R 4.1.3)
#>  yaml          2.3.6   2022-10-18 [1] CRAN (R 4.1.3)
#> 
#>  [1] C:/Users/PC/Documents/R/win-library/4.1
#>  [2] C:/Program Files/R/R-4.1.2/library
#> 
#> ------------------------------------------------------------------------------
@gaborcsardi gaborcsardi added the bug an unexpected problem or unintended behavior label Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants