[packages/gypsy] - fix build with -Werror=format-security

hawk hawk at pld-linux.org
Wed Jan 24 23:24:19 CET 2018


commit 9b16adee23424cf5b58eb1d1332797342e6392d7
Author: Marcin Krol <hawk at tld-linux.org>
Date:   Wed Jan 24 22:22:49 2018 +0000

    - fix build with -Werror=format-security

 gypsy-format-security.patch | 108 ++++++++++++++++++++++++++++++++++++++++++++
 gypsy.spec                  |   6 ++-
 2 files changed, 112 insertions(+), 2 deletions(-)
---
diff --git a/gypsy.spec b/gypsy.spec
index 0118455..1c0ae49 100644
--- a/gypsy.spec
+++ b/gypsy.spec
@@ -4,7 +4,7 @@ Summary:	Gypsy - a GPS multiplexing daemon
 Summary(pl.UTF-8):	Gypsy - demon przełączający dostęp do GPS
 Name:		gypsy
 Version:	0.9
-Release:	5
+Release:	6
 License:	LGPL v2+ (library), GPL v2+ (daemon)
 Group:		Daemons
 Source0:	http://gypsy.freedesktop.org/releases/%{name}-%{version}.tar.gz
@@ -12,13 +12,14 @@ Source0:	http://gypsy.freedesktop.org/releases/%{name}-%{version}.tar.gz
 Patch0:		%{name}-link.patch
 Patch1:		%{name}-0.8-unusedvar.patch
 Patch2:		%{name}-glib.patch
+Patch3:		%{name}-format-security.patch
 URL:		http://gypsy.freedesktop.org/
 BuildRequires:	autoconf >= 2.59
 BuildRequires:	automake >= 1:1.9
 BuildRequires:	bluez-libs-devel
 BuildRequires:	dbus-devel
 BuildRequires:	dbus-glib-devel >= 0.60
-BuildRequires:	glib2-devel >= 1:2.0
+BuildRequires:	glib2-devel >= 1:2.18
 BuildRequires:	gtk-doc >= 1.6
 BuildRequires:	libtool
 BuildRequires:	libxslt-progs
@@ -92,6 +93,7 @@ Dokumentacja programisty do gypsy.
 %patch0 -p1
 %patch1 -p1
 %patch2 -p1
+%patch3 -p1
 
 %build
 %{__libtoolize}
