rpms/geoclue/F-12 0001-Add-error-type-registration.patch, NONE, 1.1 0002-Don-t-lose-special-D-Bus-error-sauce-when-copying.patch, NONE, 1.1 geoclue.spec, 1.20, 1.21

Bastien Nocera hadess at fedoraproject.org
Fri Jan 29 12:51:11 UTC 2010


Author: hadess

Update of /cvs/pkgs/rpms/geoclue/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv521

Modified Files:
	geoclue.spec 
Added Files:
	0001-Add-error-type-registration.patch 
	0002-Don-t-lose-special-D-Bus-error-sauce-when-copying.patch 
Log Message:
* Fri Jan 29 2010 Bastien Nocera <bnocera at redhat.com> 0.11.1.1-0.11
- Fix crashers in geoclue-master provider (#528897)


0001-Add-error-type-registration.patch:
 .gitignore                   |    2 ++
 docs/reference/geoclue.types |    1 +
 geoclue/Makefile.am          |   39 +++++++++++++++++++++++++++++++++++----
 geoclue/geoclue-error.h      |   20 ++++++++++++++++++--
 geoclue/geoclue-types.c      |    5 +++++
 geoclue/geoclue-types.h      |   18 ++----------------
 6 files changed, 63 insertions(+), 22 deletions(-)

--- NEW FILE 0001-Add-error-type-registration.patch ---
>From 10a0efe5366c5f71df4ef263b53c5344a7151881 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess at hadess.net>
Date: Wed, 27 Jan 2010 14:05:25 +0000
Subject: [PATCH 1/2] Add error type registration

The error types need to be registered with dbus-glib to be used.
---
 .gitignore                   |    2 ++
 docs/reference/geoclue.types |    1 +
 geoclue/Makefile.am          |   39 +++++++++++++++++++++++++++++++++++----
 geoclue/geoclue-error.h      |   20 ++++++++++++++++++--
 geoclue/geoclue-types.c      |    5 +++++
 geoclue/geoclue-types.h      |   17 ++---------------
 6 files changed, 63 insertions(+), 21 deletions(-)

diff --git a/.gitignore b/.gitignore
index 0d1734f..a7c0caa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,3 +37,5 @@ example/geoclue-map-example-moving
 example/geoclue-map-layout-example
 example/geoclue-position-example
 geoclue/geoclue-master
+geoclue/geoclue-enum-types.h
+geoclue/geoclue-enum-types.c
diff --git a/docs/reference/geoclue.types b/docs/reference/geoclue.types
index e0ac708..064bb81 100644
--- a/docs/reference/geoclue.types
+++ b/docs/reference/geoclue.types
@@ -23,6 +23,7 @@ geoclue_velocity_get_type
 geoclue_address_get_type
 geoclue_geocode_get_type
 geoclue_reverse_geocode_get_type
+geoclue_error_get_type
 
 gc_web_service_get_type
 gc_provider_get_type
diff --git a/geoclue/Makefile.am b/geoclue/Makefile.am
index 0a8a876..362f19d 100644
--- a/geoclue/Makefile.am
+++ b/geoclue/Makefile.am
@@ -19,7 +19,9 @@ nodist_libgeoclue_la_SOURCES = \
 	gc-iface-velocity-glue.h
 
 BUILT_SOURCES = \
-	$(nodist_libgeoclue_la_SOURCES)
+	$(nodist_libgeoclue_la_SOURCES)	\
+	geoclue-enum-types.h		\
+	geoclue-enum-types.c
 
 libgeoclue_la_SOURCES = 	\
 	geoclue-accuracy.c	\
@@ -41,7 +43,8 @@ libgeoclue_la_SOURCES = 	\
 	gc-iface-geocode.c	\
 	gc-iface-position.c	\
 	gc-iface-reverse-geocode.c	\
-	gc-iface-velocity.c
+	gc-iface-velocity.c	\
+	geoclue-enum-types.c
 
 libgeoclue_la_LIBADD =	\
 	$(GEOCLUE_LIBS)
@@ -71,7 +74,8 @@ geoclue_headers =		\
 	geoclue-position.h	\
 	geoclue-reverse-geocode.h	\
 	geoclue-types.h		\
-	geoclue-velocity.h
+	geoclue-velocity.h	\
+	geoclue-enum-types.h
 
 libgeoclue_includedir = $(includedir)/geoclue
 libgeoclue_include_HEADERS =	\
@@ -89,7 +93,9 @@ CLEANFILES = $(BUILT_SOURCES) 	\
 	stamp-gc-iface-velocity-glue.h
 
 DISTCLEANFILES = \
-	$(nodist_libgeoclue_la_SOURCES)
+	$(nodist_libgeoclue_la_SOURCES)	\
+	geoclue-enum-types.h		\
+	geoclue-enum-types.c
 
 geoclue-marshal.h: geoclue-marshal.list $(GLIB_GENMARSHAL)
 	$(GLIB_GENMARSHAL) $< --header --prefix=geoclue_marshal > $@
@@ -143,3 +149,28 @@ stamp-%-bindings.h: ../interfaces/%.xml
 	&& (cmp -s xgen-$(@F) $(@F:stamp-%=%) || cp xgen-$(@F) $(@F:stamp-%=%)) \
 	&& rm -f xgen-$(@F) \
 	&& echo timestamp > $(@F)
+
+geoclue_headers_to_scan_for_enums = geoclue-error.h
+# Generate the enums source code, with glib-mkenums:
+# This is based on the same Makefile.am stuff in pango:
+geoclue_built_headers = geoclue-enum-types.h
+geoclue_built_cfiles = geoclue-enum-types.c
+
+geoclue-enum-types.h: $(geoclue_headers_to_scan_for_enums) Makefile
+	$(AM_V_GEN) (cd $(srcdir) && glib-mkenums \
+			--fhead "#ifndef __GEOCLUE_ENUM_TYPES_H__\n#define __GEOCLUE_ENUM_TYPES_H__\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
+			--fprod "/* enumerations from \"@filename@\" */\n" \
+			--vhead "GType @enum_name at _get_type (void);\n#define GEOCLUE_TYPE_ at ENUMSHORT@ (@enum_name at _get_type())\n" 	\
+			--ftail "G_END_DECLS\n\n#endif /* __GEOCLUE_ENUM_TYPES_H__ */" \
+		$(geoclue_headers_to_scan_for_enums)) > $@
+
+geoclue-enum-types.c: $(geoclue_headers_to_scan_for_enums) Makefile geoclue-enum-types.h
+	$(AM_V_GEN) (cd $(srcdir) && glib-mkenums \
+			--fhead "#include <geoclue-error.h>\n" \
+			--fhead "#include \"geoclue-enum-types.h\"\n" \
+			--fhead "#include <glib-object.h>" \
+			--fprod "\n/* enumerations from \"@filename@\" */" \
+			--vhead "GType\n at enum_name@_get_type (void)\n{\n  static GType etype = 0;\n  if (etype == 0) {\n    static const G at Type@Value values[] = {" 	\
+			--vprod "      { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
+			--vtail "      { 0, NULL, NULL }\n    };\n    etype = g_ at type@_register_static (\"@EnumName@\", values);\n  }\n  return etype;\n}\n" \
+		$(geoclue_headers_to_scan_for_enums)) > $@
diff --git a/geoclue/geoclue-error.h b/geoclue/geoclue-error.h
index 2d55304..1138578 100644
--- a/geoclue/geoclue-error.h
+++ b/geoclue/geoclue-error.h
@@ -25,9 +25,25 @@
 #ifndef _GEOCLUE_ERROR_H
 #define _GEOCLUE_ERROR_H
 
-#include <glib.h>
-#include <geoclue/geoclue-types.h>
+#include <glib-object.h>
+#include <geoclue/geoclue-enum-types.h>
 
+/**
+ * GeoclueError:
+ * @GEOCLUE_ERROR_NOT_IMPLEMENTED: Method is not implemented
+ * @GEOCLUE_ERROR_NOT_AVAILABLE: Needed information is not currently
+ * available (e.g. web service did not respond)
+ * @GEOCLUE_ERROR_FAILED: Generic fatal error
+ *
+ * Error values for providers.
+ **/
+typedef enum {
+	GEOCLUE_ERROR_NOT_IMPLEMENTED,
+	GEOCLUE_ERROR_NOT_AVAILABLE,
+	GEOCLUE_ERROR_FAILED,
+} GeoclueError;
+
+#define GEOCLUE_ERROR_DBUS_INTERFACE "org.freedesktop.Geoclue.Error"
 #define GEOCLUE_ERROR (geoclue_error_quark ())
 
 GQuark geoclue_error_quark (void);
diff --git a/geoclue/geoclue-types.c b/geoclue/geoclue-types.c
index 53dba3f..15197b6 100644
--- a/geoclue/geoclue-types.c
+++ b/geoclue/geoclue-types.c
@@ -25,6 +25,7 @@
 #include <geoclue/geoclue-marshal.h>
 #include <geoclue/geoclue-types.h>
 #include <geoclue/geoclue-accuracy.h>
+#include <geoclue/geoclue-error.h>
 
 void
 geoclue_types_init (void)
@@ -61,4 +62,8 @@ geoclue_types_init (void)
 	                                   G_TYPE_STRING,
 	                                   G_TYPE_STRING,
 	                                   G_TYPE_INVALID);
