commit:     1cb1b9ca5d372c83314d9f7b02c80eb7c10cc0bc
Author:     Wenkai Du <wenkai.du <AT> intel <DOT> com>
AuthorDate: Thu Jan  4 07:13:02 2018 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Jan  4 07:13:27 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1cb1b9ca

sys-apps/lshw: add upstream fix for crashes w/Intel SGX

 sys-apps/lshw/files/lshw-02.18b-sgx.patch | 32 ++++++++++++++
 sys-apps/lshw/lshw-02.18b-r1.ebuild       | 73 +++++++++++++++++++++++++++++++
 2 files changed, 105 insertions(+)

diff --git a/sys-apps/lshw/files/lshw-02.18b-sgx.patch 
b/sys-apps/lshw/files/lshw-02.18b-sgx.patch
new file mode 100644
index 00000000000..92bd6c23e2f
--- /dev/null
+++ b/sys-apps/lshw/files/lshw-02.18b-sgx.patch
@@ -0,0 +1,32 @@
+patch from upstream:
+https://ezix.org/src/pkg/lshw/commit/5e5744732b2dcdf83845919256388b3842033183
+
+From 5e5744732b2dcdf83845919256388b3842033183 Mon Sep 17 00:00:00 2001
+From: Wenkai Du <[email protected]>
+Date: Fri, 22 Dec 2017 09:57:57 -0800
+Subject: [PATCH] lshw: fix segmentation fault when /dev/sgx is present
+
+When Intel SGX is enabled in kernel, /dev/sgx is created and is
+picked up by "/dev/sg*" glob matching.
+
+Signed-off-by: Wenkai Du <[email protected]>
+---
+ src/core/scsi.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/core/scsi.cc b/src/core/scsi.cc
+index b38dda2cd8a8..75061c0fb195 100644
+--- a/src/core/scsi.cc
++++ b/src/core/scsi.cc
+@@ -30,7 +30,7 @@
+ 
+ __ID("@(#) $Id$");
+ 
+-#define SG_X "/dev/sg*"
++#define SG_X "/dev/sg[0-9]*"
+ #define SG_MAJOR 21
+ 
+ #ifndef SCSI_IOCTL_GET_PCI
+-- 
+2.15.1
+

diff --git a/sys-apps/lshw/lshw-02.18b-r1.ebuild 
b/sys-apps/lshw/lshw-02.18b-r1.ebuild
new file mode 100644
index 00000000000..c22eab42757
--- /dev/null
+++ b/sys-apps/lshw/lshw-02.18b-r1.ebuild
@@ -0,0 +1,73 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+PLOCALES='fr'
+
+inherit flag-o-matic eutils toolchain-funcs l10n
+
+MAJ_PV=${PV:0:${#PV}-1}
+MIN_PVE=${PV:0-1}
+MIN_PV=${MIN_PVE/b/B}
+
+MY_P="$PN-$MIN_PV.$MAJ_PV"
+DESCRIPTION="Hardware Lister"
+HOMEPAGE="https://www.ezix.org/project/wiki/HardwareLiSter";
+SRC_URI="https://www.ezix.org/software/files/${MY_P}.tar.gz";
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux 
~arm-linux ~x86-linux"
+IUSE="gtk sqlite static"
+
+REQUIRED_USE="static? ( !gtk )"
+
+RDEPEND="gtk? ( x11-libs/gtk+:2 )
+       sqlite? ( dev-db/sqlite:3 )"
+DEPEND="${RDEPEND}
+       gtk? ( virtual/pkgconfig )
+       sqlite? ( virtual/pkgconfig )"
+RDEPEND="${RDEPEND}
+       sys-apps/hwids"
+
+S=${WORKDIR}/${MY_P}
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-02.18b-gentoo.patch
+       "${FILESDIR}"/${PN}-02.18b-gettext-array.patch
+       "${FILESDIR}"/${PN}-02.18b-sgx.patch
+)
+
+src_prepare() {
+       epatch "${PATCHES[@]}"
+
+       l10n_find_plocales_changes "src/po" "" ".po" || die
+       sed -i \
+               -e "/^LANGUAGES =/ s/=.*/= $(l10n_get_locales)/" \
+               src/po/Makefile || die
+       sed -i \
+               -e 's:\<pkg-config\>:${PKG_CONFIG}:' \
+               src/Makefile src/gui/Makefile || die
+}
+
+src_compile() {
+       tc-export CC CXX AR PKG_CONFIG
+       use static && append-ldflags -static
+
+       # Need two sep make statements to avoid parallel build issues. #588174
+       local sqlite=$(usex sqlite 1 0)
+       emake SQLITE=${sqlite} all
+       use gtk && emake SQLITE=${sqlite} gui
+}
+
+src_install() {
+       emake DESTDIR="${D}" PREFIX="${EPREFIX}/usr" install $(usex gtk 
'install-gui' '')
+       dodoc README.md docs/*
+       if use gtk ; then
+               newicon -s scalable src/gui/artwork/logo.svg gtk-lshw.svg
+               make_desktop_entry \
+                       "${EPREFIX}"/usr/sbin/gtk-lshw \
+                       "${DESCRIPTION}"
+       fi
+}

Reply via email to