ports/36998: rsync requires -O2 on BSD to avoid segv?

Anders Nordby anders at fix.no
Sun Apr 21 09:36:02 EST 2002


On Sun, Apr 21, 2002 at 08:29:36AM -0700, Martin Pool wrote:
>> # rsync -azv \
>> rsync://sunsite.dk/ftp//mirrors/mysql/Downloads/Contrib/MyAccess.mda .
> Works fine for me using rsync's upstream HEAD and 2.5.5 release.  So
> it seems like it must be either something in BSD's patches, or
> something about your compiler, or possibly something else.
> 
> Could you please try building from upstream source and let me know?

The attached patch works around the bug so that it does not show up in
-stable or -current. It's a workaround for GCC bugs in FreeBSD, made by
bde at FreeBSD.org some weeks ago. Sorry I didn't see this before now.

Rsync folks: For FreeBSD, I think this is the temporary fix for the port
until GCC is fixed. I don't know if you want to include it in any way.
BTW: http://rsync.samba.org/cvs.html (from the download page on
rsync.samba.org) seems to be lost. Luckily, I had what I needed in
~/.cvspass.

Oliver: may I commit this and revert your changes on the issue?

Greg/Kris: MFC of this file in src/lib/libz/infcodes.c may save a lot of
users for some trouble. The bug rsync suffers from in its home-rolled
zlib 1.1.4 is also reproducable in -stable, I don't see why this isn't
going to apply to other programs that uses zlib.

Cheers,

-- 
Anders.
-------------- next part --------------
--- zlib/infcodes.c.orig	Tue Mar 12 02:14:58 2002
+++ zlib/infcodes.c	Sun Apr 21 18:14:34 2002
@@ -197,8 +197,15 @@
       c->mode = COPY;
     case COPY:          /* o: copying bytes in window, waiting for space */
       f = q - c->sub.copy.dist;
-      while (f < s->window)             /* modulo window size-"while" instead */
-        f += s->end - s->window;        /* of "if" handles invalid distances */
+      {
+      /* Work-around for a FreeBSD gcc bug. */
+#ifdef __FreeBSD__
+      volatile inflate_blocks_statef *s1 = s;
+#endif
+
+      while (f < s1->window)            /* modulo window size-"while" instead */
+        f += s1->end - s1->window;      /* of "if" handles invalid distances */
+      }
       while (c->len)
       {
         NEEDOUT


More information about the rsync mailing list