Skip to contentSkip to conversation

package/connman: cleanup backtrace patch

PATCH Superseded Yann E. MORIN 2 participants 2 messages Dec 24, 2015

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/connman: cleanup backtrace patch

connman uses execinfo.h to dump a backtrace in case of failure. execinfo.h is optional in uClibc, so we had a patch that conditonally disabled backtraces for uClibc when it was missing execinfo.h

However, musl is also entirely lacking execinfo.h.

Add a proper patch that checks for execinfo.h at ./configure time. This will no longer make any assumption on the C library that is being used.

Fixes:

    http://autobuild.buildroot.org/results/f6e/f6ee8ab3a6300f1f527f9e92b8c2ec81e63afb27/
    http://autobuild.buildroot.org/results/96b/96b78bb644ed4ef3493782521b17e3b2113a405f/
    ...

Note that there might be other issues with musl; this patch only fiexes the execinfo.h one.

Cc Thomas Petazzoni <[email protected]>

---
Changes v1 -> v2:
- use simpler and more autotoolish check (Thomas)

---
 .../0001-configure-check-for-execinfo.h.patch      | 65 ++++++++++++++++++++++
 package/connman/0001-uclibc-backtrace.patch        | 44 ---------------
 2 files changed, 65 insertions(+), 44 deletions(-)
 create mode 100644 package/connman/0001-configure-check-for-execinfo.h.patch
 delete mode 100644 package/connman/0001-uclibc-backtrace.patch
package/connman/0001-configure-check-for-execinfo.h.patch new file +65 -0
new file mode 100644
index 0000000..03509e6
@@ -0,0 +1,65 @@
+From edce771726ee1c0022b526af29bc460a5d1fdc08 Mon Sep 17 00:00:00 2001
+From: "Yann E. MORIN" <[email protected]>
+Date: Thu, 24 Dec 2015 12:04:57 +0100
+Subject: [PATCH] configure: check for execinfo.h
+
+Not all toolchains have execinfo.h. For example, support for it is
+optional in uClibc, while it is entirely missing from musl.
+
+Add a check in configure to look for it.
+
+Since execinfo.h is /only/ used to dump a backtrace in case of failure,
+just do nothing when execinfo.h is missing.
+
+Signed-off-by: "Yann E. MORIN" <[email protected]>
+---
+ configure.ac | 2 ++
+ src/log.c    | 4 ++++
+ 2 files changed, 6 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index b51d6b3..28e657b 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -182,6 +182,8 @@ AC_CHECK_LIB(resolv, ns_initparse, dummy=yes, [
+ 		AC_MSG_ERROR(resolver library support is required))
+ ])
+ 
++AC_CHECK_HEADERS([execinfo.h])
++
+ AC_CHECK_FUNC(signalfd, dummy=yes,
+ 			AC_MSG_ERROR(signalfd support is required))
+ 
+diff --git a/src/log.c b/src/log.c
+index a693bd0..48ac628 100644
+--- a/src/log.c
++++ b/src/log.c
+@@ -30,7 +30,9 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <syslog.h>
++#if defined(HAVE_EXECINFO_H)
+ #include <execinfo.h>
++#endif
+ #include <dlfcn.h>
+ 
+ #include "connman.h"
+@@ -112,6 +114,7 @@ void connman_debug(const char *format, ...)
+ 
+ static void print_backtrace(unsigned int offset)
+ {
++#if defined(HAVE_EXECINFO_H)
+ 	void *frames[99];
+ 	size_t n_ptrs;
+ 	unsigned int i;
+@@ -210,6 +213,7 @@ static void print_backtrace(unsigned int offset)
+ 
+ 	close(outfd[1]);
+ 	close(infd[0]);
++#endif /* HAVE_BACKTRACE */
+ }
+ 
+ static void signal_handler(int signo)
+-- 
+1.9.1
+
package/connman/0001-uclibc-backtrace.patch deleted +0 -44

44 lines not on this page · raw message

Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/1 package/connman: cleanup backtrace patch

Hi Yann,

package/connman/0001-configure-check-for-execinfo.h.patch line 59

Quoted 13 lines · Yann E. MORIN

+@@ -112,6 +114,7 @@ void connman_debug(const char *format, ...) +
+ static void print_backtrace(unsigned int offset)
+ {
++#if defined(HAVE_EXECINFO_H)

package/connman/0001-configure-check-for-execinfo.h.patch new file +8 -0
+ 	void *frames[99];
+ 	size_t n_ptrs;
+ 	unsigned int i;
+@@ -210,6 +213,7 @@ static void print_backtrace(unsigned int offset)
+ 
+ 	close(outfd[1]);
+ 	close(infd[0]);
++#endif /* HAVE_BACKTRACE */

The comment is wrong now.

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -