bug: copying unreadable file from remote host returns errorlevel 0

alexm at hsys.msk.ru alexm at hsys.msk.ru
Mon May 27 09:40:02 EST 2002


[ Please keep me in Cc: as I am not subscribed to this list ]

Hello,

we have noticed the following bug in rsync (including latest CVS
snapshot):

if I am copying from the remote host file that is unreadable by my
account, the error is reported properly, but the errorlevel returned
is 0. 

        $ rsync distanza:/etc/shadow .
send_files failed to open /etc/shadow: Permission denied
rsync error: some files could not be transferred (code 23) at main.c(348)

        $ echo $?
0


If I'm trying to copy non-existent file, it returns proper errorlevel

        $ rsync --rsync-path=/usr/local/rsync-cvs/bin/rsync distanza:/etc/shad .
link_stat /etc/shad : No such file or directory
rsync error: some files could not be transferred (code 23) at main.c(337)
client: nothing to do
        $ echo $?
11



We tried to fix it by changing "continue" to "return":

--- sender.c.orig       Mon May 27 20:36:34 2002
+++ sender.c    Mon May 27 20:35:33 2002
@@ -184,7 +184,7 @@
                                rprintf(FERROR,"send_files failed to open %s: %s\n",
                                        fname,strerror(errno));
                                free_sums(s);
-                               continue;
+                               return;
                        }
          
                        /* map the local file */


and the errorlevel is returned properly, but there are additional
messages:

send_files failed to open /etc/shadow: Permission denied
rsync error: some files could not be transferred (code 23) at main.c(348)
Invalid file index 24 in recv_files (count=1)
unexpected EOF in read_timeout

and we're not sure if that's ok.


Thanks a lot for your help,

--alexm




More information about the rsync mailing list