1
From 8fe656de630e851bc512bbd7e7a6c18c53aecb61 Mon Sep 17 00:00:00 2001
2
From: Simon McVittie <simon.mcvittie@collabora.co.uk>
3
Date: Mon, 14 Apr 2008 12:56:43 +0100
4
Subject: [PATCH] Freeze error ABI at the ABI used in Fedora 8 and Ubuntu gutsy.
6
This avoids getting a different ABI depending on the version of libdbus
7
we're compiled against. fd.o #15430, Debian #476080.
9
dbus/dbus-glib.h | 34 ++++++++++++++++-
10
dbus/dbus-gobject.c | 72 ++++++++++++++++++++++++++++++++++-
11
dbus/make-dbus-glib-error-enum.sh | 25 +------------
12
dbus/make-dbus-glib-error-switch.sh | 29 +-------------
13
4 files changed, 106 insertions(+), 54 deletions(-)
15
diff --git a/dbus/dbus-glib.h b/dbus/dbus-glib.h
16
index b1084ba..c4049f3 100644
17
--- a/dbus/dbus-glib.h
18
+++ b/dbus/dbus-glib.h
19
@@ -60,7 +60,39 @@ GQuark dbus_g_error_quark (void);
23
-#include "dbus-glib-error-enum.h"
25
+DBUS_GERROR_NO_MEMORY,
26
+DBUS_GERROR_SERVICE_UNKNOWN,
27
+DBUS_GERROR_NAME_HAS_NO_OWNER,
28
+DBUS_GERROR_NO_REPLY,
29
+DBUS_GERROR_IO_ERROR,
30
+DBUS_GERROR_BAD_ADDRESS,
31
+DBUS_GERROR_NOT_SUPPORTED,
32
+DBUS_GERROR_LIMITS_EXCEEDED,
33
+DBUS_GERROR_ACCESS_DENIED,
34
+DBUS_GERROR_AUTH_FAILED,
35
+DBUS_GERROR_NO_SERVER,
37
+DBUS_GERROR_NO_NETWORK,
38
+DBUS_GERROR_ADDRESS_IN_USE,
39
+DBUS_GERROR_DISCONNECTED,
40
+DBUS_GERROR_INVALID_ARGS,
41
+DBUS_GERROR_FILE_NOT_FOUND,
42
+DBUS_GERROR_FILE_EXISTS,
43
+DBUS_GERROR_UNKNOWN_METHOD,
44
+DBUS_GERROR_TIMED_OUT,
45
+DBUS_GERROR_MATCH_RULE_NOT_FOUND,
46
+DBUS_GERROR_MATCH_RULE_INVALID,
47
+DBUS_GERROR_SPAWN_EXEC_FAILED,
48
+DBUS_GERROR_SPAWN_FORK_FAILED,
49
+DBUS_GERROR_SPAWN_CHILD_EXITED,
50
+DBUS_GERROR_SPAWN_CHILD_SIGNALED,
51
+DBUS_GERROR_SPAWN_FAILED,
52
+DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN,
53
+DBUS_GERROR_INVALID_SIGNATURE,
54
+DBUS_GERROR_INVALID_FILE_CONTENT,
55
+DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN,
56
+DBUS_GERROR_REMOTE_EXCEPTION
59
gboolean dbus_g_error_has_name (GError *error,
60
diff --git a/dbus/dbus-gobject.c b/dbus/dbus-gobject.c
61
index dae2dac..6596309 100644
62
--- a/dbus/dbus-gobject.c
63
+++ b/dbus/dbus-gobject.c
64
@@ -1668,7 +1668,77 @@ export_signals (DBusGConnection *connection, const GList *info_list, GObject *ob
68
-#include "dbus-glib-error-switch.h"
70
+dbus_error_to_gerror_code (const char *derr)
73
+ else if (!strcmp (derr, DBUS_ERROR_FAILED ))
74
+ return DBUS_GERROR_FAILED ;
75
+ else if (!strcmp (derr, DBUS_ERROR_NO_MEMORY ))
76
+ return DBUS_GERROR_NO_MEMORY ;
77
+ else if (!strcmp (derr, DBUS_ERROR_SERVICE_UNKNOWN ))
78
+ return DBUS_GERROR_SERVICE_UNKNOWN ;
79
+ else if (!strcmp (derr, DBUS_ERROR_NAME_HAS_NO_OWNER ))
80
+ return DBUS_GERROR_NAME_HAS_NO_OWNER ;
81
+ else if (!strcmp (derr, DBUS_ERROR_NO_REPLY ))
82
+ return DBUS_GERROR_NO_REPLY ;
83
+ else if (!strcmp (derr, DBUS_ERROR_IO_ERROR ))
84
+ return DBUS_GERROR_IO_ERROR ;
85
+ else if (!strcmp (derr, DBUS_ERROR_BAD_ADDRESS ))
86
+ return DBUS_GERROR_BAD_ADDRESS ;
87
+ else if (!strcmp (derr, DBUS_ERROR_NOT_SUPPORTED ))
88
+ return DBUS_GERROR_NOT_SUPPORTED ;
89
+ else if (!strcmp (derr, DBUS_ERROR_LIMITS_EXCEEDED ))
90
+ return DBUS_GERROR_LIMITS_EXCEEDED ;
91
+ else if (!strcmp (derr, DBUS_ERROR_ACCESS_DENIED ))
92
+ return DBUS_GERROR_ACCESS_DENIED ;
93
+ else if (!strcmp (derr, DBUS_ERROR_AUTH_FAILED ))
94
+ return DBUS_GERROR_AUTH_FAILED ;
95
+ else if (!strcmp (derr, DBUS_ERROR_NO_SERVER ))
96
+ return DBUS_GERROR_NO_SERVER ;
97
+ else if (!strcmp (derr, DBUS_ERROR_TIMEOUT ))
98
+ return DBUS_GERROR_TIMEOUT ;
99
+ else if (!strcmp (derr, DBUS_ERROR_NO_NETWORK ))
100
+ return DBUS_GERROR_NO_NETWORK ;
101
+ else if (!strcmp (derr, DBUS_ERROR_ADDRESS_IN_USE ))
102
+ return DBUS_GERROR_ADDRESS_IN_USE ;
103
+ else if (!strcmp (derr, DBUS_ERROR_DISCONNECTED ))
104
+ return DBUS_GERROR_DISCONNECTED ;
105
+ else if (!strcmp (derr, DBUS_ERROR_INVALID_ARGS ))
106
+ return DBUS_GERROR_INVALID_ARGS ;
107
+ else if (!strcmp (derr, DBUS_ERROR_FILE_NOT_FOUND ))
108
+ return DBUS_GERROR_FILE_NOT_FOUND ;
109
+ else if (!strcmp (derr, DBUS_ERROR_FILE_EXISTS ))
110
+ return DBUS_GERROR_FILE_EXISTS ;
111
+ else if (!strcmp (derr, DBUS_ERROR_UNKNOWN_METHOD ))
112
+ return DBUS_GERROR_UNKNOWN_METHOD ;
113
+ else if (!strcmp (derr, DBUS_ERROR_TIMED_OUT ))
114
+ return DBUS_GERROR_TIMED_OUT ;
115
+ else if (!strcmp (derr, DBUS_ERROR_MATCH_RULE_NOT_FOUND ))
116
+ return DBUS_GERROR_MATCH_RULE_NOT_FOUND ;
117
+ else if (!strcmp (derr, DBUS_ERROR_MATCH_RULE_INVALID ))
118
+ return DBUS_GERROR_MATCH_RULE_INVALID ;
119
+ else if (!strcmp (derr, DBUS_ERROR_SPAWN_EXEC_FAILED ))
120
+ return DBUS_GERROR_SPAWN_EXEC_FAILED ;
121
+ else if (!strcmp (derr, DBUS_ERROR_SPAWN_FORK_FAILED ))
122
+ return DBUS_GERROR_SPAWN_FORK_FAILED ;
123
+ else if (!strcmp (derr, DBUS_ERROR_SPAWN_CHILD_EXITED ))
124
+ return DBUS_GERROR_SPAWN_CHILD_EXITED ;
125
+ else if (!strcmp (derr, DBUS_ERROR_SPAWN_CHILD_SIGNALED ))
126
+ return DBUS_GERROR_SPAWN_CHILD_SIGNALED ;
127
+ else if (!strcmp (derr, DBUS_ERROR_SPAWN_FAILED ))
128
+ return DBUS_GERROR_SPAWN_FAILED ;
129
+ else if (!strcmp (derr, DBUS_ERROR_UNIX_PROCESS_ID_UNKNOWN ))
130
+ return DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN ;
131
+ else if (!strcmp (derr, DBUS_ERROR_INVALID_SIGNATURE ))
132
+ return DBUS_GERROR_INVALID_SIGNATURE ;
133
+ else if (!strcmp (derr, DBUS_ERROR_INVALID_FILE_CONTENT ))
134
+ return DBUS_GERROR_INVALID_FILE_CONTENT ;
135
+ else if (!strcmp (derr, DBUS_ERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN ))
136
+ return DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN ;
138
+ return DBUS_GERROR_REMOTE_EXCEPTION;
143
diff --git a/dbus/make-dbus-glib-error-enum.sh b/dbus/make-dbus-glib-error-enum.sh
144
index 1646333..1d7929a 100755
145
--- a/dbus/make-dbus-glib-error-enum.sh
146
+++ b/dbus/make-dbus-glib-error-enum.sh
160
-cat $SRC | grep '#define DBUS_ERROR' | sed -e 's/#define //g' | \
161
- sed -e 's/".*//g' | sed -e 's/DBUS_ERROR/DBUS_GERROR/g' | sed -e 's/ *$/,/g' > $DEST.tmp
163
-if test ! -s $DEST.tmp ; then
164
- die "$DEST.tmp is empty, something went wrong, see any preceding error message"
166
-echo "DBUS_GERROR_REMOTE_EXCEPTION" >> $DEST.tmp
168
-echo "#ifndef DBUS_INSIDE_DBUS_GLIB_H" >> $DEST.tmp
169
-echo '#error "' "$DEST" 'may only be included by dbus-glib.h"' >> $DEST.tmp
170
-echo "#endif" >> $DEST.tmp
172
-mv $DEST.tmp $DEST || die "could not move $DEST.tmp to $DEST"
173
+echo "#error This header makes no sense - see bugs.freedesktop.org 15430" >$2
174
diff --git a/dbus/make-dbus-glib-error-switch.sh b/dbus/make-dbus-glib-error-switch.sh
175
index 602cf99..1d7929a 100755
176
--- a/dbus/make-dbus-glib-error-switch.sh
177
+++ b/dbus/make-dbus-glib-error-switch.sh
191
-echo 'static gint' > $DEST.tmp
192
-echo 'dbus_error_to_gerror_code (const char *derr)' >> $DEST.tmp
193
-echo '{' >> $DEST.tmp
194
-echo ' if (0) ; ' >> $DEST.tmp
196
-cat $SRC | grep '#define DBUS_ERROR' | sed -e 's/#define //g' | \
197
- sed -e 's/".*//g' | \
198
- (while read line; do \
199
- echo ' else if (!strcmp (derr, ' "$line" ' )) '; \
200
- echo ' return ' `echo $line | sed -e 's/DBUS_ERROR/DBUS_GERROR/g'` ';'; \
203
-echo ' else' >> $DEST.tmp
204
-echo ' return DBUS_GERROR_REMOTE_EXCEPTION;' >> $DEST.tmp
205
-echo '}' >> $DEST.tmp
207
-mv $DEST.tmp $DEST || die "could not move $DEST.tmp to $DEST"
208
+echo "#error This header makes no sense - see bugs.freedesktop.org 15430" >$2