summaryrefslogtreecommitdiffstats
path: root/devel
diff options
context:
space:
mode:
authorIsmael Luceno2019-09-19 02:29:57 +0200
committerIsmael Luceno2019-09-20 00:36:37 +0200
commit09cb576557d747bebfc9bac992f2fb4042c97933 (patch)
treeef4cd8805d4fcf98ca3708a52c316611f5c6d375 /devel
parentf6ef15e89a57d5529171d959991408cbf792f4ca (diff)
ltrace: Import critical bug fixes from upstream
Also fix building against musl.
Diffstat (limited to 'devel')
-rwxr-xr-xdevel/ltrace/BUILD2
-rwxr-xr-xdevel/ltrace/DETAILS1
-rw-r--r--devel/ltrace/HISTORY12
-rwxr-xr-xdevel/ltrace/PRE_BUILD4
-rw-r--r--devel/ltrace/patches/0001-Avoid-using-REG_NOERROR.patch51
-rw-r--r--devel/ltrace/patches/0001-Avoid-using-non-portable-error.h-in-generic-code.patch38
-rw-r--r--devel/ltrace/patches/0001-Fix-conditions-in-elf_read_u-16-32-64.patch29
-rw-r--r--devel/ltrace/patches/0001-Fix-fetching-of-system-call-arguments-on-i386.patch102
-rw-r--r--devel/ltrace/patches/0001-Show-nil-also-for-void-values.patch39
-rw-r--r--devel/ltrace/patches/0001-expr_node_zero-and-expr_self-should-be-stack-allocat.patch76
10 files changed, 354 insertions, 0 deletions
diff --git a/devel/ltrace/BUILD b/devel/ltrace/BUILD
new file mode 100755
index 0000000000..fc314f8f01
--- /dev/null
+++ b/devel/ltrace/BUILD
@@ -0,0 +1,2 @@
+CFLAGS+=' -Wno-error' &&
+default_build
diff --git a/devel/ltrace/DETAILS b/devel/ltrace/DETAILS
index 2c0431cfeb..bcd0c86268 100755
--- a/devel/ltrace/DETAILS
+++ b/devel/ltrace/DETAILS
@@ -1,5 +1,6 @@
SPELL=ltrace
VERSION=0.7.3
+ PATCHLEVEL=1
SOURCE=${SPELL}_${VERSION}.orig.tar.bz2
SOURCE_URL[0]=http://ltrace.org/${SOURCE}
SOURCE_HASH=sha512:a842b16dcb81da869afa0bddc755fdff0d57b35672505bf2c7164fd983b1938d28b126714128930994cc1230ced69d779456d0cfc16f4008c9b6d19f0852285d
diff --git a/devel/ltrace/HISTORY b/devel/ltrace/HISTORY
index f2148a8126..79f0d25cfa 100644
--- a/devel/ltrace/HISTORY
+++ b/devel/ltrace/HISTORY
@@ -1,3 +1,15 @@
+2019-09-19 Ismael Luceno <ismael@sourcemage.org>
+ * PRE_BUILD, patches/0001-Avoid-using-REG_NOERROR.patch,
+ patches/0001-Avoid-using-non-portable-error.h-in-generic-code.patch,
+ patches/0001-Fix-conditions-in-elf_read_u-16-32-64.patch,
+ patches/0001-Fix-fetching-of-system-call-arguments-on-i386.patch,
+ patches/0001-Show-nil-also-for-void-values.patch,
+ patches/0001-expr_node_zero-and-expr_self-should-be-stack-allocat.patch:
+ Added critical build fixes
+ * BUILD: Added -Wno-error to CFLAGS
+ * DETAILS: PATCHLEVEL++
+ * PRE_BUILD: Fixed build against musl
+
2015-07-30 Vlad Glagolev <stealth@sourcemage.org>
* DETAILS: updated source url, website; quoting paths
diff --git a/devel/ltrace/PRE_BUILD b/devel/ltrace/PRE_BUILD
new file mode 100755
index 0000000000..2102a91ce7
--- /dev/null
+++ b/devel/ltrace/PRE_BUILD
@@ -0,0 +1,4 @@
+default_pre_build &&
+cd "$SOURCE_DIRECTORY" &&
+apply_patch_dir patches &&
+sedit 's!maybe_os in$!& linux-musl*|\\!' config/autoconf/config.sub
diff --git a/devel/ltrace/patches/0001-Avoid-using-REG_NOERROR.patch b/devel/ltrace/patches/0001-Avoid-using-REG_NOERROR.patch
new file mode 100644
index 0000000000..3876c1f098
--- /dev/null
+++ b/devel/ltrace/patches/0001-Avoid-using-REG_NOERROR.patch
@@ -0,0 +1,51 @@
+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.
+
+Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
+---
+ glob.c | 4 ++--
+ options.c | 2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/glob.c b/glob.c
+index 9af633f85e16..b26637f61379 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 e8fd2a2c525e..4c7441e05263 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.23.0
diff --git a/devel/ltrace/patches/0001-Avoid-using-non-portable-error.h-in-generic-code.patch b/devel/ltrace/patches/0001-Avoid-using-non-portable-error.h-in-generic-code.patch
new file mode 100644
index 0000000000..531677e245
--- /dev/null
+++ b/devel/ltrace/patches/0001-Avoid-using-non-portable-error.h-in-generic-code.patch
@@ -0,0 +1,38 @@
+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
+
+Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
+---
+ read_config_file.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/read_config_file.c b/read_config_file.c
+index e247436a307d..70d3bd32038b 100644
+--- 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.23.0
diff --git a/devel/ltrace/patches/0001-Fix-conditions-in-elf_read_u-16-32-64.patch b/devel/ltrace/patches/0001-Fix-conditions-in-elf_read_u-16-32-64.patch
new file mode 100644
index 0000000000..2db685f5d3
--- /dev/null
+++ b/devel/ltrace/patches/0001-Fix-conditions-in-elf_read_u-16-32-64.patch
@@ -0,0 +1,29 @@
+From 8c3674c86688a79a8689772c3d0c84d6e7aaa118 Mon Sep 17 00:00:00 2001
+From: Petr Machata <pmachata@redhat.com>
+Date: Tue, 8 Jan 2013 23:22:49 +0100
+Subject: [PATCH] Fix conditions in elf_read_u{16,32,64}
+
+- The calling convention of need_data is 0 on success, <0 on failure.
+ The condition seems to have it all mixed, using both a ! and a
+ comparison.
+
+Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
+---
+ ltrace-elf.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/ltrace-elf.c b/ltrace-elf.c
+index 29c204f3a0ca..0ecdc38b77f6 100644
+--- a/ltrace-elf.c
++++ b/ltrace-elf.c
+@@ -218,7 +218,7 @@ need_data(Elf_Data *data, GElf_Xword offset, GElf_Xword size)
+ int \
+ NAME(Elf_Data *data, GElf_Xword offset, uint##SIZE##_t *retp) \
+ { \
+- if (!need_data(data, offset, SIZE / 8) < 0) \
++ if (need_data(data, offset, SIZE / 8) < 0) \
+ return -1; \
+ \
+ if (data->d_buf == NULL) /* NODATA section */ { \
+--
+2.23.0
diff --git a/devel/ltrace/patches/0001-Fix-fetching-of-system-call-arguments-on-i386.patch b/devel/ltrace/patches/0001-Fix-fetching-of-system-call-arguments-on-i386.patch
new file mode 100644
index 0000000000..6617f5b4ea
--- /dev/null
+++ b/devel/ltrace/patches/0001-Fix-fetching-of-system-call-arguments-on-i386.patch
@@ -0,0 +1,102 @@
+From 5069ef8f498e5189de0789d79485f39b76c621d4 Mon Sep 17 00:00:00 2001
+From: Petr Machata <pmachata@redhat.com>
+Date: Thu, 24 Oct 2013 14:45:30 +0200
+Subject: [PATCH] Fix fetching of system call arguments on i386
+
+Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
+---
+ sysdeps/linux-gnu/x86/fetch.c | 54 +++++++++++++++-----
+ 1 file changed, 43 insertions(+), 11 deletions(-)
+
+diff --git a/sysdeps/linux-gnu/x86/fetch.c b/sysdeps/linux-gnu/x86/fetch.c
+index a3b9eb7d5f1e..6868101ccea0 100644
+--- a/sysdeps/linux-gnu/x86/fetch.c
++++ b/sysdeps/linux-gnu/x86/fetch.c
+@@ -61,6 +61,7 @@ struct fetch_context
+ arch_addr_t stack_pointer;
+ size_t ireg; /* Used-up integer registers. */
+ size_t freg; /* Used-up floating registers. */
++ int machine;
+
+ union {
+ struct {
+@@ -238,21 +239,42 @@ allocate_integer(struct fetch_context *context, struct value *valuep,
+
+ case POOL_SYSCALL:
+ #ifdef __x86_64__
+- switch (context->ireg) {
+- HANDLE(0, rdi);
+- HANDLE(1, rsi);
+- HANDLE(2, rdx);
+- HANDLE(3, r10);
+- HANDLE(4, r8);
+- HANDLE(5, r9);
+- default:
+- assert(!"More than six syscall arguments???");
+- abort();
++ if (context->machine == EM_X86_64) {
++ switch (context->ireg) {
++ HANDLE(0, rdi);
++ HANDLE(1, rsi);
++ HANDLE(2, rdx);
++ HANDLE(3, r10);
++ HANDLE(4, r8);
++ HANDLE(5, r9);
++ default:
++ assert(!"More than six syscall arguments???");
++ abort();
++ }
+ }
++#endif
++ if (context->machine == EM_386) {
++
++#ifdef __x86_64__
++# define HANDLE32(NUM, WHICH) HANDLE(NUM, r##WHICH)
+ #else
+- i386_unreachable();
++# define HANDLE32(NUM, WHICH) HANDLE(NUM, e##WHICH)
+ #endif
+
++ switch (context->ireg) {
++ HANDLE32(0, bx);
++ HANDLE32(1, cx);
++ HANDLE32(2, dx);
++ HANDLE32(3, si);
++ HANDLE32(4, di);
++ HANDLE32(5, bp);
++ default:
++ assert(!"More than six syscall arguments???");
++ abort();
++ }
++#undef HANDLE32
++ }
++
+ case POOL_RETVAL:
+ switch (context->ireg) {
+ #ifdef __x86_64__
+@@ -572,6 +594,15 @@ arch_fetch_arg_next_32(struct fetch_context *context, enum tof type,
+ size_t sz = type_sizeof(proc, info);
+ if (sz == (size_t)-1)
+ return -1;
++ if (value_reserve(valuep, sz) == NULL)
++ return -1;
++
++ if (type == LT_TOF_SYSCALL || type == LT_TOF_SYSCALLR) {
++ int cls = allocate_integer(context, valuep,
++ sz, 0, POOL_SYSCALL);
++ assert(cls == CLASS_INTEGER);
++ return 0;
++ }
+
+ allocate_stack_slot(context, valuep, sz, 0, 4);
+
+@@ -704,6 +735,7 @@ arch_fetch_arg_init(enum tof type, struct process *proc,
+ struct fetch_context *ctx = malloc(sizeof(*ctx));
+ if (ctx == NULL)
+ return NULL;
++ ctx->machine = proc->e_machine;
+
+ assert(type != LT_TOF_FUNCTIONR
+ && type != LT_TOF_SYSCALLR);
+--
+2.23.0
diff --git a/devel/ltrace/patches/0001-Show-nil-also-for-void-values.patch b/devel/ltrace/patches/0001-Show-nil-also-for-void-values.patch
new file mode 100644
index 0000000000..641d10f4ca
--- /dev/null
+++ b/devel/ltrace/patches/0001-Show-nil-also-for-void-values.patch
@@ -0,0 +1,39 @@
+From d8286ed3496bcd69cd4796f57a5b5c04859d2378 Mon Sep 17 00:00:00 2001
+From: Petr Machata <pmachata@redhat.com>
+Date: Mon, 4 Nov 2013 13:35:38 +0100
+Subject: [PATCH] Show "nil" also for void* values
+
+Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
+---
+ lens_default.c | 7 ++++-
+ 1 file changed, 4 insertions(+), 1 deletions(-)
+
+diff --git a/lens_default.c b/lens_default.c
+index 84b74ea2dd67..f0bd616aca7d 100644
+--- a/lens_default.c
++++ b/lens_default.c
+@@ -255,11 +255,12 @@ format_struct(FILE *stream, struct value *value, struct value_dict *arguments)
+ return written;
+ }
+
++static const char null_message[] = "nil";
+ int
+ format_pointer(FILE *stream, struct value *value, struct value_dict *arguments)
+ {
+ if (value_is_zero(value, arguments))
+- return fprintf(stream, "nil");
++ return fprintf(stream, null_message);
+
+ /* The following is for detecting recursion. We keep track of
+ * the values that were already displayed. Each time a
+@@ -416,6 +417,8 @@ toplevel_format_lens(struct lens *lens, FILE *stream,
+ return format_struct(stream, value, arguments);
+
+ case ARGTYPE_POINTER:
++ if (value_is_zero(value, arguments))
++ return fprintf(stream, null_message);
+ if (value->type->u.array_info.elt_type->type != ARGTYPE_VOID)
+ return format_pointer(stream, value, arguments);
+ return format_integer(stream, value, INT_FMT_x, arguments);
+--
+2.23.0
diff --git a/devel/ltrace/patches/0001-expr_node_zero-and-expr_self-should-be-stack-allocat.patch b/devel/ltrace/patches/0001-expr_node_zero-and-expr_self-should-be-stack-allocat.patch
new file mode 100644
index 0000000000..4b5bfa0b78
--- /dev/null
+++ b/devel/ltrace/patches/0001-expr_node_zero-and-expr_self-should-be-stack-allocat.patch
@@ -0,0 +1,76 @@
+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
+
+Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
+---
+ expr.c | 14 ++++++--------
+ zero.c | 14 ++++++--------
+ 2 files changed, 12 insertions(+), 16 deletions(-)
+
+diff --git a/expr.c b/expr.c
+index 32860fd2e2e9..552a53ce63e7 100644
+--- 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;
+ }
+diff --git a/zero.c b/zero.c
+index bc119ee7128c..5757943e389a 100644
+--- 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.23.0