On Fri, 22 Jan 2010, Ali Polatel wrote: > I've noticed a weirdness in rsync. > Let me explain it briefly with an example. > Below is a test script: > > #!/bin/sh > > cat >rsyncd.conf <<EOF > address = localhost > use chroot = no > hosts allow = localhost > [from] > path = /tmp/from > read only = yes > comment = r/o > EOF > > RSYNC_CONNECT_PROG="rsync --address=localhost --config=rsyncd.conf --daemon" \ > rsync -av --address=localhost rsync://localhost/from to > > Looking at the code the daemon should bind to localhost not 0.0.0.0. > But strace shows the opposite: > a...@harikalardiyari> strace -fe bind ./test.sh > ... > [pid 7279] bind(4, {sa_family=AF_INET, sin_port=htons(0), > sin_addr=inet_addr("0.0.0.0")}, 16) = 0 > ... > > Is this a bug or am I misunderstanding something?
>From the code, the bind you're seeing is from sock_exec in options.c, which has the following comment preceding it: /** * Run a program on a local tcp socket, so that we can talk to it's * stdin and stdout. This is used to fake a connection to a daemon * for testing -- not for the normal case of running SSH. * * @return a socket which is attached to a subprocess running * "prog". stdin and stdout are attached. stderr is left attached to * the original stderr **/ int sock_exec(const char *prog) It gets called essentially as: sock_exec(getenv("RSYNC_CONNECT_PROG")) When running the daemon standalone, I see the appropriate behavior. And with various versions of your command, I'm unable to get any reasonable output. (Something with permissions on '.', even though I chmod'ed 777 on the temp dir.) And, I see that bind() occurring before I see the execve() of the RSYNC_CONNECT_PROG (strace -fe trace=bind,process). So, that bind() is unrelated to the daemon itself (I think). Best, Ben -- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html