On Mon, Nov 17, 2003 at 01:35:09PM +0100, Paul Slootman wrote: > If the rsyncd.conf has a line such as: > > log file = /var/log/rsync/log > > and /var/log/rsync doesn't exist or isn't a directory (or the log file > can't be opened for any other reason), then there's no warning > whatsoever, as rsync forks itself into the background before checking > the config, opening the log file, etc. > > Worse still, it gets a SIGSEGV, and dumps core. Here's a strace from a > fairly recent CVS: > > 15154 umask(022) = 0 > 15154 open("/var/log/rsync/log", O_WRONLY|O_APPEND|O_CREAT|O_LARGEFILE, 0666) = -1 > ENOTDIR (Not a directory) > 15154 umask(0) = 022 > 15154 umask(022) = 0 > 15154 open("/var/log/rsync/log", O_WRONLY|O_APPEND|O_CREAT|O_LARGEFILE, 0666) = -1 > ENOTDIR (Not a directory) > 15154 umask(0) = 022 > 15154 getpid() = 15154 > 15154 time(NULL) = 1069070906 > 15154 --- SIGSEGV (Segmentation fault) @ 0 (0) --- > 15154 +++ killed by SIGSEGV +++ > 15153 --- SIGCHLD (Child exited) @ 0 (0) --- > 15153 waitpid(-1, [WIFSIGNALED(s) && WTERMSIG(s) == SIGSEGV && WCOREDUMP(s)], > WNOHANG) = 15154 > 15153 waitpid(-1, 0xbffff864, WNOHANG) = -1 ECHILD (No child processes) > 15153 sigreturn() = ? (mask now []) > 15153 exit_group(0) = ? > > 1) It's a bother that it first daemonizes itself and then checks the > config etc., giving no feedback whatsoever that it's not running.
True. > 2) core dumps are never good :-( Also true. > Here'a a proposed patch to fallback to syslog if opening the log file > fails: Much better would be to test the status of open() in openlog and if there is an error kick out a message and exit. If log_init() were called just a little earlier in clientserver.c:daemon_main(), specifically before closing stderr then the error message could be sent to stderr. That would be much better, and simpler than assuming syslog is available as a fallback. Perhaps someone more familiar with the daemon code could consider this. -- To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html