mirror of
https://github.com/rclone/rclone.git
synced 2026-10-10 06:55:45 -04:00
local: stop --copy-links following symlink loops - fixes #4402
With -L/--copy-links a symlink pointing to one of its parent directories was followed until the OS gave up with "too many levels of symbolic links" 40 levels deep. As every looping symlink multiplies the listing, a small tree with three such symlinks listed millions of entries. When a followed symlink points to a directory, compare it with the directory being listed and each of its parents using os.SameFile and if it matches report an error and skip it, the same way as a circular symlink. A symlink to a sibling directory is still followed. Loops excluded by the directory filters are skipped quietly as before.
This commit is contained in:
500 Internal Server Error
Gitea Version: 1.28.0+dev-477-g8b6ad49a5f