Directory traversal problem.
Morten Welinder
terra at gnome.org
Mon Apr 19 17:23:37 GMT 2004
~> mkdir -p X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X
~> rsync-2.5.6 -r X localhost:$PWD/X2
opendir(X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X/X): Too many open files
rsync error: some files could not be transferred (code 23) at main.c(620)
~> uname -sr
SunOS 5.9
~> ulimit -n
64
There are two problems here:
1. When walking the directory structure, rsync keeps all directories above
open. When the current process' max number of files is reached, the
party is over.
Suggestion: wrap opendir and have it read the entire directory at once.
2. The directory is being walked without ckdir-ing into subdirectories.
That's a severe performance penalty for deep directories.
Alternatively, at least on Solaris, use fstatat(2) for stat-ing the
files.
Morten
More information about the rsync
mailing list