From patchwork Wed Nov 13 17:41:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adolf Belka X-Patchwork-Id: 8225 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mail01.haj.ipfire.org", Issuer "R11" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4XpVw76mLWz3wwx for ; Wed, 13 Nov 2024 17:41:59 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "E6" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4XpVw60W1Tz14R; Wed, 13 Nov 2024 17:41:58 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4XpVw55XHdz33rR; Wed, 13 Nov 2024 17:41:57 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mail01.haj.ipfire.org", Issuer "R11" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4XpVw32GjHz2xQ7 for ; Wed, 13 Nov 2024 17:41:55 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4XpVw14JsPzlg; Wed, 13 Nov 2024 17:41:53 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1731519713; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=MHlt3pG0TS/KZHQ1VC2ASw9u1miXcnrsGgEQ2Zmv4b4=; b=TpmRNP+Wijuv88YZcRCGWDEnKFvZQSrlRolhWnoxRbP1sHfAE3/7Asq0CcWFuewE2mSCJ/ uT366ybZ7v1uVUDA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1731519713; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=MHlt3pG0TS/KZHQ1VC2ASw9u1miXcnrsGgEQ2Zmv4b4=; b=O3j/zIba9cwzpg3YLmskWMiFWNeXZkyebWlLwkRNAYJHD2q1Nx1U7kmgdSFXdnvZlDpiQT 0UlnZmA8XOmjE89ngRgAIB3G9LUrtFBz3lhfP0GOFmD8DRCTf33Ec3DYc+VnO1eRgkTezL p3ypBYMq7qIooC3tHYbQjEaGLE6tDcNZxbXhZ/linLilQzjpFbmN8NPDicpFKyPq4y7I7D uMI22AaGxMzNmfiC9jt9ua6c4QiP6xaubCqpfefioK7NtB7oP56Tb60TSpsnvPHr47M6Bw In5EZsY05YxfwInM+flkkq6dRpY+pYy6Sj8lpZ43JRyQfLpak3pkUKB0yir9gQ== From: Adolf Belka To: development@lists.ipfire.org Subject: [PATCH] beep: Update to version 1.4.12 Date: Wed, 13 Nov 2024 18:41:47 +0100 Message-ID: <20241113174147.2632974-1-adolf.belka@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: ALJ4C6KQC6YRZWAEJ7MGOECG4RFKHJTM X-Message-ID-Hash: ALJ4C6KQC6YRZWAEJ7MGOECG4RFKHJTM X-MailFrom: adolf.belka@ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: - Update from version 1.3 (2010) to version 1.4.12 - The originator of beep released version 1.3 in 2010 but the last commit after that was in 2013. Since then nothing has happened. - Most of the patches used in IPFire with beep-1.3 were created by Hans Ulrich Niedermann and in 2019 he forked the original beep repository and has been doing updates since then. The last release was in 2022 and the last commit in April 2024. - This patch removes all the previous patches as they are built in to the current tarball. - Changelog 1.4.12 Document how to override and disable packaged udev rules. Changed the build system to be closer to the GNU makefile conventions, i.e. only one compiler/toolchain per build default installation is to prefix=/usr/local instead of prefix=/usr use GNU style docdir= instead of RPM spec file style pkgdocdir= etc. Still not using a configure script, though, as that is complex. The user writing a local.mk with some definitions covers everyone wanting to use the same settings across make invocations, though. 1.4.11 Install the contrib/morse/* scripts just like the failure-beeps. missed to be done in release 1.4.10 1.4.10 Rename CREDITS to CREDITS.md and CHANGELOG to NEWS.md and reformatted them to markdown. Fix some __VA_ARGS__ problems with some C language compiler options. contrib/morse/: Add both perl and tr+sed script options to have beep produce morse code by converting the output of the morse utility from the BSD Games package to a beep command line. If built without any drivers, running beep will now complain and abort instead of silently (pun intended) just not beeping. Stop using Travis CI. Use GitHub Actions workflows for CI instead. Skip test cases using PC speaker hardware if absent (e.g. on a VM) Improved documentation (e.g. alsamixer requirement, loading pcspkr) 1.4.9 Mention default values in the beep(1) man page and the beep --help output. 1.4.8 At build time, avoid error messages related to maybe building without git installed, or from a tarball instead of a git source tree. Improve issue-6-benchmark report to help people with solving issue #6. 1.4.7 Install contrib scripts for both successfully and failing sounding beeps as package documentation. Install man page uncompressed, so packagers can use their favoured compression format. 1.4.6 Use va_copy() macro in function with va_list parameter to avoid possible bug Use BEEP_LOG_LEVEL environment variable for default log level 1.4.4 Remove udev/rules.d/ and modprobe.d/ example files to force packagers to re-read PACKAGING.md and PERMISSIONS.md Rewritten PERMISSIONS.md and INSTALL.md, adapting README.md and PACKAGING.md and beep(1) (i.e. beep.1.in) for consistency Allow beep to run as non-root, even if SUDO_* env variables are present Fix newline escaping when generating beep-usage.c By default, use plain -g instead of -gstabs Ensure the gcc used actually supports the default flags in CFLAGS_gcc 1.4.3 Stop compiling with -fcf-protection in CFLAGS_gcc if the platform does not support it (such as the Raspberry Pi ARMs). 1.4.2 Improved beep(1) man page and --help output Cleaned signal handlers of all function calls Use beep driver infrastructure (console and evdev drivers) Abort on unhandled command line parameters Use nanosleep(2) instead of usleep(3) 1.4.1 Safer signal handlers (safe_error_exit() without global variables). Reduce accepted range of input numbers. 5 minute beeps should still be enough. 1.4.0 The beep-1.4.0 release tries to revive the beep software. There have been no commits to the former upstream since 2013, and with the two CVEs in 2018 that needed to change. Packagers beware: Please read PACKAGING.md for the very different (and much better) new way of device access. First and foremost, beep-1.4.0 fixes CVE-2018-0492 and CVE-2018-1000532. The beep command now by default tries /dev/input/by-path/platform-pcspkr-event-spkr which allows arbitrary users beep access by allowing those arbitrary users file write access. The procedures to do that are now well documented in INSTALL.md and PERMISSIONS.md. There is no need for setuid-root or sudo any more, and due to the experiences with the two 2018 CVEs, beep will even refuse to run when it detects being run setuid or via sudo. A few smaller things have also been changed. Quoting the CHANGELOG: Fix CVE-2018-1000532 External Control of File Name or Path vulnerability in --device option Fix CVE-2018-0492 race condition that allows local privilege escalation Make /dev/input/by-path/platform-pcspkr-event-spkr the default device to use as the system administrator can allow access to that without needing any priviledge escalation risks via setuid or sudo. Adapt --help output, beep.1 man page, README.md, INSTALL.md to reflect the new device use. Add basic suite of tests. Constrained a few integers to avoid integer overflows. Only issue fallback '\a' type beeps if that '\a' actually goes to a tty device which can actually beep Stop promoting floating point frequencies which no Kernel API can even use Signed-off-by: Adolf Belka Tested-by: Adolf Belka Reviewed-by: Michael Tremer --- config/rootfiles/common/beep | 12 ++ lfs/beep | 19 +-- src/patches/beep/0001-Fixed-Makefile.patch | 44 ------- .../beep/0002-Add-more-error-detection.patch | 44 ------- ...-catch-SIGTERM-for-stopping-the-beep.patch | 32 ----- ...all-more-user-and-packaging-friendly.patch | 85 ------------- ...ve-file-modification-time-on-install.patch | 32 ----- .../0007-Fix-identation-if-brace-error.patch | 41 ------ ...ly-CVE-2018-0492-from-Debian-package.patch | 117 ------------------ 9 files changed, 17 insertions(+), 409 deletions(-) delete mode 100644 src/patches/beep/0001-Fixed-Makefile.patch delete mode 100644 src/patches/beep/0002-Add-more-error-detection.patch delete mode 100644 src/patches/beep/0004-also-catch-SIGTERM-for-stopping-the-beep.patch delete mode 100644 src/patches/beep/0005-Make-build-install-more-user-and-packaging-friendly.patch delete mode 100644 src/patches/beep/0006-Preserve-file-modification-time-on-install.patch delete mode 100644 src/patches/beep/0007-Fix-identation-if-brace-error.patch delete mode 100644 src/patches/beep/0008-Apply-CVE-2018-0492-from-Debian-package.patch diff --git a/config/rootfiles/common/beep b/config/rootfiles/common/beep index a47db2767..d20101cd2 100644 --- a/config/rootfiles/common/beep +++ b/config/rootfiles/common/beep @@ -1 +1,13 @@ usr/bin/beep +#usr/share/doc/beep +#usr/share/doc/beep/COPYING +#usr/share/doc/beep/CREDITS.md +#usr/share/doc/beep/NEWS.md +#usr/share/doc/beep/PERMISSIONS.md +#usr/share/doc/beep/README.md +#usr/share/doc/beep/contrib +#usr/share/doc/beep/contrib/failure-beeps +#usr/share/doc/beep/contrib/morse2beep.pl +#usr/share/doc/beep/contrib/morse2beep.sed +#usr/share/doc/beep/contrib/success-beeps +#usr/share/man/man1/beep.1 diff --git a/lfs/beep b/lfs/beep index 8ab9774ab..6c3d50109 100644 --- a/lfs/beep +++ b/lfs/beep @@ -1,7 +1,7 @@ ############################################################################### # # # IPFire.org - A linux based firewall # -# Copyright (C) 2007-2018 IPFire Team # +# Copyright (C) 2007-2024 IPFire Team # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # @@ -24,7 +24,7 @@ include Config -VER = 1.3 +VER = 1.4.12 THISAPP = beep-$(VER) DL_FILE = $(THISAPP).tar.gz @@ -40,7 +40,7 @@ objects = $(DL_FILE) $(DL_FILE) = $(DL_FROM)/$(DL_FILE) -$(DL_FILE)_BLAKE2 = 4f9cf12f6983eeb53502fd85e5e1d428e1c1af481f8f424f6ae18cbe104462e8fdcc96670a72daa8a8a0d1430d00824d8795b4db53437e7bb7320cddfd84cfd3 +$(DL_FILE)_BLAKE2 = 06f21cf3c40389acca50e6e420af4e738b7484e096bb689345fedb37684b15733dbb38e8a5d0d360f23e020cebe9ba321984ee43f41b0ad980648414ddbb9375 install : $(TARGET) @@ -70,16 +70,7 @@ $(subst %,%_BLAKE2,$(objects)) : $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @$(PREBUILD) @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE) - - cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/beep/0001-Fixed-Makefile.patch - cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/beep/0002-Add-more-error-detection.patch - cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/beep/0004-also-catch-SIGTERM-for-stopping-the-beep.patch - cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/beep/0005-Make-build-install-more-user-and-packaging-friendly.patch - cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/beep/0006-Preserve-file-modification-time-on-install.patch - cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/beep/0007-Fix-identation-if-brace-error.patch - cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/beep/0008-Apply-CVE-2018-0492-from-Debian-package.patch - - cd $(DIR_APP) && make $(MAKETUNING) $(EXTRA_MAKE) - cd $(DIR_APP) && install -m 0755 beep /usr/bin + cd $(DIR_APP) && make $(MAKETUNING) $(EXTRA_MAKE) prefix=/usr + cd $(DIR_APP) && make prefix=/usr install @rm -rf $(DIR_APP) @$(POSTBUILD) diff --git a/src/patches/beep/0001-Fixed-Makefile.patch b/src/patches/beep/0001-Fixed-Makefile.patch deleted file mode 100644 index 6b35ab0a9..000000000 --- a/src/patches/beep/0001-Fixed-Makefile.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 8b32b8b088be1f29e8bfea57a97b9bfaa76ec8ee Mon Sep 17 00:00:00 2001 -From: Chris Wong -Date: Wed, 23 Nov 2011 10:39:53 +1300 -Subject: [PATCH] Fixed Makefile - -* Use /usr/share/man (see http://www.pathname.com/fhs/2.2/fhs-4.11.html#4.11.5) - -* Removed trailing spaces - -* Added optimization flag (must beep FAST!!!) ---- - Makefile | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/Makefile b/Makefile -index cc359c4..0f4f810 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,19 +1,19 @@ - CC=gcc --FLAGS=-Wall -+FLAGS=-Wall -O2 - EXEC_NAME=beep - INSTALL_DIR=/usr/bin - MAN_FILE=beep.1.gz --MAN_DIR=/usr/man/man1 -+MAN_DIR=/usr/share/man/man1 - - default : beep - --clean : -+clean : - rm ${EXEC_NAME} - - beep : beep.c - ${CC} ${FLAGS} -o ${EXEC_NAME} beep.c - --install : -+install : - cp ${EXEC_NAME} ${INSTALL_DIR} - # rm -f /usr/man/man1/beep.1.bz2 - cp ${MAN_FILE} ${MAN_DIR} --- -2.7.5 diff --git a/src/patches/beep/0002-Add-more-error-detection.patch b/src/patches/beep/0002-Add-more-error-detection.patch deleted file mode 100644 index 733af9b15..000000000 --- a/src/patches/beep/0002-Add-more-error-detection.patch +++ /dev/null @@ -1,44 +0,0 @@ -From d3aee6c489852108c91dc22abcacff364e9429f2 Mon Sep 17 00:00:00 2001 -From: Chris Wong -Date: Wed, 23 Nov 2011 11:34:55 +1300 -Subject: [PATCH] Add more error detection - ---- - beep.c | 15 +++++++++------ - 1 file changed, 9 insertions(+), 6 deletions(-) - -diff --git a/beep.c b/beep.c -index 452fc08..14fac3e 100644 ---- a/beep.c -+++ b/beep.c -@@ -98,11 +98,11 @@ char *console_device = NULL; - - - void do_beep(int freq) { -- if (console_type == BEEP_TYPE_CONSOLE) { -- if(ioctl(console_fd, KIOCSOUND, freq != 0 -- ? (int)(CLOCK_TICK_RATE/freq) -- : freq) < 0) { -- printf("\a"); /* Output the only beep we can, in an effort to fall back on usefulness */ -+ int period = (freq != 0 ? (int)(CLOCK_TICK_RATE/freq) : freq); -+ -+ if(console_type == BEEP_TYPE_CONSOLE) { -+ if(ioctl(console_fd, KIOCSOUND, period) < 0) { -+ putchar('\a'); /* Output the only beep we can, in an effort to fall back on usefulness */ - perror("ioctl"); - } - } else { -@@ -113,7 +113,10 @@ void do_beep(int freq) { - e.code = SND_TONE; - e.value = freq; - -- write(console_fd, &e, sizeof(struct input_event)); -+ if(write(console_fd, &e, sizeof(struct input_event)) < 0) { -+ putchar('\a'); /* See above */ -+ perror("write"); -+ } - } - } - --- -2.7.5 diff --git a/src/patches/beep/0004-also-catch-SIGTERM-for-stopping-the-beep.patch b/src/patches/beep/0004-also-catch-SIGTERM-for-stopping-the-beep.patch deleted file mode 100644 index c11061e6a..000000000 --- a/src/patches/beep/0004-also-catch-SIGTERM-for-stopping-the-beep.patch +++ /dev/null @@ -1,32 +0,0 @@ -From e1320c1da52ca92aa68b4224f9532982184fbe00 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?J=C3=A9r=C3=B4me?= -Date: Thu, 7 Feb 2013 12:54:53 +0100 -Subject: [PATCH] also catch SIGTERM for stopping the beep - -Signed-off-by: Gerfried Fuchs ---- - beep.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/beep.c b/beep.c -index 452fc08..9cb63bf 100644 ---- a/beep.c -+++ b/beep.c -@@ -130,6 +130,7 @@ void handle_signal(int signum) { - - switch(signum) { - case SIGINT: -+ case SIGTERM: - if(console_fd >= 0) { - /* Kill the sound, quit gracefully */ - do_beep(0); -@@ -324,6 +325,7 @@ int main(int argc, char **argv) { - parms->next = NULL; - - signal(SIGINT, handle_signal); -+ signal(SIGTERM, handle_signal); - parse_command_line(argc, argv, parms); - - /* this outermost while loop handles the possibility that -n/--new has been --- -2.7.5 diff --git a/src/patches/beep/0005-Make-build-install-more-user-and-packaging-friendly.patch b/src/patches/beep/0005-Make-build-install-more-user-and-packaging-friendly.patch deleted file mode 100644 index 9e2b481b3..000000000 --- a/src/patches/beep/0005-Make-build-install-more-user-and-packaging-friendly.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 947a7e332908dcba1c7e523fbdc927d39ee6adb1 Mon Sep 17 00:00:00 2001 -From: Hans Ulrich Niedermann -Date: Tue, 19 Nov 2013 23:40:50 +0100 -Subject: [PATCH] Make build/install more user and packaging friendly - -Make the build and install more user and packaging friendly -by introducing the following features in the Makefile: - - * Honor the $(CFLAGS) set when calling make. - - * Prefix all install locations with $(DESTDIR) for - easy package building. - - * Use GNU Makefile conventions for defining installation - directories. This means $(bindir) and $(man1dir) - instead of the former $(INSTALL_DIR) and $(MAN_DIR). - - * Use install(1) for installing files and directories - so that permissions can be set properly. - - * Stop "make clean" failing when it has nothing to do. - - * Add 'uninstall' make target. - - * Make 'install' target build executable if necessary. ---- - Makefile | 40 +++++++++++++++++++++++++++++----------- - 1 file changed, 29 insertions(+), 11 deletions(-) - -diff --git a/Makefile b/Makefile -index 0f4f810..942a7a5 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,19 +1,37 @@ - CC=gcc - FLAGS=-Wall -O2 -+ -+INSTALL=install -+ - EXEC_NAME=beep --INSTALL_DIR=/usr/bin - MAN_FILE=beep.1.gz --MAN_DIR=/usr/share/man/man1 - --default : beep -+# Use GNU makefile conventions for directory names with one notable -+# exception: prefix is not /usr/local in order to keep the default -+# installation location for beep. -+prefix=/usr -+exec_prefix=$(prefix) -+bindir=$(exec_prefix)/bin -+datarootdir=$(prefix)/share -+mandir=$(datarootdir)/man -+man1dir=$(mandir)/man1 -+ -+.PHONY: all -+all: $(EXEC_NAME) -+ -+.PHONY: clean -+clean: -+ rm -f $(EXEC_NAME) - --clean : -- rm ${EXEC_NAME} -+$(EXEC_NAME): beep.c -+ $(CC) $(FLAGS) $(CFLAGS) -o $(EXEC_NAME) beep.c - --beep : beep.c -- ${CC} ${FLAGS} -o ${EXEC_NAME} beep.c -+install: all -+ $(INSTALL) -m 0755 -d $(DESTDIR)$(bindir) -+ $(INSTALL) -m 0755 $(EXEC_NAME) $(DESTDIR)$(bindir)/ -+ $(INSTALL) -m 0755 -d $(DESTDIR)$(man1dir) -+ $(INSTALL) -m 0644 $(MAN_FILE) $(DESTDIR)$(man1dir)/ - --install : -- cp ${EXEC_NAME} ${INSTALL_DIR} -- # rm -f /usr/man/man1/beep.1.bz2 -- cp ${MAN_FILE} ${MAN_DIR} -+uninstall: -+ rm -f $(DESTDIR)$(bindir)/$(EXEC_NAME) -+ rm -f $(DESTDIR)$(man1dir)/$(MAN_FILE) --- -2.7.5 - diff --git a/src/patches/beep/0006-Preserve-file-modification-time-on-install.patch b/src/patches/beep/0006-Preserve-file-modification-time-on-install.patch deleted file mode 100644 index fe844e6f1..000000000 --- a/src/patches/beep/0006-Preserve-file-modification-time-on-install.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 4622dd15dc12dab47a0381a8a7188f0f0421e01d Mon Sep 17 00:00:00 2001 -From: Hans Ulrich Niedermann -Date: Wed, 20 Nov 2013 00:00:54 +0100 -Subject: [PATCH] Preserve file modification time on install - -Add -p option to install(1) invocation in order to preserve -the timestamps of the files being installed. ---- - Makefile | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/Makefile b/Makefile -index 942a7a5..290b8a4 100644 ---- a/Makefile -+++ b/Makefile -@@ -27,10 +27,10 @@ $(EXEC_NAME): beep.c - $(CC) $(FLAGS) $(CFLAGS) -o $(EXEC_NAME) beep.c - - install: all -- $(INSTALL) -m 0755 -d $(DESTDIR)$(bindir) -- $(INSTALL) -m 0755 $(EXEC_NAME) $(DESTDIR)$(bindir)/ -- $(INSTALL) -m 0755 -d $(DESTDIR)$(man1dir) -- $(INSTALL) -m 0644 $(MAN_FILE) $(DESTDIR)$(man1dir)/ -+ $(INSTALL) -m 0755 -d $(DESTDIR)$(bindir) -+ $(INSTALL) -m 0755 -p $(EXEC_NAME) $(DESTDIR)$(bindir)/ -+ $(INSTALL) -m 0755 -d $(DESTDIR)$(man1dir) -+ $(INSTALL) -m 0644 -p $(MAN_FILE) $(DESTDIR)$(man1dir)/ - - uninstall: - rm -f $(DESTDIR)$(bindir)/$(EXEC_NAME) --- -2.7.5 diff --git a/src/patches/beep/0007-Fix-identation-if-brace-error.patch b/src/patches/beep/0007-Fix-identation-if-brace-error.patch deleted file mode 100644 index 30ec41406..000000000 --- a/src/patches/beep/0007-Fix-identation-if-brace-error.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 35ba84dccb8fc8dc43cb3f575904a33ffa27e7b7 Mon Sep 17 00:00:00 2001 -From: Hans Ulrich Niedermann -Date: Tue, 3 Apr 2018 19:11:07 +0200 -Subject: [PATCH] Fix indentation/if brace error - -As beep.c is not Python, the code blocks must be defined by -using braces instead of just indenting them differently. - -Once we do that, the outcome of multiple -f parameters will -actually match what the warning message documents beep does: -Only the last -f value will be used. - -Many projects proscribe using braces everywhere, but this -change keeps the beep.c coding style of using braces only -when absolutely necessary. - -This issue was discovered by compiling with gcc 6. ---- - beep.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/beep.c b/beep.c -index 7da2e70..d46adc8 100644 ---- a/beep.c -+++ b/beep.c -@@ -194,11 +194,12 @@ void parse_command_line(int argc, char **argv, beep_parms_t *result) { - if(!sscanf(optarg, "%f", &argfreq) || (argfreq >= 20000 /* ack! */) || - (argfreq <= 0)) - usage_bail(argv[0]); -- else -+ else { - if (result->freq != 0) - fprintf(stderr, "WARNING: multiple -f values given, only last " - "one is used.\n"); - result->freq = argfreq; -+ } - break; - case 'l' : /* length */ - if(!sscanf(optarg, "%d", &argval) || (argval < 0)) --- -2.7.5 diff --git a/src/patches/beep/0008-Apply-CVE-2018-0492-from-Debian-package.patch b/src/patches/beep/0008-Apply-CVE-2018-0492-from-Debian-package.patch deleted file mode 100644 index ac1f0b514..000000000 --- a/src/patches/beep/0008-Apply-CVE-2018-0492-from-Debian-package.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 3b67473e16aaf2f83cb8ac18c13c9183a8e3c7b2 Mon Sep 17 00:00:00 2001 -From: Hans Ulrich Niedermann -Date: Tue, 3 Apr 2018 18:37:33 +0200 -Subject: [PATCH] Apply CVE-2018-0492.patch from Debian package - ---- - beep.c | 53 ++++++++++++++++++++++++----------------------------- - 1 file changed, 24 insertions(+), 29 deletions(-) - -diff --git a/beep.c b/beep.c -index d46adc8..f6781e8 100644 ---- a/beep.c -+++ b/beep.c -@@ -109,6 +109,7 @@ void do_beep(int freq) { - /* BEEP_TYPE_EVDEV */ - struct input_event e; - -+ memset(&e, 0, sizeof(e)); - e.type = EV_SND; - e.code = SND_TONE; - e.value = freq; -@@ -124,10 +125,6 @@ void do_beep(int freq) { - /* If we get interrupted, it would be nice to not leave the speaker beeping in - perpetuity. */ - void handle_signal(int signum) { -- -- if(console_device) -- free(console_device); -- - switch(signum) { - case SIGINT: - case SIGTERM: -@@ -258,7 +255,7 @@ void parse_command_line(int argc, char **argv, beep_parms_t *result) { - result->verbose = 1; - break; - case 'e' : /* also --device */ -- console_device = strdup(optarg); -+ console_device = optarg; - break; - case 'h' : /* notice that this is also --help */ - default : -@@ -277,26 +274,6 @@ void play_beep(beep_parms_t parms) { - "%d delay after) @ %.2f Hz\n", - parms.reps, parms.length, parms.delay, parms.end_delay, parms.freq); - -- /* try to snag the console */ -- if(console_device) -- console_fd = open(console_device, O_WRONLY); -- else -- if((console_fd = open("/dev/tty0", O_WRONLY)) == -1) -- console_fd = open("/dev/vc/0", O_WRONLY); -- -- if(console_fd == -1) { -- fprintf(stderr, "Could not open %s for writing\n", -- console_device != NULL ? console_device : "/dev/tty0 or /dev/vc/0"); -- printf("\a"); /* Output the only beep we can, in an effort to fall back on usefulness */ -- perror("open"); -- exit(1); -- } -- -- if (ioctl(console_fd, EVIOCGSND(0)) != -1) -- console_type = BEEP_TYPE_EVDEV; -- else -- console_type = BEEP_TYPE_CONSOLE; -- - /* Beep */ - for (i = 0; i < parms.reps; i++) { /* start beep */ - do_beep(parms.freq); -@@ -306,8 +283,6 @@ void play_beep(beep_parms_t parms) { - if(parms.end_delay || (i+1 < parms.reps)) - usleep(1000*parms.delay); /* wait... */ - } /* repeat. */ -- -- close(console_fd); - } - - -@@ -329,6 +304,26 @@ int main(int argc, char **argv) { - signal(SIGTERM, handle_signal); - parse_command_line(argc, argv, parms); - -+ /* try to snag the console */ -+ if(console_device) -+ console_fd = open(console_device, O_WRONLY); -+ else -+ if((console_fd = open("/dev/tty0", O_WRONLY)) == -1) -+ console_fd = open("/dev/vc/0", O_WRONLY); -+ -+ if(console_fd == -1) { -+ fprintf(stderr, "Could not open %s for writing\n", -+ console_device != NULL ? console_device : "/dev/tty0 or /dev/vc/0"); -+ printf("\a"); /* Output the only beep we can, in an effort to fall back on usefulness */ -+ perror("open"); -+ exit(1); -+ } -+ -+ if (ioctl(console_fd, EVIOCGSND(0)) != -1) -+ console_type = BEEP_TYPE_EVDEV; -+ else -+ console_type = BEEP_TYPE_CONSOLE; -+ - /* this outermost while loop handles the possibility that -n/--new has been - used, i.e. that we have multiple beeps specified. Each iteration will - play, then free() one parms instance. */ -@@ -366,8 +361,8 @@ int main(int argc, char **argv) { - parms = next; - } - -- if(console_device) -- free(console_device); -+ close(console_fd); -+ console_fd = -1; - - return EXIT_SUCCESS; - } --- -2.7.5