Bug
discover_local_files() in src/bin/copia.rs:227 uses path.is_dir() which follows symlinks. A symlink pointing to an ancestor directory creates an infinite traversal loop, consuming unbounded memory.
Reproduction
mkdir -p /tmp/copia-test/a/b
ln -s /tmp/copia-test /tmp/copia-test/a/b/loop
copia sync /tmp/copia-test user@host:/dest
# Hangs forever, OOM
Fix
Skip symlinked directories:
if path.is_dir() && !path.is_symlink() {
dirs.push(path);
}
Or track visited inodes with a HashSet<(u64, u64)> for (dev, ino) pairs.
Bug
discover_local_files()insrc/bin/copia.rs:227usespath.is_dir()which follows symlinks. A symlink pointing to an ancestor directory creates an infinite traversal loop, consuming unbounded memory.Reproduction
mkdir -p /tmp/copia-test/a/b ln -s /tmp/copia-test /tmp/copia-test/a/b/loop copia sync /tmp/copia-test user@host:/dest # Hangs forever, OOMFix
Skip symlinked directories:
Or track visited inodes with a
HashSet<(u64, u64)>for(dev, ino)pairs.