summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-06-21 06:18:00 +0100
committerSam James <sam@gentoo.org>2022-06-21 06:21:12 +0100
commit5cf9bcd40dcbf6774ee5bb3582655556a6747ab5 (patch)
tree30a7b9017a0db6d3ce91cd4e283a65b61dbcaeb6 /sys-libs/gpm
parentapp-admin/awscli: Bump to 1.25.13 (diff)
downloadgentoo-5cf9bcd40dcbf6774ee5bb3582655556a6747ab5.tar.gz
gentoo-5cf9bcd40dcbf6774ee5bb3582655556a6747ab5.tar.bz2
gentoo-5cf9bcd40dcbf6774ee5bb3582655556a6747ab5.zip
sys-libs/gpm: fix -Wformat-security; update systemd unit
Closes: https://bugs.gentoo.org/539320 Closes: https://bugs.gentoo.org/792822 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'sys-libs/gpm')
-rw-r--r--sys-libs/gpm/files/gpm-1.20.7-warnings.patch202
-rw-r--r--sys-libs/gpm/files/gpm.service-r111
-rw-r--r--sys-libs/gpm/gpm-1.20.7-r5.ebuild112
3 files changed, 325 insertions, 0 deletions
diff --git a/sys-libs/gpm/files/gpm-1.20.7-warnings.patch b/sys-libs/gpm/files/gpm-1.20.7-warnings.patch
new file mode 100644
index 000000000000..21838ee24bf5
--- /dev/null
+++ b/sys-libs/gpm/files/gpm-1.20.7-warnings.patch
@@ -0,0 +1,202 @@
+https://github.com/telmich/gpm/commit/dbd2e04665da885805a2c3e7dc2ee4b733d3c7cd
+https://github.com/telmich/gpm/pull/10
+https://bugs.gentoo.org/539320
+
+From 7d21d7f469d90c2d55b23926c866bba635aa7e6f Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sun, 14 Feb 2016 18:05:49 -0500
+Subject: [PATCH 1/5] report/oops: constify format strings
+
+--- a/src/headers/gpm.h
++++ b/src/headers/gpm.h
+@@ -280,10 +280,10 @@ int Gpm_GetSnapshot(Gpm_Event *ePtr);
+ char *Gpm_get_console( void );
+ int Gpm_x_high_y(int base, int pot_y);
+ int Gpm_cnt_digits(int number);
+-void gpm_oops(int line, char *file, char *text, ... );
++void gpm_oops(int line, const char *file, const char *text, ... );
+
+ /* report.c / report-lib.c */
+-void gpm_report(int line, char *file, int stat, char *text, ... );
++void gpm_report(int line, const char *file, int stat, const char *text, ... );
+
+ #ifdef __cplusplus
+ };
+--- a/src/headers/message.h
++++ b/src/headers/message.h
+@@ -226,7 +226,7 @@
+ /* #define GPM_MESS_ "" */
+
+ /* functions */
+-void gpm_report(int line, char *file, int stat, char *text, ... );
++void gpm_report(int line, const char *file, int stat, const char *text, ... );
+
+ /* rest of wd.h */
+ #ifdef HAVE_SYSLOG_H
+--- a/src/lib/report-lib.c
++++ b/src/lib/report-lib.c
+@@ -24,9 +24,9 @@
+
+ #include "headers/message.h"
+
+-void gpm_report(int line, char *file, int stat, char *text, ... )
++void gpm_report(int line, const char *file, int stat, const char *text, ... )
+ {
+- char *string = NULL;
++ const char *string = NULL;
+ int log_level;
+ va_list ap;
+
+--- a/src/prog/mouse-test.c
++++ b/src/prog/mouse-test.c
+@@ -182,7 +182,7 @@ Gpm_Type *(*I_serial)(int fd, unsigned short flags, struct Gpm_Type *type,
+ /*-----------------------------------------------------------------------------
+ Place the description here.
+ -----------------------------------------------------------------------------*/
+-int mousereopen(int oldfd, char *name, Gpm_Type *type)
++int mousereopen(int oldfd, const char *name, Gpm_Type *type)
+ {
+ int fd;
+ if (!type) type=mice+1; /* ms */
+--- a/src/report.c
++++ b/src/report.c
+@@ -69,7 +69,7 @@
+ *
+ */
+
+-void gpm_report(int line, char *file, int stat, char *text, ... )
++void gpm_report(int line, const char *file, int stat, const char *text, ...)
+ {
+ FILE *console = NULL;
+ va_list ap, ap3;
+
+From 7ba518ff8b5e5c06d0a74b1fecf3b682f14c631c Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sun, 14 Feb 2016 18:07:46 -0500
+Subject: [PATCH 2/5] report: avoid -Wformat-security warnings
+
+Some functions warn when you pass a string to a printf style function
+that is a dynamic buffer as its contents cannot be verified. Since we
+don't want to support that here, just use %s.
+--- a/src/lib/report-lib.c
++++ b/src/lib/report-lib.c
+@@ -47,7 +47,7 @@ void gpm_report(int line, const char *file, int stat, const char *text, ... )
+ log_level = LOG_CRIT; break;
+ }
+ #ifdef HAVE_VSYSLOG
+- syslog(log_level, string);
++ syslog(log_level, "%s", string);
+ vsyslog(log_level, text, ap);
+ #else
+ fprintf(stderr,"%s[%s(%d)]:\n",string,file,line);
+--- a/src/prog/mouse-test.c
++++ b/src/prog/mouse-test.c
+@@ -189,7 +189,7 @@ int mousereopen(int oldfd, const char *name, Gpm_Type *type)
+ close(oldfd);
+ usleep(100000);
+ fd=open(name,O_RDWR);
+- if (fd < 0) gpm_report(GPM_PR_OOPS,name);
++ if (fd < 0) gpm_report(GPM_PR_OOPS, "%s", name);
+ (*I_serial)(fd,type->flags,type,1,&type->name); /* ms initialization */
+ return fd;
+ }
+
+From c3717d54b67133fd14ce4f2166f61e529a1dcfe4 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sun, 14 Feb 2016 18:08:54 -0500
+Subject: [PATCH 3/5] update ignored file list
+
+--- a/.gitignore
++++ b/.gitignore
+@@ -11,6 +11,7 @@ Makefile
+ Makefile.include
+ /aclocal.m4
+ /autom4te.cache
++/config.cache
+ /config.log
+ /config.status
+ /configure
+@@ -29,7 +30,7 @@ Makefile.include
+ /src/gpm
+ /src/gpm2/tmp
+ /src/gpm2/out
+-/src/lib/libgpm.so.*
++/src/lib/libgpm.so*
+ /src/prog/disable-paste
+ /src/prog/display-buttons
+ /src/prog/display-coords
+
+From 01265c7ac5f86a02a7cec323f34a3b54e5973872 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sun, 14 Feb 2016 21:02:48 -0500
+Subject: [PATCH 4/5] report/oops: add attributes to mark as printf functions
+
+This allows gcc to do printf checking on calls to these funcs to make
+sure they're being called correctly.
+--- a/src/headers/gpm.h
++++ b/src/headers/gpm.h
+@@ -280,9 +280,15 @@ int Gpm_GetSnapshot(Gpm_Event *ePtr);
+ char *Gpm_get_console( void );
+ int Gpm_x_high_y(int base, int pot_y);
+ int Gpm_cnt_digits(int number);
++#ifdef __GNUC__
++__attribute__((__format__(printf, 3, 4)))
++#endif
+ void gpm_oops(int line, const char *file, const char *text, ... );
+
+ /* report.c / report-lib.c */
++#ifdef __GNUC__
++__attribute__((__format__(printf, 4, 5)))
++#endif
+ void gpm_report(int line, const char *file, int stat, const char *text, ... );
+
+ #ifdef __cplusplus
+--- a/src/headers/message.h
++++ b/src/headers/message.h
+@@ -226,6 +226,9 @@
+ /* #define GPM_MESS_ "" */
+
+ /* functions */
++#ifdef __GNUC__
++__attribute__((__format__(printf, 4, 5)))
++#endif
+ void gpm_report(int line, const char *file, int stat, const char *text, ... );
+
+ /* rest of wd.h */
+
+From 85b451a188cfc8aa6233df55ec0c5dfcd203786f Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sun, 14 Feb 2016 21:08:28 -0500
+Subject: [PATCH 5/5] clean up a few unused funcs/vars
+
+--- a/src/prog/gpm-root.y
++++ b/src/prog/gpm-root.y
+@@ -443,6 +443,7 @@ void f__fix(struct passwd *pass)
+ }
+
+ /*---------------------------------------------------------------------*/
++#if 0
+ static int f_debug_one(FILE *f, Draw *draw)
+ {
+ DrawItem *ip;
+@@ -465,6 +466,7 @@ static int f_debug_one(FILE *f, Draw *draw)
+ #undef LINE
+ return 0;
+ }
++#endif
+
+ int f_debug(int mode, DrawItem *self, int uid)
+ {
+@@ -960,10 +962,8 @@ static inline void scr_dump(int fd, FILE *f, unsigned char *buffer, int vc)
+ /*------------*/
+ static inline void scr_restore(int fd, FILE *f, unsigned char *buffer, int vc)
+ {
+- int x,y, dumpfd;
++ int dumpfd;
+ char dumpname[20];
+-
+- x=buffer[2]; y=buffer[3];
+
+ /* WILL NOT WORK WITH DEVFS! FIXME! */
+ sprintf(dumpname,"/dev/vcsa%i",vc);
+
diff --git a/sys-libs/gpm/files/gpm.service-r1 b/sys-libs/gpm/files/gpm.service-r1
new file mode 100644
index 000000000000..105649870aa0
--- /dev/null
+++ b/sys-libs/gpm/files/gpm.service-r1
@@ -0,0 +1,11 @@
+[Unit]
+Description=Console Mouse manager
+After=syslog.target
+
+[Service]
+ExecStart=/usr/sbin/gpm -m /dev/input/mice -t exps2
+Type=forking
+PIDFile=/run/gpm.pid
+
+[Install]
+WantedBy=multi-user.target
diff --git a/sys-libs/gpm/gpm-1.20.7-r5.ebuild b/sys-libs/gpm/gpm-1.20.7-r5.ebuild
new file mode 100644
index 000000000000..63d7c8b10fec
--- /dev/null
+++ b/sys-libs/gpm/gpm-1.20.7-r5.ebuild
@@ -0,0 +1,112 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools linux-info systemd usr-ldscript multilib-minimal
+
+DESCRIPTION="Console-based mouse driver"
+HOMEPAGE="https://www.nico.schottelius.org/software/gpm/"
+SRC_URI="
+ https://www.nico.schottelius.org/software/${PN}/archives/${P}.tar.lzma
+ mirror://gentoo/${P}-docs.patch.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+IUSE="selinux"
+
+RDEPEND="
+ sys-libs/ncurses:=[${MULTILIB_USEDEP}]
+ selinux? ( sec-policy/selinux-gpm )"
+DEPEND="${RDEPEND}"
+BDEPEND="
+ app-arch/xz-utils
+ sys-apps/texinfo
+ virtual/yacc"
+
+CONFIG_CHECK="~INPUT_MOUSEDEV"
+ERROR_INPUT_MOUSEDEV="CONFIG_INPUT_MOUSEDEV:\tis not set (required to expose mice for GPM)"
+
+pkg_pretend() {
+ check_extra_config
+}
+
+src_prepare() {
+ eapply "${FILESDIR}"/${P}-sysmacros.patch
+
+ # Hack up the docs until we get this sorted upstream.
+ # https://github.com/telmich/gpm/issues/8
+ eapply "${WORKDIR}"/${P}-docs.patch
+ touch -r . doc/* || die
+
+ # bug #629774
+ eapply "${FILESDIR}"/${P}-glibc-2.26.patch
+ # bug #705878
+ eapply "${FILESDIR}"/${P}-gcc-10.patch
+ # bug #829581
+ eapply "${FILESDIR}"/${P}-musl.patch
+ #
+ eapply "${FILESDIR}"/${P}-gcc-include.patch
+ eapply "${FILESDIR}"/${P}-signedness.patch
+ eapply "${FILESDIR}"/${P}-warnings.patch
+
+ eapply_user
+
+ # Fix ABI values
+ sed -i \
+ -e '/^abi_lev=/s:=.*:=1:' \
+ -e '/^abi_age=/s:=.*:=20:' \
+ configure.ac.footer || die
+ # Rebuild autotools since release doesn't include them.
+ # Should be fixed with the next release though.
+ # https://github.com/telmich/gpm/pull/15
+ sed -i -e '/ACLOCAL/,$d' autogen.sh || die
+ ./autogen.sh
+ eautoreconf
+
+ # Out-of-tree builds are broken.
+ # https://github.com/telmich/gpm/issues/16
+ multilib_copy_sources
+}
+
+multilib_src_configure() {
+ # emacs support disabled due to bug #99533, bug #335900
+ econf \
+ --disable-static \
+ --sysconfdir="${EPREFIX}"/etc/gpm \
+ emacs="${BROOT}"/bin/false
+}
+
+_emake() {
+ emake \
+ EMACS=: ELISP="" \
+ $(multilib_is_native_abi || echo "PROG= ") \
+ "$@"
+}
+
+multilib_src_compile() {
+ _emake
+}
+
+multilib_src_test() {
+ _emake check
+}
+
+multilib_src_install() {
+ _emake DESTDIR="${D}" install
+
+ dosym libgpm.so.1 /usr/$(get_libdir)/libgpm.so
+ gen_usr_ldscript -a gpm
+}
+
+multilib_src_install_all() {
+ insinto /etc/gpm
+ doins conf/gpm-*.conf
+
+ dodoc README TODO doc/Announce doc/FAQ doc/README*
+
+ newinitd "${FILESDIR}"/gpm.rc6-2 gpm
+ newconfd "${FILESDIR}"/gpm.conf.d gpm
+ systemd_newunit "${FILESDIR}"/gpm.service-r1 gpm.service
+}