x11-libs/libgksu: fix build with format-security, bug #517614
authorGilles Dartiguelongue <eva@gentoo.org>
Sun, 3 Sep 2017 16:12:51 +0000 (18:12 +0200)
committerGilles Dartiguelongue <eva@gentoo.org>
Sun, 3 Sep 2017 16:15:32 +0000 (18:15 +0200)
Bump to EAPI=6. Fix .desktop file validation, bug #512364. Apply select Debian patches.

Closes: https://bugs.gentoo.org/show_bug.cgi?id=512364
Closes: https://bugs.gentoo.org/show_bug.cgi?id=517614

Package-Manager: Portage-2.3.8, Repoman-2.3.3

x11-libs/libgksu/files/libgksu-2.0.12-correct_colormap_get.patch [new file with mode: 0644]
x11-libs/libgksu/files/libgksu-2.0.12-desktop-validation.patch [new file with mode: 0644]
x11-libs/libgksu/files/libgksu-2.0.12-fix-make-3.82.patch
x11-libs/libgksu/files/libgksu-2.0.12-format_security.patch [new file with mode: 0644]
x11-libs/libgksu/files/libgksu-2.0.12-g_markup_escape_text_for_command.patch [new file with mode: 0644]
x11-libs/libgksu/files/libgksu-2.0.12-missing-libs.patch [new file with mode: 0644]
x11-libs/libgksu/files/libgksu-2.0.12-sudo_keep_env.patch [new file with mode: 0644]
x11-libs/libgksu/libgksu-2.0.12-r3.ebuild [new file with mode: 0644]

diff --git a/x11-libs/libgksu/files/libgksu-2.0.12-correct_colormap_get.patch b/x11-libs/libgksu/files/libgksu-2.0.12-correct_colormap_get.patch
new file mode 100644 (file)
index 0000000..5c34cae
--- /dev/null
@@ -0,0 +1,12 @@
+=== modified file 'libgksu/libgksu.c'
+--- a/libgksu/libgksu.c
++++ b/libgksu/libgksu.c
+@@ -426,7 +426,7 @@
+   attr.height = fadeout->area.height;
+   attr.wclass = GDK_INPUT_OUTPUT;
+   attr.visual = gdk_screen_get_system_visual (fadeout->screen);
+-  attr.colormap = gdk_screen_get_default_colormap (fadeout->screen);
++  attr.colormap = gdk_screen_get_system_colormap (fadeout->screen);
+   attr.override_redirect = TRUE;
+   attr_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP | GDK_WA_NOREDIR;
diff --git a/x11-libs/libgksu/files/libgksu-2.0.12-desktop-validation.patch b/x11-libs/libgksu/files/libgksu-2.0.12-desktop-validation.patch
new file mode 100644 (file)
index 0000000..15de910
--- /dev/null
@@ -0,0 +1,16 @@
+Fix validation
+
+--- a/gksu-properties/gksu-properties.desktop.in       2017-09-03 16:41:57.872594752 +0200
++++ b/gksu-properties/gksu-properties.desktop.in       2017-09-03 16:44:40.835919489 +0200
+@@ -3,9 +3,9 @@
+ _Name=Privilege granting
+ _Comment=Configure behavior of the privilege-granting tool
+ Exec=gksu-properties
+-Icon=gksu.png
++Icon=gksu
+ StartupNotify=true
+ Terminal=false
+ Type=Application
+-Categories=GNOME;GTK;Application;Settings;AdvancedSettings;
++Categories=GNOME;GTK;Settings;
+ OnlyShowIn=GNOME;XFCE;
index 0a7c5f142893e7e3f3e9c1f211172ed44c340e0c..05ff3e0b0ad0720b7219f5e83c9058b8cd61ba44 100644 (file)
@@ -1,5 +1,7 @@
---- Makefile.am-orig   2010-08-22 16:11:19.872577459 -0500
-+++ Makefile.am        2010-08-22 16:11:55.289599110 -0500
+Fix indentation of Makefile.am
+
+--- a/Makefile.am      2010-08-22 16:11:19.872577459 -0500
++++ b/Makefile.am      2010-08-22 16:11:55.289599110 -0500
 @@ -17,11 +17,11 @@
  
  if GCONF_SCHEMAS_INSTALL
