Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

pkg/15647: fix for botched error handling in net/rsync-2.5.2

0 views
Skip to first unread message

Greg A. Woods

unread,
Feb 17, 2002, 8:12:17 PM2/17/02
to

>Number: 15647
>Category: pkg
>Synopsis: fix for botched error handling in net/rsync-2.5.2
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Feb 17 17:13:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Greg A. Woods
>Release: pkgsrc 2002/01/28
>Organization:
Planix, Inc.; Toronto, Ontario; Canada
>Environment:
System: NetBSD
>Description:

Due to a botch in a kludge for error handling from older rsync
servers, rsync-2.5.2 fails to return a non-zero exit code under
certain conditions. This causes scripts using rsync to fail.

This patch has been submitted to <rs...@samba.org>.

>How-To-Repeat:

$ rsync -v rsync://rsync.netbsd.org/main/ /tmp/foo,v >
@ERROR: Unknown module 'main'
$ echo $?
0
$


after the fix it will work like this:

$ rsync rsync://rsync.netbsd.org/main/ /tmp/foo,v
@ERROR: Unknown module 'main'
rsync: connection unexpectedly closed (42 bytes read so far)
rsync error: error in rsync protocol data stream (code 12) at io.c(140)
ksh: exit code: 12
$ echo $?
12
$


... but correct handling of '#list' commands to older servers
will still work properly with a zero exit code (rsync.netbsd.org
still reports protocol version #21 -- a 2.5.2 server would be #25):

$ rsync rsync://rsync.netbsd.org/
NetBSD
anoncvs
$ echo $?
0
$

>Fix:

apply this change to pkgsrc/net/rsync/Makefile (which also :

Index: Makefile
===================================================================
RCS file: /cvs/master/m-NetBSD/main/pkgsrc/net/rsync/Makefile,v
retrieving revision 1.38
diff -c -r1.38 Makefile
*** Makefile 26 Jan 2002 19:04:49 -0000 1.38
--- Makefile 18 Feb 2002 00:42:48 -0000
***************
*** 1,6 ****
--- 1,7 ----
# $NetBSD: Makefile,v 1.38 2002/01/26 19:04:49 bouyer Exp $

DISTNAME= rsync-2.5.2
+ PKGREVISION= 1
CATEGORIES= net
MASTER_SITES= ftp://rsync.samba.org/pub/rsync/ \
ftp://sunsite.auc.dk/pub/unix/rsync/ \

and then add this patch to pkgsrc/net/rsync/patches:

#ident $NetBSD$

Index: clientserver.c
===================================================================
RCS file: /cvsroot/rsync/clientserver.c,v
retrieving revision 1.84
diff -c -r1.84 clientserver.c
*** clientserver.c 9 Feb 2002 03:30:22 -0000 1.84
--- clientserver.c 18 Feb 2002 00:39:34 -0000
***************
*** 43,48 ****
--- 43,49 ----
extern int remote_version;
extern int am_sender;
extern char *shell_cmd;
+ extern int list_only;
extern int kludge_around_eof;
extern char *bind_address;
extern int default_af_hint;
***************
*** 113,119 ****

/* Old servers may just drop the connection here,
rather than sending a proper EXIT command. Yuck. */
! kludge_around_eof = remote_version < 25;

while (1) {
if (!read_line(fd, line, sizeof(line)-1)) {
--- 114,120 ----

/* Old servers may just drop the connection here,
rather than sending a proper EXIT command. Yuck. */
! kludge_around_eof = list_only && (remote_version < 25);

while (1) {
if (!read_line(fd, line, sizeof(line)-1)) {

and then of course after committing run 'make makepatchsum'! ;-)

>Release-Note:
>Audit-Trail:
>Unformatted:

0 new messages