commit:     e32382ec2a3ff09bfbf694d204c89ee9a66a6a8f
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Tue Aug  2 14:20:00 2016 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Tue Aug  2 14:20:15 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e32382ec

app-misc/pal: new revision fixing -Wformat-security warnings.

Gentoo-Bug: 521104

Package-Manager: portage-2.2.28

 .../pal/files/fix-Wformat-security-errors.patch    | 64 ++++++++++++++++++++++
 app-misc/pal/pal-0.4.3-r2.ebuild                   | 60 ++++++++++++++++++++
 2 files changed, 124 insertions(+)

diff --git a/app-misc/pal/files/fix-Wformat-security-errors.patch 
b/app-misc/pal/files/fix-Wformat-security-errors.patch
new file mode 100644
index 0000000..f1255d9
--- /dev/null
+++ b/app-misc/pal/files/fix-Wformat-security-errors.patch
@@ -0,0 +1,64 @@
+From 801804d5b1beca5f32dd78cd23e9f9e012ae0420 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <mich...@orlitzky.com>
+Date: Tue, 2 Aug 2016 10:07:39 -0400
+Subject: [PATCH 1/1] src/{input,output}.c: fix -Wformat-security errors.
+
+Newer versions of GCC have the ability to warn about insecure uses of
+format strings. These uses usually involve omitted "%s" format strings
+to the printf() family of functions, and when compiling with
+-Werror=format-security, they can cause the build to fail. This commit
+fixes a few such uses in input.c and output.c
+
+Gentoo-Bug: 521104
+---
+ src/input.c  | 4 ++--
+ src/output.c | 4 ++--
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/input.c b/src/input.c
+index 79db485..92bad36 100644
+--- a/src/input.c
++++ b/src/input.c
+@@ -463,7 +463,7 @@ static gboolean get_file_to_load(gchar* file, gchar* 
pal_file, gboolean show_err
+           return FALSE;
+       }
+       else
+-          sprintf(pal_file, file);
++          sprintf(pal_file, "%s", file);
+     }
+ 
+     else
+@@ -618,7 +618,7 @@ GHashTable* load_files()
+       FILE* pal_file_handle = NULL;
+ 
+       if(!get_file_to_load(settings->pal_file, pal_file, FALSE))
+-          sprintf(pal_file, settings->pal_file);
++          sprintf(pal_file, "%s", settings->pal_file);
+ 
+       pal_file_handle = get_file_handle(pal_file, TRUE);
+       if(pal_file_handle != NULL)
+diff --git a/src/output.c b/src/output.c
+index 97aaa0f..9806089 100644
+--- a/src/output.c
++++ b/src/output.c
+@@ -249,7 +249,7 @@ static void pal_output_text_week(GDate* date, gboolean 
force_month_label,
+               pal_output_fg(BRIGHT, color, utf8_buf);
+       }
+       else
+-          g_print(utf8_buf);
++          g_print("%s", utf8_buf);
+ 
+ 
+       if(g_date_compare(date,today) == 0)     /* make today bright */
+@@ -270,7 +270,7 @@ static void pal_output_text_week(GDate* date, gboolean 
force_month_label,
+ 
+       }
+       else
+-          g_print(utf8_buf);
++          g_print("%s", utf8_buf);
+ 
+ 
+       /* print extra space between days */
+-- 
+2.7.3
+

diff --git a/app-misc/pal/pal-0.4.3-r2.ebuild b/app-misc/pal/pal-0.4.3-r2.ebuild
new file mode 100644
index 0000000..f3c7309
--- /dev/null
+++ b/app-misc/pal/pal-0.4.3-r2.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+inherit prefix toolchain-funcs
+
+DESCRIPTION="Command-line calendar program"
+HOMEPAGE="http://palcal.sourceforge.net/";
+SRC_URI="mirror://sourceforge/palcal/${P}.tgz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~hppa ~ppc ~x86 ~x86-interix ~amd64-linux ~x86-linux 
~x86-macos"
+IUSE="nls"
+
+RDEPEND="
+       >=dev-libs/glib-2.0
+       nls? ( virtual/libintl )
+       sys-libs/ncurses:0
+       sys-libs/readline:0
+"
+DEPEND="
+       ${RDEPEND}
+       nls? ( sys-devel/gettext )
+       virtual/pkgconfig
+"
+
+PATCHES=(
+       "${FILESDIR}"/${PV}-strip.patch
+       "${FILESDIR}"/${PV}-ldflags.patch
+       "${FILESDIR}"/${P}-pkg_config.patch
+       "${FILESDIR}"/${P}-prefix.patch
+       "${FILESDIR}"/fix-Wformat-security-errors.patch
+)
+
+src_prepare() {
+       default
+
+       cd src || die "failed to change to the src directory"
+       eprefixify Makefile.defs input.c Makefile
+       sed -i -e 's/ -o root//g' {.,convert}/Makefile || die
+       tc-export PKG_CONFIG
+}
+
+src_compile() {
+       cd src || die "failed to change to the src directory"
+       emake CC="$(tc-getCC)" OPT="${CFLAGS}" LDOPT="${LDFLAGS}"
+}
+
+src_install() {
+       dodoc ChangeLog doc/example.css
+
+       cd src || die "failed to change to the src directory"
+       emake DESTDIR="${D}" install-man install-bin install-share
+
+       if use nls; then
+               emake DESTDIR="${D}" install-mo
+       fi
+}

Reply via email to