fs
fs copied to clipboard
dir_exists hangs up with a broken autoloop symlink
while base::dir.exists() returns FALSE quickly:
fs::link_create("autoloop", "autoloop")
base::file.exists("autoloop")
#> [1] FALSE
base::dir.exists("autoloop")
#> [1] FALSE
fs::file_exists("autoloop")
#> autoloop
#> FALSE
fs::link_exists("autoloop")
#> autoloop
#> TRUE
fs::dir_exists("autoloop")
^C
This boils down to
file_info("autoloop", follow = TRUE)
This is what the standard Unix tools do and we could do the same.
❯ realpath autoloop
realpath: autoloop: Too many levels of symbolic links
IDK how many is too many, though.
Based on https://man7.org/linux/man-pages/man7/path_resolution.7.html the limit is 40 for modern Linux kernels.