commit: 831dd1209afaf2553baef3264b46b062d76e80b6 Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Sat Jan 21 03:31:14 2023 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Sat Jan 21 03:31:32 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=831dd120
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 <AT> gentoo.org> net-misc/rsync/rsync-3.2.7-r2.ebuild | 10 +++++++++- net-misc/rsync/rsync-9999.ebuild | 14 +++++++++++++- 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[@]}" }