[Bug 9882] New: Incorrect exit code when sender over SSH is killed with SIGTERM
<samba-bugs <at> samba.org>
2013-05-14 08:57:55 GMT
https://bugzilla.samba.org/show_bug.cgi?id=9882
Summary: Incorrect exit code when sender over SSH is killed
with SIGTERM
Product: rsync
Version: 3.1.0
Platform: All
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P5
Component: core
AssignedTo: wayned <at> samba.org
ReportedBy: famzah <at> famzah.net
QAContact: rsync-qa <at> samba.org
For the tests I've compiled "rsync" from the latest GIT repository sources.
This happens only when SRC is an SSH remote location. Example:
famzah <at> vbox:~$ rsync famzah <at> 127.0.0.1:/boot/initrd.img-3.2.0-36-generic-pae
/tmp/test ; echo "Exit code: $?"
rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(610)
[sender=3.1.0dev]
Exit code: 0
Here is how the process list looks like:
famzah <at> vbox:~$ ps xfww -o pid,user,tty,command
PID USER TT COMMAND
5076 famzah ? sshd: famzah <at> notty
5077 famzah ? \_ rsync --server --sender -e.Lsf .
/boot/initrd.img-3.2.0-36-generic-pae
...
2996 famzah pts/1 \_ /bin/bash
4960 famzah pts/1 | \_ rsync
famzah <at> 127.0.0.1:/boot/initrd.img-3.2.0-36-generic-pae /tmp/test
4961 famzah pts/1 | \_ ssh -l famzah 127.0.0.1 rsync --server
--sender -e.Lsf . /boot/initrd.img-3.2.
5078 famzah pts/1 | \_ rsync
famzah <at> 127.0.0.1:/boot/initrd.img-3.2.0-36-generic-pae /tmp/test
I have killed the "rsync" sender process at the _remote_ location with SIGTERM
(PID=5077 in the example above).
Rsync properly indicates that the problem occurred in [sender=3.1.0dev] and
also displays that exit code should be 20. But in the end, the rsync process
terminates with exit code 0 which is incorrect (Success).
While trying this a few times, I noticed that sometimes "rsync" terminates with
a proper exit code if the error occurs in the local "receiver" or "generator"
processes. I get "error in rsync protocol data stream (code 12) at io.c" then
and the final exit code of "rsync" is 12, as expected.
I also tried all other combinations:
* sync between local SRC and local DST
* sync between local SRC and remote DST over SSH
* killing any of the "rsync" processes (receiver, generator, sender, or SSH
tunnel)
The only problem I got with the incorrect final exit code is when I transfer
with remote SRC over SSH and local DST, as demonstrated. Furthermore, the
"sender" needs to be killed with SIGTERM, which seems to be propagated back to
the "receiver" process by the rsync protocol. Killing the "sender" with SIGKILL
causes immediate termination and therefore an rsync protocol error at the side
of the "receiver", which exits properly with a non-zero exit code.
--
Configure bugmail: https://bugzilla.samba.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
--
--
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