Rsync reports the status code of the remote command. So in some situations the status code is successful when the command fails. Rsync of a remote file to a local read-only directory fails, but exits with $status = 0. I'd like to get $status = 23. Is it possible? Local copy fails with status = 23> mkdir /tmp/nowrite > chmod -w /tmp/nowrite > rsync /etc/group /tmp/nowrite || echo $statusmkstemp .group.cUaaeY failed rsync error: partial transfer (code 23) at main.c(518) 23 Remote to local copy fails with status=0> rsync -e ssh loki:/etc/group /tmp/nowrite || echo $statusmkstemp .group.1rayeY failed> rsync -e ssh loki:/etc/group /tmp/nowrite && echo $statusmkstemp .group.fbaGiY failed 0 Local to remote copy fails with status = 23> ssh loki mkdir /tmp/nowrite > ssh loki chmod -w !$ssh loki chmod -w /tmp/nowrite> rsync -e ssh /etc/group loki:/tmp/nowrite || echo $statusmkstemp .group.EGai3c failed rsync error: partial transfer (code 23) at main.c(518) 23
I investigated this and found it came down to the revision 1.129 in the rsync CVS at http://cvs.samba.org/cgi-bin/cvsweb/rsync/main.c Here's a patch to undo it: --- main.c.O Fri Feb 22 18:24:38 2002 +++ main.c Thu Feb 28 13:03:29 2002 @@ -797,7 +797,7 @@ } static RETSIGTYPE sigchld_handler(int UNUSED(val)) { -#ifdef WNOHANG +#ifdef 0 /* was WNOHANG */ while (waitpid(-1, NULL, WNOHANG) > 0) ; #endif } The trouble is, that change was put in 7 months ago by rsync's author Andrew Tridgell and I don't know why he did it or what else will break by taking it back out. - Dave Dykstra On Wed, Feb 27, 2002 at 05:53:22PM -0500, Todd Vander Does wrote:> > Rsync reports the status code of the remote command. So in some > situations the status code is successful when the command fails. > Rsync of a remote file to a local read-only directory fails, but > exits with $status = 0. I'd like to get $status = 23. Is it > possible? > > Local copy fails with status = 23 > > mkdir /tmp/nowrite > > chmod -w /tmp/nowrite > > rsync /etc/group /tmp/nowrite || echo $status > mkstemp .group.cUaaeY failed > rsync error: partial transfer (code 23) at main.c(518) > 23 > > Remote to local copy fails with status=0 > > rsync -e ssh loki:/etc/group /tmp/nowrite || echo $status > mkstemp .group.1rayeY failed > > rsync -e ssh loki:/etc/group /tmp/nowrite && echo $status > mkstemp .group.fbaGiY failed > 0 > > Local to remote copy fails with status = 23 > > ssh loki mkdir /tmp/nowrite > > ssh loki chmod -w !$ > ssh loki chmod -w /tmp/nowrite > > rsync -e ssh /etc/group loki:/tmp/nowrite || echo $status > mkstemp .group.EGai3c failed > rsync error: partial transfer (code 23) at main.c(518) > 23 > > > > > -- > To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync > Before posting, read: http://www.tuxedo.org/~esr/faqs/smart-questions.html
The modification Dave suggested continues to work. Can it be added to the release code? (Dave cautioned that he didn't know why the code had been made active.) Todd static RETSIGTYPE sigchld_handler(int val) { //#ifdef WNOHANG //while (waitpid(-1, NULL, WNOHANG) > 0) ; //#endif } On Thu, 28 Feb 2002, Dave Dykstra wrote:> I investigated this and found it came down to the revision 1.129 in the > rsync CVS at > http://cvs.samba.org/cgi-bin/cvsweb/rsync/main.c > > Here's a patch to undo it: > > --- main.c.O Fri Feb 22 18:24:38 2002 > +++ main.c Thu Feb 28 13:03:29 2002 > @@ -797,7 +797,7 @@ > } > > static RETSIGTYPE sigchld_handler(int UNUSED(val)) { > -#ifdef WNOHANG > +#ifdef 0 /* was WNOHANG */ > while (waitpid(-1, NULL, WNOHANG) > 0) ; > #endif > } > > > The trouble is, that change was put in 7 months ago by rsync's author > Andrew Tridgell and I don't know why he did it or what else will break > by taking it back out. > > - Dave Dykstra > > > On Wed, Feb 27, 2002 at 05:53:22PM -0500, Todd Vander Does wrote: > > > > Rsync reports the status code of the remote command. So in some > > situations the status code is successful when the command fails. > > Rsync of a remote file to a local read-only directory fails, but > > exits with $status = 0. I'd like to get $status = 23. Is it > > possible? > > > > Local copy fails with status = 23 > > > mkdir /tmp/nowrite > > > chmod -w /tmp/nowrite > > > rsync /etc/group /tmp/nowrite || echo $status > > mkstemp .group.cUaaeY failed > > rsync error: partial transfer (code 23) at main.c(518) > > 23 > > > > Remote to local copy fails with status=0 > > > rsync -e ssh loki:/etc/group /tmp/nowrite || echo $status > > mkstemp .group.1rayeY failed > > > rsync -e ssh loki:/etc/group /tmp/nowrite && echo $status > > mkstemp .group.fbaGiY failed > > 0 > > > > Local to remote copy fails with status = 23 > > > ssh loki mkdir /tmp/nowrite > > > ssh loki chmod -w !$ > > ssh loki chmod -w /tmp/nowrite > > > rsync -e ssh /etc/group loki:/tmp/nowrite || echo $status > > mkstemp .group.EGai3c failed > > rsync error: partial transfer (code 23) at main.c(518) > > 23 > > > > > > > > > > -- > > To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync > > Before posting, read: http://www.tuxedo.org/~esr/faqs/smart-questions.html > > -- > To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync > Before posting, read: http://www.tuxedo.org/~esr/faqs/smart-questions.html >