summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2020-03-20 08:05:51 +0000
committerSergei Trofimovich <slyfox@gentoo.org>2020-03-20 08:06:02 +0000
commitd3d153b6dd2be45da02ae2d547894c0849b6a6bf (patch)
treea908b6d22c20bcbf74aac6751766493182b9033d /dev-util/ltrace
parentprofiles/musl: mask app-emulation/firecracker (diff)
downloadgentoo-d3d153b6dd2be45da02ae2d547894c0849b6a6bf.tar.gz
gentoo-d3d153b6dd2be45da02ae2d547894c0849b6a6bf.tar.bz2
gentoo-d3d153b6dd2be45da02ae2d547894c0849b6a6bf.zip
dev-util/ltrace: tweak for musl, bug #713428
Reported-by: Toralf Förster Closes: https://bugs.gentoo.org/713428 Package-Manager: Portage-2.3.94, Repoman-2.3.21 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Diffstat (limited to 'dev-util/ltrace')
-rw-r--r--dev-util/ltrace/files/ltrace-0.7.3-musl-host.patch11
-rw-r--r--dev-util/ltrace/files/ltrace-0.7.3-no-REG_NOERROR.patch50
-rw-r--r--dev-util/ltrace/files/ltrace-0.7.3-no-error.h-2.patch72
-rw-r--r--dev-util/ltrace/files/ltrace-0.7.3-no-error.h.patch36
-rw-r--r--dev-util/ltrace/files/ltrace-0.7.3-pid_t.patch10
-rw-r--r--dev-util/ltrace/ltrace-0.7.3_p4-r1.ebuild66
6 files changed, 245 insertions, 0 deletions
diff --git a/dev-util/ltrace/files/ltrace-0.7.3-musl-host.patch b/dev-util/ltrace/files/ltrace-0.7.3-musl-host.patch
new file mode 100644
index 000000000000..7729449d0604
--- /dev/null
+++ b/dev-util/ltrace/files/ltrace-0.7.3-musl-host.patch
@@ -0,0 +1,11 @@
+https://bugs.gentoo.org/713428
+--- a/configure.ac
++++ b/configure.ac
+@@ -33,6 +33,7 @@ AC_CANONICAL_HOST
+
+ case "${host_os}" in
+ linux-gnu*) HOST_OS="linux-gnu" ;;
++ linux-musl*) HOST_OS="linux-gnu" ;;
+ linux-uclibc*) HOST_OS="linux-gnu" ;;
+ *) AC_MSG_ERROR([unkown host-os ${host_os}]) ;;
+ esac
diff --git a/dev-util/ltrace/files/ltrace-0.7.3-no-REG_NOERROR.patch b/dev-util/ltrace/files/ltrace-0.7.3-no-REG_NOERROR.patch
new file mode 100644
index 000000000000..7fc8b60aa48a
--- /dev/null
+++ b/dev-util/ltrace/files/ltrace-0.7.3-no-REG_NOERROR.patch
@@ -0,0 +1,50 @@
+From b6c5c8c51f954cfbe76424fd57c33a87166f0545 Mon Sep 17 00:00:00 2001
+From: Petr Machata <pmachata@redhat.com>
+Date: Sat, 8 Dec 2012 03:23:39 +0100
+Subject: [PATCH] Avoid using REG_NOERROR
+
+Not all systems define this (IRIX 6.5 doesn't). Comparing to 0 is not
+terribly less readable, so do that instead.
+---
+ glob.c | 4 ++--
+ options.c | 2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/glob.c b/glob.c
+index 9af633f..b26637f 100644
+--- a/glob.c
++++ b/glob.c
+@@ -180,7 +180,7 @@ glob_to_regex(const char *glob, char **retp)
+ goto fail;
+ }
+ *retp = buf;
+- return REG_NOERROR;
++ return 0;
+ }
+
+ int
+@@ -188,7 +188,7 @@ globcomp(regex_t *preg, const char *glob, int cflags)
+ {
+ char *regex = NULL;
+ int status = glob_to_regex(glob, &regex);
+- if (status != REG_NOERROR)
++ if (status != 0)
+ return status;
+ assert(regex != NULL);
+ status = regcomp(preg, regex, cflags);
+diff --git a/options.c b/options.c
+index e8fd2a2..4c7441e 100644
+--- a/options.c
++++ b/options.c
+@@ -204,7 +204,7 @@ compile_libname(const char *expr, const char *a_lib, int lib_re_p,
+
+ regex_t lib_re;
+ int status = (lib_re_p ? regcomp : globcomp)(&lib_re, lib, 0);
+- if (status != REG_NOERROR) {
++ if (status != 0) {
+ char buf[100];
+ regerror(status, &lib_re, buf, sizeof buf);
+ fprintf(stderr, "Rule near '%s' will be ignored: %s.\n",
+--
+2.25.2
+
diff --git a/dev-util/ltrace/files/ltrace-0.7.3-no-error.h-2.patch b/dev-util/ltrace/files/ltrace-0.7.3-no-error.h-2.patch
new file mode 100644
index 000000000000..6b798b274909
--- /dev/null
+++ b/dev-util/ltrace/files/ltrace-0.7.3-no-error.h-2.patch
@@ -0,0 +1,72 @@
+From 1233b37167097dffa9a78bd7bd0a8117c75fe8ff Mon Sep 17 00:00:00 2001
+From: Petr Machata <pmachata@redhat.com>
+Date: Sat, 8 Dec 2012 03:13:29 +0100
+Subject: [PATCH] expr_node_zero and expr_self should be stack-allocated
+
+---
+ expr.c | 14 ++++++--------
+ zero.c | 14 ++++++--------
+ 2 files changed, 12 insertions(+), 16 deletions(-)
+
+--- a/expr.c
++++ b/expr.c
+@@ -21,7 +21,6 @@
+ #include <string.h>
+ #include <assert.h>
+ #include <errno.h>
+-#include <error.h>
+ #include <stdlib.h>
+
+ #include "expr.h"
+@@ -327,12 +326,11 @@ expr_eval_constant(struct expr_node *node, long *valuep)
+ struct expr_node *
+ expr_self(void)
+ {
+- static struct expr_node *node = NULL;
+- if (node == NULL) {
+- node = malloc(sizeof(*node));
+- if (node == NULL)
+- error(1, errno, "malloc expr_self");
+- expr_init_self(node);
++ static struct expr_node *nodep = NULL;
++ if (nodep == NULL) {
++ static struct expr_node node;
++ expr_init_self(&node);
++ nodep = &node;
+ }
+- return node;
++ return nodep;
+ }
+--- a/zero.c
++++ b/zero.c
+@@ -18,7 +18,6 @@
+ * 02110-1301 USA
+ */
+
+-#include <error.h>
+ #include <errno.h>
+
+ #include "zero.h"
+@@ -93,13 +92,12 @@ build_zero_w_arg(struct expr_node *expr, int own)
+ struct expr_node *
+ expr_node_zero(void)
+ {
+- static struct expr_node *node = NULL;
+- if (node == NULL) {
+- node = malloc(sizeof(*node));
+- if (node == NULL)
+- error(1, errno, "malloc expr_node_zero");
+- expr_init_cb1(node, &zero1_callback,
++ static struct expr_node *nodep = NULL;
++ if (nodep == NULL) {
++ static struct expr_node node;
++ expr_init_cb1(&node, &zero1_callback,
+ expr_self(), 0, (void *)-1);
++ nodep = &node;
+ }
+- return node;
++ return nodep;
+ }
+--
+2.25.2
+
diff --git a/dev-util/ltrace/files/ltrace-0.7.3-no-error.h.patch b/dev-util/ltrace/files/ltrace-0.7.3-no-error.h.patch
new file mode 100644
index 000000000000..56aea7a54d4d
--- /dev/null
+++ b/dev-util/ltrace/files/ltrace-0.7.3-no-error.h.patch
@@ -0,0 +1,36 @@
+From 86a7b48310e0fd551f7f3d88ea9ad39c1a2807c6 Mon Sep 17 00:00:00 2001
+From: Petr Machata <pmachata@redhat.com>
+Date: Sat, 8 Dec 2012 03:33:47 +0100
+Subject: [PATCH] Avoid using non-portable error.h in generic code
+
+---
+ read_config_file.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+--- a/read_config_file.c
++++ b/read_config_file.c
+@@ -27,7 +27,6 @@
+ #include <stdlib.h>
+ #include <ctype.h>
+ #include <errno.h>
+-#include <error.h>
+ #include <assert.h>
+
+ #include "common.h"
+@@ -1258,8 +1257,11 @@ void
+ init_global_config(void)
+ {
+ struct arg_type_info *info = malloc(2 * sizeof(*info));
+- if (info == NULL)
+- error(1, errno, "malloc in init_global_config");
++ if (info == NULL) {
++ fprintf(stderr, "Couldn't init global config: %s\n",
++ strerror(errno));
++ exit(1);
++ }
+
+ memset(info, 0, 2 * sizeof(*info));
+ info[0].type = ARGTYPE_POINTER;
+--
+2.25.2
+
diff --git a/dev-util/ltrace/files/ltrace-0.7.3-pid_t.patch b/dev-util/ltrace/files/ltrace-0.7.3-pid_t.patch
new file mode 100644
index 000000000000..b54a5bf3a00c
--- /dev/null
+++ b/dev-util/ltrace/files/ltrace-0.7.3-pid_t.patch
@@ -0,0 +1,10 @@
+--- a/proc.h
++++ b/proc.h
+@@ -26,6 +26,7 @@
+ #include "config.h"
+
+ #include <sys/time.h>
++#include <unistd.h> /* pid_t */
+
+ #if defined(HAVE_LIBUNWIND)
+ # include <libunwind.h>
diff --git a/dev-util/ltrace/ltrace-0.7.3_p4-r1.ebuild b/dev-util/ltrace/ltrace-0.7.3_p4-r1.ebuild
new file mode 100644
index 000000000000..8ca6b5a1233e
--- /dev/null
+++ b/dev-util/ltrace/ltrace-0.7.3_p4-r1.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+inherit autotools
+
+LTRACE_V=${PV/_p*/}
+DB_V=${PV/*_p/}
+
+DESCRIPTION="trace library calls made at runtime"
+HOMEPAGE="https://gitlab.com/cespedes/ltrace"
+SRC_URI="
+ mirror://debian/pool/main/l/${PN}/${PN}_${LTRACE_V}.orig.tar.bz2
+ mirror://debian/pool/main/l/${PN}/${PN}_${LTRACE_V}-${DB_V}.debian.tar.gz
+"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
+IUSE="debug selinux test unwind"
+
+RDEPEND="virtual/libelf:=
+ selinux? ( sys-libs/libselinux )
+ unwind? ( sys-libs/libunwind:= )"
+DEPEND="${RDEPEND}
+ sys-libs/binutils-libs
+ test? ( dev-util/dejagnu )"
+
+# under musl tests need major work upstream, half of them does not work.
+RESTRICT="
+ !test? ( test )
+ elibc_musl? ( test )
+"
+
+S=${WORKDIR}/${PN}-${LTRACE_V}
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-0.7.3-test-protos.patch #bug 421649
+ "${FILESDIR}"/${PN}-0.7.3-alpha-protos.patch
+ "${FILESDIR}"/${PN}-0.7.3-ia64.patch
+ "${FILESDIR}"/${PN}-0.7.3-print-test-pie.patch
+ "${FILESDIR}"/${PN}-0.7.3-ia64-pid_t.patch
+ "${FILESDIR}"/${PN}-0.7.3-musl-host.patch #713428
+ "${FILESDIR}"/${PN}-0.7.3-no-error.h.patch #713428
+ "${FILESDIR}"/${PN}-0.7.3-no-error.h-2.patch #713428
+ "${FILESDIR}"/${PN}-0.7.3-no-REG_NOERROR.patch #713428
+ "${FILESDIR}"/${PN}-0.7.3-pid_t.patch #713428
+)
+
+src_prepare() {
+ eapply "${WORKDIR}"/debian/patches/[0-9]*
+
+ default
+
+ sed -i '/^dist_doc_DATA/d' Makefile.am || die
+ eautoreconf
+}
+
+src_configure() {
+ ac_cv_header_selinux_selinux_h=$(usex selinux) \
+ ac_cv_lib_selinux_security_get_boolean_active=$(usex selinux) \
+ econf \
+ --disable-werror \
+ $(use_enable debug) \
+ $(use_with unwind libunwind)
+}