diff --git a/gypsy-format-security.patch b/gypsy-format-security.patch
new file mode 100644
index 0000000..91ec63b
--- /dev/null
+++ b/gypsy-format-security.patch
@@ -0,0 +1,108 @@
+diff -urp gypsy-0.9.orig/configure.ac gypsy-0.9/configure.ac
+--- gypsy-0.9.orig/configure.ac	2012-08-28 11:19:35.000000000 +0000
++++ gypsy-0.9/configure.ac	2018-01-24 22:03:34.263371167 +0000
+@@ -58,7 +58,7 @@ AC_MSG_RESULT([$with_user])
+ AS_AC_EXPAND(LIBEXECDIR, $libexecdir)
+ AS_AC_EXPAND(DAEMON_USER, $with_user)
+ 
+-CFLAGS="$CFLAGS -g -Wall -Werror -Wno-format"
++CFLAGS="$CFLAGS -g -Wall -Werror"
+ 
+ GTK_DOC_CHECK([1.6])
+ # TODO: add --with-xsltproc argument to override PATH
+diff -urp gypsy-0.9.orig/src/gypsy-client.c gypsy-0.9/src/gypsy-client.c
+--- gypsy-0.9.orig/src/gypsy-client.c	2011-12-06 12:59:36.000000000 +0000
++++ gypsy-0.9/src/gypsy-client.c	2018-01-24 22:19:58.972312474 +0000
+@@ -401,7 +401,7 @@ garmin_init (GIOChannel *channel)
+ 
+ 	if (status != G_IO_STATUS_NORMAL) {
+ 		GYPSY_NOTE (CLIENT, "GARMIN: Error writing \"Private Set Mode\" packet:\n%s", g_strerror (errno));
+-		g_set_error (&error, GYPSY_ERROR, errno, g_strerror (errno));
++		g_set_error_literal (&error, GYPSY_ERROR, errno, g_strerror (errno));
+ 		return FALSE;
+ 	}
+ 
+@@ -428,7 +428,7 @@ garmin_init (GIOChannel *channel)
+ 
+ 	if (status != G_IO_STATUS_NORMAL) {
+ 		GYPSY_NOTE (CLIENT, "GARMIN: Error writing \"Start PVT Transfer\" packet:\n%s", g_strerror (errno));
+-		g_set_error (&error, GYPSY_ERROR, errno, g_strerror (errno));
++		g_set_error_literal (&error, GYPSY_ERROR, errno, g_strerror (errno));
+ 		return FALSE;
+ 	}
+ 
+@@ -505,7 +505,7 @@ gypsy_client_set_start_options (GypsyCli
+ 			guint rate;
+ 
+ 			if (priv->channel != NULL) {
+-				g_set_error (error, GYPSY_ERROR, 0, "Device already started");
++				g_set_error_literal (error, GYPSY_ERROR, 0, "Device already started");
+ 				g_list_free (keys);
+ 				return FALSE;
+ 			}
+@@ -593,7 +593,7 @@ gypsy_client_start (GypsyClient *client,
+ 
+ 		if (priv->fd == -1) {
+ 			g_warning ("Error opening device %s: %s", priv->device_path, g_strerror (errno));
+-			g_set_error (error, GYPSY_ERROR, errno, g_strerror (errno));
++			g_set_error_literal (error, GYPSY_ERROR, errno, g_strerror (errno));
+ 			return FALSE;
+ 		}
+ 
+@@ -602,7 +602,7 @@ gypsy_client_start (GypsyClient *client,
+ 
+ 			if (tcgetattr (priv->fd, &term) < 0) {
+ 				g_warning ("Error getting term: %s", g_strerror (errno));
+-				g_set_error (error, GYPSY_ERROR, errno, g_strerror (errno));
++				g_set_error_literal (error, GYPSY_ERROR, errno, g_strerror (errno));
+ 				return FALSE;
+ 			}
+ 
+@@ -612,7 +612,7 @@ gypsy_client_start (GypsyClient *client,
+ 
+ 			if (tcsetattr (priv->fd, TCSAFLUSH, &term) < 0) {
+ 				g_warning ("Error setting term: %s", g_strerror (errno));
+-				g_set_error (error, GYPSY_ERROR, errno, g_strerror (errno));
++				g_set_error_literal (error, GYPSY_ERROR, errno, g_strerror (errno));
+ 				return FALSE;
+ 			}
+ 		}
+@@ -653,7 +653,7 @@ gypsy_client_start (GypsyClient *client,
+ 
+ 	if (status != G_IO_STATUS_NORMAL) {
+ 		g_warning ("Error setting flags: %s", g_strerror (errno));
+-		g_set_error (error, GYPSY_ERROR, errno, g_strerror (errno));
++		g_set_error_literal (error, GYPSY_ERROR, errno, g_strerror (errno));
+ 		return FALSE;
+ 	}
+ 
+@@ -662,7 +662,7 @@ gypsy_client_start (GypsyClient *client,
+ 
+ 	if (status != G_IO_STATUS_NORMAL) {
+ 		g_warning ("Error setting encoding: %s", g_strerror (errno));
+-		g_set_error (error, GYPSY_ERROR, errno, g_strerror (errno));
++		g_set_error_literal (error, GYPSY_ERROR, errno, g_strerror (errno));
+ 		return FALSE;
+ 	}
+ 
+@@ -692,7 +692,7 @@ gypsy_client_start (GypsyClient *client,
+ 			}
+ 
+ 			g_warning ("Error connecting: %s", g_strerror (errno));
+-			g_set_error (error, GYPSY_ERROR, errno, g_strerror (errno));
++			g_set_error_literal (error, GYPSY_ERROR, errno, g_strerror (errno));
+ 
+ 			g_source_remove (priv->error_id);
+ 			priv->error_id = 0;
+diff -urp gypsy-0.9.orig/src/main.c gypsy-0.9/src/main.c
+--- gypsy-0.9.orig/src/main.c	2011-10-13 15:44:12.000000000 +0000
++++ gypsy-0.9/src/main.c	2018-01-24 22:09:15.024350856 +0000
+@@ -156,7 +156,7 @@ main (int    argc,
+ #if GLIB_CHECK_VERSION(2, 14, 0)
+ 		char *help;
+ 		help = g_option_context_get_help (context, TRUE, NULL);
+-		g_print (help);
++		g_print ("%s", help);
+ 		g_free (help);
+ #else
+ 		g_printerr ("Cannot parse arguments: %s\n", error->message);
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/gypsy.git/commitdiff/9b16adee23424cf5b58eb1d1332797342e6392d7



More information about the pld-cvs-commit mailing list