+
+	dbus_g_error_domain_register (GEOCLUE_ERROR,
+				      GEOCLUE_ERROR_DBUS_INTERFACE,
+				      GEOCLUE_TYPE_ERROR);
 }
diff --git a/geoclue/geoclue-types.h b/geoclue/geoclue-types.h
index 5e39fbd..9ecbc40 100644
--- a/geoclue/geoclue-types.h
+++ b/geoclue/geoclue-types.h
@@ -25,6 +25,8 @@
 #ifndef _GEOCLUE_TYPES_H
 #define _GEOCLUE_TYPES_H
 
+#include <geoclue/geoclue-error.h>
+
 /**
  * SECTION:geoclue-types
  * @short_description: Type definitions and defines useful for Geoclue clients 
@@ -99,21 +101,6 @@ typedef enum {
 } GeoclueVelocityFields;
 
 /**
- * GeoclueError:
- * @GEOCLUE_ERROR_NOT_IMPLEMENTED: Method is not implemented
- * @GEOCLUE_ERROR_NOT_AVAILABLE: Needed information is not currently
- * available (e.g. web service did not respond)
- * @GEOCLUE_ERROR_FAILED: Generic fatal error
- * 
- * Error values for providers.
- **/
-typedef enum {
-	GEOCLUE_ERROR_NOT_IMPLEMENTED,
-	GEOCLUE_ERROR_NOT_AVAILABLE,
-	GEOCLUE_ERROR_FAILED,
-} GeoclueError;
-
-/**
  * GEOCLUE_ADDRESS_KEY_COUNTRYCODE:
  * 
  * A key for address hashtables. The hash value should be a ISO 3166 two 
-- 
1.6.6


0002-Don-t-lose-special-D-Bus-error-sauce-when-copying.patch:
 master-provider.c |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

--- NEW FILE 0002-Don-t-lose-special-D-Bus-error-sauce-when-copying.patch ---
>From 87ba0b5d803d5db088732a4445149f6be6911b8a Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess at hadess.net>
Date: Thu, 28 Jan 2010 11:17:24 +0000
Subject: [PATCH 2/2] Don't lose special D-Bus error sauce when copying

When copying errors for later use, make sure to copy D-Bus
errors special sauce (domain name of the error copied after the
string itself).

Fixes possible crashers in geoclue-master when returning a
cached provider error.

See:
https://bugzilla.redhat.com/show_bug.cgi?id=528897#c15

With debugging help from Colin Walters and Matthias Clasen.
---
 src/master-provider.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/master-provider.c b/src/master-provider.c
index c54919a..dd49ee7 100644
--- a/src/master-provider.c
+++ b/src/master-provider.c
@@ -126,6 +126,19 @@ copy_error (GError **target, GError *source)
 	}
 	if (source) {
 		*target = g_error_copy (source);
+
+		/* If the error type is a D-Bus remote exception,
+		 * don't lose the "magic" sauce after the message string.
+		 * See the code in gerror_to_dbus_error_message() in dbus-glib */
+		if (source->domain == DBUS_GERROR &&
+		    source->code == DBUS_GERROR_REMOTE_EXCEPTION) {
+			int len;
+			g_free ((*target)->message);
+			len = strlen (source->message);
+			len += strlen (source->message + len + 1);
+			len += 2;
+			(*target)->message = g_memdup (source->message, len);
+		}
 	}
 }
 
