I found on one sparc64 box that reposync stopped working and it turned
out that rsync on sparc64 is busted due to xxhash not dealing correctly
with unaligned access.

Program terminated with signal SIGBUS, Bus error.
#0  XXH_read64 (ptr=0xfffffe7ed9467bbe) at /usr/local/include/xxhash.h:2996

xxhash.h claims XXH_FORCE_MEMORY_ACCESS=0 to be the default, but that
doesn't seem to be true (anymore?). I haven't tried to find out why.

rsync built with the diff below that forces the use of memcpy() to
avoid unaligned access seems to work fine and xxhash passes regress on
sparc64 (after removing -Wvla from ${WRKSRC}/Makefile).

Maybe we only want to set this conditionally on the architectures that
need this for performance reasons. I also haven't looked into what
consumes xxhash.h.

I'd appreciate if you could take it from here.

Index: net/rsync/Makefile
===================================================================
RCS file: /cvs/ports/net/rsync/Makefile,v
retrieving revision 1.98
diff -u -p -r1.98 Makefile
--- net/rsync/Makefile  6 Jun 2023 14:12:07 -0000       1.98
+++ net/rsync/Makefile  16 Aug 2023 18:09:59 -0000
@@ -1,7 +1,7 @@
 COMMENT =      mirroring/synchronization over low bandwidth links
 
 DISTNAME =     rsync-3.2.7
-REVISION =     0
+REVISION =     1
 CATEGORIES =   net
 HOMEPAGE =     https://rsync.samba.org/
 
@@ -34,7 +34,7 @@ CONFIGURE_ARGS =--disable-lz4 \
                --with-rsh=/usr/bin/ssh \
                --with-nobody-user=_rsync \
                --with-nobody-group=_rsync
-CONFIGURE_ENV +=CPPFLAGS="-I${LOCALBASE}/include -DXXH_INLINE_ALL=1" \
+CONFIGURE_ENV +=CPPFLAGS="-I${LOCALBASE}/include -DXXH_INLINE_ALL=1 
-DXXH_FORCE_MEMORY_ACCESS=0" \
                ac_cv_search_XXH64_createState=""
 
 .include <bsd.port.arch.mk>
Index: sysutils/xxhash/Makefile
===================================================================
RCS file: /cvs/ports/sysutils/xxhash/Makefile,v
retrieving revision 1.13
diff -u -p -r1.13 Makefile
--- sysutils/xxhash/Makefile    23 Jul 2023 04:29:44 -0000      1.13
+++ sysutils/xxhash/Makefile    16 Aug 2023 17:54:36 -0000
@@ -4,6 +4,7 @@ GH_ACCOUNT =    Cyan4973
 GH_PROJECT =   xxHash
 GH_TAGNAME =   v0.8.2
 PKGNAME =      ${DISTNAME:L}
+REVISION =     0
 
 SHARED_LIBS =  xxhash 0.3      # 0.8.1
 
@@ -23,6 +24,7 @@ MAKE_FLAGS =  CC="${CC}" \
                SHARED_EXT_VER="so.${LIBxxhash_VERSION}" \
                V=1
 FAKE_FLAGS =   PREFIX=${PREFIX}
+CFLAGS +=      -DXXH_FORCE_MEMORY_ACCESS=0
 
 USE_GMAKE =    Yes

Reply via email to