summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-01-21 03:31:14 +0000
committerSam James <sam@gentoo.org>2023-01-21 03:31:32 +0000
commit831dd1209afaf2553baef3264b46b062d76e80b6 (patch)
treee34ebea2e31c542423dc709b99e2c18443b1606a /net-misc/rsync
parentdev-libs/elfutils: handle asan/ubsan (diff)
downloadgentoo-831dd1209afaf2553baef3264b46b062d76e80b6.tar.gz
gentoo-831dd1209afaf2553baef3264b46b062d76e80b6.tar.bz2
gentoo-831dd1209afaf2553baef3264b46b062d76e80b6.zip
net-misc/rsync: handle ubsan
Pass -DCAREFUL_ALIGNMENT if building with -fsanitize=undefined to disable intentional unaligned accesses which UBSAN would otherwise flag. Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'net-misc/rsync')
-rw-r--r--net-misc/rsync/rsync-3.2.7-r2.ebuild10
-rw-r--r--net-misc/rsync/rsync-9999.ebuild14
2 files changed, 22 insertions, 2 deletions
diff --git a/net-misc/rsync/rsync-3.2.7-r2.ebuild b/net-misc/rsync/rsync-3.2.7-r2.ebuild
index fae9369c193c..4dc746f9c96a 100644
--- a/net-misc/rsync/rsync-3.2.7-r2.ebuild
+++ b/net-misc/rsync/rsync-3.2.7-r2.ebuild
@@ -6,7 +6,7 @@ EAPI=8
# Uncomment when introducing a patch which touches configure
#RSYNC_NEEDS_AUTOCONF=1
PYTHON_COMPAT=( python3_{9..11} )
-inherit prefix python-single-r1 systemd
+inherit flag-o-matic prefix python-single-r1 systemd
DESCRIPTION="File transfer program to keep remote files into sync"
HOMEPAGE="https://rsync.samba.org/"
@@ -125,6 +125,14 @@ src_configure() {
$(use_enable zstd)
)
+ # https://github.com/WayneD/rsync/pull/428
+ if is-flagq -fsanitize=undefined ; then
+ sed -E -i \
+ -e 's:#define CAREFUL_ALIGNMENT (0|1):#define CAREFUL_ALIGNMENT 1:' \
+ byteorder.h || die
+ append-flags -DCAREFUL_ALIGNMENT
+ fi
+
econf "${myeconfargs[@]}"
}
diff --git a/net-misc/rsync/rsync-9999.ebuild b/net-misc/rsync/rsync-9999.ebuild
index 4d23490d778c..4dc746f9c96a 100644
--- a/net-misc/rsync/rsync-9999.ebuild
+++ b/net-misc/rsync/rsync-9999.ebuild
@@ -6,7 +6,7 @@ EAPI=8
# Uncomment when introducing a patch which touches configure
#RSYNC_NEEDS_AUTOCONF=1
PYTHON_COMPAT=( python3_{9..11} )
-inherit prefix python-single-r1 systemd
+inherit flag-o-matic prefix python-single-r1 systemd
DESCRIPTION="File transfer program to keep remote files into sync"
HOMEPAGE="https://rsync.samba.org/"
@@ -76,6 +76,10 @@ else
BDEPEND+=" verify-sig? ( sec-keys/openpgp-keys-waynedavison )"
fi
+PATCHES=(
+ "${FILESDIR}"/${P}-flist-memcmp-ub.patch
+)
+
pkg_setup() {
# - USE=examples needs Python itself at runtime, but nothing else
# - 9999 needs commonmark at build time
@@ -121,6 +125,14 @@ src_configure() {
$(use_enable zstd)
)
+ # https://github.com/WayneD/rsync/pull/428
+ if is-flagq -fsanitize=undefined ; then
+ sed -E -i \
+ -e 's:#define CAREFUL_ALIGNMENT (0|1):#define CAREFUL_ALIGNMENT 1:' \
+ byteorder.h || die
+ append-flags -DCAREFUL_ALIGNMENT
+ fi
+
econf "${myeconfargs[@]}"
}