Gentoo Archives: gentoo-commits

From: Michael Orlitzky <mjo@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-misc/pal/, app-misc/pal/files/
Date: Tue, 02 Aug 2016 14:21:54
Message-Id: 1470147615.e32382ec2a3ff09bfbf694d204c89ee9a66a6a8f.mjo@gentoo
1 commit: e32382ec2a3ff09bfbf694d204c89ee9a66a6a8f
2 Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
3 AuthorDate: Tue Aug 2 14:20:00 2016 +0000
4 Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
5 CommitDate: Tue Aug 2 14:20:15 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e32382ec
7
8 app-misc/pal: new revision fixing -Wformat-security warnings.
9
10 Gentoo-Bug: 521104
11
12 Package-Manager: portage-2.2.28
13
14 .../pal/files/fix-Wformat-security-errors.patch | 64 ++++++++++++++++++++++
15 app-misc/pal/pal-0.4.3-r2.ebuild | 60 ++++++++++++++++++++
16 2 files changed, 124 insertions(+)
17
18 diff --git a/app-misc/pal/files/fix-Wformat-security-errors.patch b/app-misc/pal/files/fix-Wformat-security-errors.patch
19 new file mode 100644
20 index 0000000..f1255d9
21 --- /dev/null
22 +++ b/app-misc/pal/files/fix-Wformat-security-errors.patch
23 @@ -0,0 +1,64 @@
24 +From 801804d5b1beca5f32dd78cd23e9f9e012ae0420 Mon Sep 17 00:00:00 2001
25 +From: Michael Orlitzky <michael@××××××××.com>
26 +Date: Tue, 2 Aug 2016 10:07:39 -0400
27 +Subject: [PATCH 1/1] src/{input,output}.c: fix -Wformat-security errors.
28 +
29 +Newer versions of GCC have the ability to warn about insecure uses of
30 +format strings. These uses usually involve omitted "%s" format strings
31 +to the printf() family of functions, and when compiling with
32 +-Werror=format-security, they can cause the build to fail. This commit
33 +fixes a few such uses in input.c and output.c
34 +
35 +Gentoo-Bug: 521104
36 +---
37 + src/input.c | 4 ++--
38 + src/output.c | 4 ++--
39 + 2 files changed, 4 insertions(+), 4 deletions(-)
40 +
41 +diff --git a/src/input.c b/src/input.c
42 +index 79db485..92bad36 100644
43 +--- a/src/input.c
44 ++++ b/src/input.c
45 +@@ -463,7 +463,7 @@ static gboolean get_file_to_load(gchar* file, gchar* pal_file, gboolean show_err
46 + return FALSE;
47 + }
48 + else
49 +- sprintf(pal_file, file);
50 ++ sprintf(pal_file, "%s", file);
51 + }
52 +
53 + else
54 +@@ -618,7 +618,7 @@ GHashTable* load_files()
55 + FILE* pal_file_handle = NULL;
56 +
57 + if(!get_file_to_load(settings->pal_file, pal_file, FALSE))
58 +- sprintf(pal_file, settings->pal_file);
59 ++ sprintf(pal_file, "%s", settings->pal_file);
60 +
61 + pal_file_handle = get_file_handle(pal_file, TRUE);
62 + if(pal_file_handle != NULL)
63 +diff --git a/src/output.c b/src/output.c
64 +index 97aaa0f..9806089 100644
65 +--- a/src/output.c
66 ++++ b/src/output.c
67 +@@ -249,7 +249,7 @@ static void pal_output_text_week(GDate* date, gboolean force_month_label,
68 + pal_output_fg(BRIGHT, color, utf8_buf);
69 + }
70 + else
71 +- g_print(utf8_buf);
72 ++ g_print("%s", utf8_buf);
73 +
74 +
75 + if(g_date_compare(date,today) == 0) /* make today bright */
76 +@@ -270,7 +270,7 @@ static void pal_output_text_week(GDate* date, gboolean force_month_label,
77 +
78 + }
79 + else
80 +- g_print(utf8_buf);
81 ++ g_print("%s", utf8_buf);
82 +
83 +
84 + /* print extra space between days */
85 +--
86 +2.7.3
87 +
88
89 diff --git a/app-misc/pal/pal-0.4.3-r2.ebuild b/app-misc/pal/pal-0.4.3-r2.ebuild
90 new file mode 100644
91 index 0000000..f3c7309
92 --- /dev/null
93 +++ b/app-misc/pal/pal-0.4.3-r2.ebuild
94 @@ -0,0 +1,60 @@
95 +# Copyright 1999-2016 Gentoo Foundation
96 +# Distributed under the terms of the GNU General Public License v2
97 +# $Id$
98 +
99 +EAPI=6
100 +inherit prefix toolchain-funcs
101 +
102 +DESCRIPTION="Command-line calendar program"
103 +HOMEPAGE="http://palcal.sourceforge.net/"
104 +SRC_URI="mirror://sourceforge/palcal/${P}.tgz"
105 +
106 +LICENSE="GPL-2"
107 +SLOT="0"
108 +KEYWORDS="~amd64 ~hppa ~ppc ~x86 ~x86-interix ~amd64-linux ~x86-linux ~x86-macos"
109 +IUSE="nls"
110 +
111 +RDEPEND="
112 + >=dev-libs/glib-2.0
113 + nls? ( virtual/libintl )
114 + sys-libs/ncurses:0
115 + sys-libs/readline:0
116 +"
117 +DEPEND="
118 + ${RDEPEND}
119 + nls? ( sys-devel/gettext )
120 + virtual/pkgconfig
121 +"
122 +
123 +PATCHES=(
124 + "${FILESDIR}"/${PV}-strip.patch
125 + "${FILESDIR}"/${PV}-ldflags.patch
126 + "${FILESDIR}"/${P}-pkg_config.patch
127 + "${FILESDIR}"/${P}-prefix.patch
128 + "${FILESDIR}"/fix-Wformat-security-errors.patch
129 +)
130 +
131 +src_prepare() {
132 + default
133 +
134 + cd src || die "failed to change to the src directory"
135 + eprefixify Makefile.defs input.c Makefile
136 + sed -i -e 's/ -o root//g' {.,convert}/Makefile || die
137 + tc-export PKG_CONFIG
138 +}
139 +
140 +src_compile() {
141 + cd src || die "failed to change to the src directory"
142 + emake CC="$(tc-getCC)" OPT="${CFLAGS}" LDOPT="${LDFLAGS}"
143 +}
144 +
145 +src_install() {
146 + dodoc ChangeLog doc/example.css
147 +
148 + cd src || die "failed to change to the src directory"
149 + emake DESTDIR="${D}" install-man install-bin install-share
150 +
151 + if use nls; then
152 + emake DESTDIR="${D}" install-mo
153 + fi
154 +}