diff --git a/x11-libs/libgksu/files/libgksu-2.0.12-format_security.patch b/x11-libs/libgksu/files/libgksu-2.0.12-format_security.patch
new file mode 100644 (file)
index 0000000..d39bbaf
--- /dev/null
@@ -0,0 +1,28 @@
+Description: Fix build failure with [-Werror=format-security]
+Author: Michael Biebl <biebl@debian.org>
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=643423
+
+Let chunk stripped due to Gentoo revert-forkpty patch.
+
+Index: libgksu-2.0.13~pre1/libgksu/libgksu.c
+===================================================================
+--- libgksu-2.0.13~pre1.orig/libgksu/libgksu.c 2011-12-07 11:01:18.351654566 +0100
++++ libgksu-2.0.13~pre1/libgksu/libgksu.c      2011-12-07 11:01:41.231654725 +0100
+@@ -1276,7 +1276,7 @@
+   context->dir = g_strdup (mkdtemp(template));
+   if (!context->dir)
+     {
+-      fprintf (stderr, strerror(errno));
++      fprintf (stderr, "%s", strerror(errno));
+       return FALSE;
+     }
+@@ -2247,7 +2247,7 @@
+                                         " %s"), converted_str, "gksu: waiting");
+             g_free (converted_str);
+-            g_set_error (error, gksu_quark, GKSU_ERROR_HELPER, emsg);
++            g_set_error_literal (error, gksu_quark, GKSU_ERROR_HELPER, emsg);
+             g_free (emsg);
+             if (context->debug)
diff --git a/x11-libs/libgksu/files/libgksu-2.0.12-g_markup_escape_text_for_command.patch b/x11-libs/libgksu/files/libgksu-2.0.12-g_markup_escape_text_for_command.patch
new file mode 100644 (file)
index 0000000..de3ab68
--- /dev/null
@@ -0,0 +1,21 @@
+Escape text for display in password prompt.
+
+From the Debian patch stack.
+
+--- a/libgksu/libgksu.c
++++ b/libgksu/libgksu.c
+@@ -994,12 +994,12 @@
+                                    "The application '%s' lets you "
+                                    "modify essential parts of your "
+                                    "system."),
+-                                 command);
++                                 g_markup_escape_text(command, -1));
+         else
+           msg = g_strdup_printf (_("<b><big>Enter your password to run "
+                                    "the application '%s' as user %s"
+                                    "</big></b>"),
+-                                 command, context->user);
++                                 g_markup_escape_text(command, -1), context->user);
+       }
+       else
+       {
diff --git a/x11-libs/libgksu/files/libgksu-2.0.12-missing-libs.patch b/x11-libs/libgksu/files/libgksu-2.0.12-missing-libs.patch
new file mode 100644 (file)
index 0000000..955f455
--- /dev/null
@@ -0,0 +1,22 @@
+Add missing libs to relevant targets
+
+--- a/configure.ac     2017-09-03 17:10:57.552216900 +0200
++++ b/configure.ac     2017-09-03 17:16:39.674036975 +0200
+@@ -4,7 +4,7 @@
+ AC_PREREQ(2.57)
+ AC_INIT(libgksu, 2.0.12, kov@debian.org)
+-AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
++AM_INIT_AUTOMAKE([foreign])
+ AC_CONFIG_SRCDIR(libgksu/libgksu.c)
+ AC_CONFIG_HEADERS(config.h)
+@@ -44,7 +44,7 @@
+ PKG_CHECK_MODULES(GKSU_PROPERTIES, [gtk+-2.0 >= 2.12, gconf-2.0])
+ PKG_CHECK_MODULES(GLIB, [glib-2.0 gthread-2.0])
+-PKG_CHECK_MODULES(GTK, [gtk+-2.0 gconf-2.0])
++PKG_CHECK_MODULES(GTK, [gtk+-2.0 gconf-2.0 x11])
+ # Checks for library functions.
+ ALL_LINGUAS="ca cs da de es eu fr hu it ko lt pl pt_BR ro ru sk sv nb nl th zh_CN"
diff --git a/x11-libs/libgksu/files/libgksu-2.0.12-sudo_keep_env.patch b/x11-libs/libgksu/files/libgksu-2.0.12-sudo_keep_env.patch
new file mode 100644 (file)
index 0000000..a51a162
--- /dev/null
@@ -0,0 +1,15 @@
+--- a/libgksu/libgksu.c
++++ b/libgksu/libgksu.c
+@@ -2704,6 +2704,12 @@
+       cmd[argcount] = g_strdup("-H");
+       argcount++;
+     }
++  else
++    {
++      /* Preserve the environment, if sudo will let us */
++      cmd[argcount] = g_strdup("-E");
++      argcount++;
++    }
+   /* Make sudo read from stdin */
+   cmd[argcount] = g_strdup("-S");
diff --git a/x11-libs/libgksu/libgksu-2.0.12-r3.ebuild b/x11-libs/libgksu/libgksu-2.0.12-r3.ebuild
new file mode 100644 (file)
index 0000000..0568909
--- /dev/null
@@ -0,0 +1,81 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+GNOME2_EAUTORECONF="yes"
+
+inherit gnome2
+
+DESCRIPTION="A library for integration of su into applications"
+HOMEPAGE="http://www.nongnu.org/gksu/"
+SRC_URI="https://people.debian.org/~kov/gksu/${P}.tar.gz"
+
+LICENSE="LGPL-2"
+SLOT="2"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"
+IUSE="nls static-libs"
+
+COMMON_DEPEND="
+       >=x11-libs/gtk+-2.12:2
+       x11-libs/libX11
+       >=gnome-base/gconf-2
+       gnome-base/libgnome-keyring
+       x11-libs/startup-notification
+       >=gnome-base/libgtop-2:2=
+       nls? ( >=sys-devel/gettext-0.14.1 )
+"
+DEPEND="${COMMON_DEPEND}
+       dev-util/gtk-doc-am
+       >=dev-util/intltool-0.35.5
+       virtual/pkgconfig
+"
+RDEPEND="${COMMON_DEPEND}
+       app-admin/sudo
+"
+
+PATCHES=(
+       # Fix compilation on bsd
+       "${FILESDIR}"/${PN}-2.0.0-fbsd.patch
+
+       # Fix wrong usage of LDFLAGS, bug #226837
+       "${FILESDIR}"/${PN}-2.0.7-libs.patch
+
+       # Use po/LINGUAS
+       "${FILESDIR}"/${PN}-2.0.7-polinguas.patch
+
+       # Don't forkpty; bug #298289
+       "${FILESDIR}"/${P}-revert-forkpty.patch
+
+       # Make this gmake-3.82 compliant, bug #333961
+       "${FILESDIR}"/${P}-fix-make-3.82.patch
+
+       # Do not build test programs that are never executed; also fixes bug
+       # #367397 (underlinking issues).
+       "${FILESDIR}"/${P}-notests.patch
+
+       # Fix automake-1.11.2 compatibility, bug #397411
+       "${FILESDIR}"/${P}-automake-1.11.2.patch
+       "${FILESDIR}"/${P}-missing-libs.patch
+
+       # Fix build with format-security, bug #517614
+       "${FILESDIR}"/${P}-format_security.patch
+
+       # Fix .desktop file validation, bug #512364
+       "${FILESDIR}"/${P}-desktop-validation.patch
+
+       # Collection of patches from Debian
+       "${FILESDIR}"/${P}-g_markup_escape_text_for_command.patch
+       "${FILESDIR}"/${P}-sudo_keep_env.patch
+       "${FILESDIR}"/${P}-correct_colormap_get.patch
+)
+
+src_prepare() {
+       sed -i -e 's:AM_CONFIG_HEADER:AC_CONFIG_HEADERS:' configure.ac || die #467026
+       gnome2_src_prepare
+}
+
+src_configure() {
+       gnome2_src_configure \
+               $(use_enable nls) \
+               $(use_enable static-libs static)
+}