Merge lp:~xnox/libnih/fix-for-997359 into lp:libnih

Proposed by Dimitri John Ledkov
Status: Work in progress
Proposed branch: lp:~xnox/libnih/fix-for-997359
Merge into: lp:libnih
Diff against target: 134 lines (+27/-21)
3 files modified
ChangeLog (+6/-0)
nih/logging.c (+8/-8)
nih/tests/test_logging.c (+13/-13)
To merge this branch: bzr merge lp:~xnox/libnih/fix-for-997359
Reviewer Review Type Date Requested Status
Dimitri John Ledkov (community) Disapprove
Scott James Remnant Pending
Review via email: mp+140155@code.launchpad.net

Description of the change

Cherry pick from lp:ubuntu/libnih to fix the linked bug.

To post a comment you must log in.
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

libnih development has moved on to github.

review: Disapprove

Unmerged revisions

1055. By James Hunt

* nih/logging.c: Use our own __nih_abort_msg rather than the (e)glibc
  private symbol __abort_msg to avoid upgrade issues (LP: #997359).
* nih/tests/test_logging.c: Update tests for __nih_abort_msg.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2011-09-01 18:41:03 +0000
3+++ ChangeLog 2012-12-17 09:58:49 +0000
4@@ -1,3 +1,9 @@
5+2012-10-25 James Hunt <james.hunt@ubuntu.com>
6+
7+ * nih/logging.c: Use our own __nih_abort_msg rather than the
8+ (e)glibc private symbol __abort_msg to avoid upgrade issues (LP: #997359).
9+ * nih/tests/test_logging.c: Update tests for __nih_abort_msg.
10+
11 2011-08-31 James Hunt <james.hunt@ubuntu.com>
12
13 * nih-dbus-tool/tests/test_com.netsplit.Nih.Test_object.c
14
15=== modified file 'nih/logging.c'
16--- nih/logging.c 2010-02-04 18:24:58 +0000
17+++ nih/logging.c 2012-12-17 09:58:49 +0000
18@@ -39,11 +39,11 @@
19
20
21 /**
22- * __abort_msg:
23+ * __nih_abort_msg:
24 *
25- * A glibc variable that keeps the assertion message in the core dump.
26+ * A variable that keeps the assertion message in the core dump.
27 **/
28-extern char *__abort_msg __attribute__ ((weak));
29+char *__nih_abort_msg;
30
31 /**
32 * logger:
33@@ -114,19 +114,19 @@
34 * nih_log_abort_message:
35 * @message: message to be logged.
36 *
37- * Save @message in the glibc __abort_msg variable so it can be retrieved
38+ * Save @message in the __nih_abort_msg variable so it can be retrieved
39 * by debuggers if we should crash at this point.
40 **/
41 static void
42 nih_log_abort_message (const char *message)
43 {
44- if (! &__abort_msg)
45+ if (! &__nih_abort_msg)
46 return;
47
48- if (__abort_msg)
49- nih_discard (__abort_msg);
50+ if (__nih_abort_msg)
51+ nih_discard (__nih_abort_msg);
52
53- __abort_msg = NIH_MUST (nih_strdup (NULL, message));
54+ __nih_abort_msg = NIH_MUST (nih_strdup (NULL, message));
55 }
56
57 /**
58
59=== modified file 'nih/tests/test_logging.c'
60--- nih/tests/test_logging.c 2010-02-04 18:24:58 +0000
61+++ nih/tests/test_logging.c 2012-12-17 09:58:49 +0000
62@@ -31,7 +31,7 @@
63 #include <nih/main.h>
64
65
66-extern char *__abort_msg __attribute__ ((weak));
67+extern char *__nih_abort_msg;
68
69 static NihLogLevel last_priority = NIH_LOG_UNKNOWN;
70 static char * last_message = NULL;
71@@ -156,13 +156,13 @@
72 }
73
74
75- /* Check that a fatal message is also stored in the glibc __abort_msg
76+ /* Check that a fatal message is also stored in the __nih_abort_msg
77 * variable.
78 */
79- if (&__abort_msg) {
80+ if (&__nih_abort_msg) {
81 TEST_FEATURE ("with fatal message");
82 TEST_ALLOC_FAIL {
83- __abort_msg = NULL;
84+ __nih_abort_msg = NULL;
85 last_priority = NIH_LOG_UNKNOWN;
86 last_message = NULL;
87
88@@ -174,16 +174,16 @@
89 TEST_EQ (last_priority, NIH_LOG_FATAL);
90 TEST_EQ_STR (last_message, "message with some 20 formatting");
91
92- TEST_NE_P (__abort_msg, NULL);
93- TEST_ALLOC_PARENT (__abort_msg, NULL);
94- TEST_EQ_STR (__abort_msg, "message with some 20 formatting");
95+ TEST_NE_P (__nih_abort_msg, NULL);
96+ TEST_ALLOC_PARENT (__nih_abort_msg, NULL);
97+ TEST_EQ_STR (__nih_abort_msg, "message with some 20 formatting");
98
99 free (last_message);
100 }
101
102
103 /* Check that a fatal message can safely overwrite one already stored
104- * in the glibc __abort_msg variable.
105+ * in the __nih_abort_msg variable.
106 */
107 TEST_FEATURE ("with second fatal message");
108 TEST_ALLOC_FAIL {
109@@ -191,7 +191,7 @@
110 msg = nih_strdup (NULL, "test");
111 }
112
113- __abort_msg = msg;
114+ __nih_abort_msg = msg;
115 TEST_FREE_TAG (msg);
116
117 last_priority = NIH_LOG_UNKNOWN;
118@@ -207,14 +207,14 @@
119
120 TEST_FREE (msg);
121
122- TEST_NE_P (__abort_msg, NULL);
123- TEST_ALLOC_PARENT (__abort_msg, NULL);
124- TEST_EQ_STR (__abort_msg, "message with some 20 formatting");
125+ TEST_NE_P (__nih_abort_msg, NULL);
126+ TEST_ALLOC_PARENT (__nih_abort_msg, NULL);
127+ TEST_EQ_STR (__nih_abort_msg, "message with some 20 formatting");
128
129 free (last_message);
130 }
131 } else {
132- printf ("SKIP: __abort_msg not available\n");
133+ printf ("SKIP: __nih_abort_msg not available\n");
134 }
135
136

Subscribers

People subscribed via source and target branches