-- 
1.6.6



Index: geoclue.spec
===================================================================
RCS file: /cvs/pkgs/rpms/geoclue/F-12/geoclue.spec,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -p -r1.20 -r1.21
--- geoclue.spec	25 Nov 2009 00:22:47 -0000	1.20
+++ geoclue.spec	29 Jan 2010 12:51:11 -0000	1.21
@@ -9,7 +9,7 @@
 
 Name:           geoclue
 Version:        0.11.1.1
-Release:        0.10.%{snapshot}%{?dist}
+Release:        0.11.%{snapshot}%{?dist}
 Summary:        A modular geoinformation service
 
 Group:          System Environment/Libraries
@@ -19,6 +19,9 @@ URL:            http://geoclue.freedeskt
 Source0:        %{tarfile}
 Patch0:         geoclue-nm08.patch
 Patch1:         geoclue-fixgpsd.patch
+Patch2:         0001-Add-error-type-registration.patch
+# https://bugzilla.redhat.com/show_bug.cgi?id=528897#c15•
+Patch3:         0002-Don-t-lose-special-D-Bus-error-sauce-when-copying.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires: dbus-devel
@@ -104,6 +107,8 @@ A gsmloc provider for geoclue
 %setup -q
 %patch0 -p1 -b .nm08
 %patch1 -p1 -b .fixgpsd
+%patch2 -p1 -b .reg-errors
+%patch3 -p1 -b .error-sauce
 
 %build
 ./autogen.sh
@@ -191,6 +196,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_datadir}/dbus-1/services/org.freedesktop.Geoclue.Providers.Gsmloc.service
 
 %changelog
+* Fri Jan 29 2010 Bastien Nocera <bnocera at redhat.com> 0.11.1.1-0.11
+- Fix crashers in geoclue-master provider (#528897)
+
 * Mon Oct 24 2009 Peter Robinson <pbrobinson at gmail.com> 0.11.1.1-0.10
 - Rebuild for new NetworkManager
 



More information about the scm-commits mailing list