commit:     c678f8607ad259c7c7b53f95b8cb61df2cdcf676
Author:     Andrea Postiglione <andrea.postiglione <AT> gmail <DOT> com>
AuthorDate: Wed Oct 21 09:42:43 2020 +0000
Commit:     Andrea Postiglione <andrea.postiglione <AT> gmail <DOT> com>
CommitDate: Wed Oct 21 09:42:43 2020 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=c678f860

sys-fs/gfs2-utils: version bump to 3.3.0

Signed-off-by: Andrea Postiglione <andrea.postiglione <AT> gmail.com>

 sys-fs/gfs2-utils/files/restoremeta.patch | 59 ++++++++++++++++++++++++++++
 sys-fs/gfs2-utils/gfs2-utils-3.3.0.ebuild | 64 +++++++++++++++++++++++++++++++
 2 files changed, 123 insertions(+)

diff --git a/sys-fs/gfs2-utils/files/restoremeta.patch 
b/sys-fs/gfs2-utils/files/restoremeta.patch
new file mode 100644
index 00000000..ba8f911f
--- /dev/null
+++ b/sys-fs/gfs2-utils/files/restoremeta.patch
@@ -0,0 +1,59 @@
+From eb1020191f7743f451442096db8635643c5fddb1 Mon Sep 17 00:00:00 2001
+From: Andrew Price <[email protected]>
+Date: Sep 05 2020 23:59:02 +0000
+Subject: restoremeta: Fix unaligned access in restore_init()
+
+On sparc64 we get restoremeta tests failing with SIGBUS due to an
+unaligned access when scanning for the super block offset in the
+metadata file. memcpy the buffer into a gfs2_sb struct to avoid that. In
+most cases, if not always, this loop succeeds on the first iteration
+and might not even be needed, so the added overhead is minimal.
+
+diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
+index 80c11c9..32e1f70 100644
+--- a/gfs2/edit/savemeta.c
++++ b/gfs2/edit/savemeta.c
+@@ -1251,7 +1251,7 @@ nobuffer:
+       return NULL;
+ }
+ 
+-static int restore_super(struct metafd *mfd, char *buf, int printonly)
++static int restore_super(struct metafd *mfd, void *buf, int printonly)
+ {
+       int ret;
+ 
+@@ -1337,7 +1337,7 @@ static void complain(const char *complaint)
+ 
+ static int restore_init(const char *path, struct metafd *mfd, struct 
savemeta_header *smh, int printonly)
+ {
+-      struct gfs2_meta_header *sbmh;
++      struct gfs2_sb rsb;
+       uint16_t sb_siglen;
+       char *end;
+       char *bp;
+@@ -1372,12 +1372,12 @@ static int restore_init(const char *path, struct 
metafd *mfd, struct savemeta_he
+               return -1;
+       }
+       /* Scan for the position of the superblock. Required to support old 
formats(?). */
+-      end = &restore_buf[256 + sizeof(struct saved_metablock) + 
sizeof(*sbmh)];
++      end = &restore_buf[256 + sizeof(struct saved_metablock) + sizeof(struct 
gfs2_meta_header)];
+       while (bp <= end) {
++              memcpy(&rsb, bp + sizeof(struct saved_metablock), sizeof(rsb));
+               sb_siglen = be16_to_cpu(((struct saved_metablock *)bp)->siglen);
+-              sbmh = (struct gfs2_meta_header *)(bp + sizeof(struct 
saved_metablock));
+-              if (sbmh->mh_magic == cpu_to_be32(GFS2_MAGIC) &&
+-                  sbmh->mh_type == cpu_to_be32(GFS2_METATYPE_SB))
++              if (be32_to_cpu(rsb.sb_header.mh_magic) == GFS2_MAGIC &&
++                  be32_to_cpu(rsb.sb_header.mh_type) == GFS2_METATYPE_SB)
+                       break;
+               bp++;
+       }
+@@ -1386,7 +1386,7 @@ static int restore_init(const char *path, struct metafd 
*mfd, struct savemeta_he
+               return -1;
+       }
+       bp += sizeof(struct saved_metablock);
+-      ret = restore_super(mfd, bp, printonly);
++      ret = restore_super(mfd, &rsb, printonly);
+       if (ret != 0)
+               return ret;
+ 

diff --git a/sys-fs/gfs2-utils/gfs2-utils-3.3.0.ebuild 
b/sys-fs/gfs2-utils/gfs2-utils-3.3.0.ebuild
new file mode 100644
index 00000000..aa244cb1
--- /dev/null
+++ b/sys-fs/gfs2-utils/gfs2-utils-3.3.0.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools toolchain-funcs linux-info
+
+DESCRIPTION="Shared-disk cluster file system"
+HOMEPAGE="https://pagure.io/gfs2-utils";
+SRC_URI="https://pagure.io/gfs2-utils/archive/${PV}/${P}.tar.gz";
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+IUSE="nls test"
+
+
+BDEPEND="sys-devel/autoconf
+               sys-devel/automake
+               sys-devel/libtool
+               sys-devel/make
+"
+RDEPEND="sys-libs/zlib
+               app-arch/bzip2
+               sys-libs/ncurses
+               sys-apps/util-linux
+"
+
+DEPEND="${RDEPEND}
+               sys-devel/gettext
+               sys-devel/bison
+               sys-devel/flex
+               test? ( dev-libs/check )
+               sys-kernel/linux-headers
+"
+
+src_prepare() {
+       eapply "${FILESDIR}"/reproducible.patch
+       eapply "${FILESDIR}"/gfs2_withdraw_helper.patch
+       eapply "${FILESDIR}"/python3.patch
+       eapply "${FILESDIR}"/restoremeta.patch
+       default
+       ./autogen.sh
+       eautoreconf
+}
+
+src_configure() {
+                       local econf_args
+                               econf_args=(
+                               bzip2_LIBS="-L/$(get_libdir) -lbz2"
+                               bzip2_CFLAGS="-I${prefix}/include"
+                               )
+                       ECONF_SOURCE="${S}" econf "${econf_args[@]}"
+
+}
+
+src_compile() {
+       emake
+}
+
+src_install() {
+       emake DESTDIR="${D}" install
+}

Reply via email to