From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id DBBA7158091 for ; Tue, 7 Jun 2022 01:31:29 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0FB5DE08AD; Tue, 7 Jun 2022 01:31:29 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (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 pigeon.gentoo.org (Postfix) with ESMTPS id E2414E08AD for ; Tue, 7 Jun 2022 01:31:28 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 53FB0341887 for ; Tue, 7 Jun 2022 01:31:27 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id C7F4944E for ; Tue, 7 Jun 2022 01:31:25 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1654565445.f22a1ea1d23806ba35b1fe2b4c7772819d1bb776.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: app-admin/logrotate/files/, app-admin/logrotate/ X-VCS-Repository: repo/gentoo X-VCS-Files: app-admin/logrotate/files/logrotate-3.20.1-log-changes.patch app-admin/logrotate/logrotate-3.20.1-r1.ebuild X-VCS-Directories: app-admin/logrotate/files/ app-admin/logrotate/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: f22a1ea1d23806ba35b1fe2b4c7772819d1bb776 X-VCS-Branch: master Date: Tue, 7 Jun 2022 01:31:25 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: a77aeb19-7bc2-4de6-b847-cc5e2254108a X-Archives-Hash: 5af01c2a34edf08fb866352b7999a770 commit: f22a1ea1d23806ba35b1fe2b4c7772819d1bb776 Author: Sam James gentoo org> AuthorDate: Tue Jun 7 01:30:45 2022 +0000 Commit: Sam James gentoo org> CommitDate: Tue Jun 7 01:30:45 2022 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f22a1ea1 app-admin/logrotate: backport log setting tweaks Should make things a bit less noisy w/ recent CVE fix. Bug: https://bugs.gentoo.org/847382 Signed-off-by: Sam James gentoo.org> .../files/logrotate-3.20.1-log-changes.patch | 147 +++++++++++++++++++++ app-admin/logrotate/logrotate-3.20.1-r1.ebuild | 96 ++++++++++++++ 2 files changed, 243 insertions(+) diff --git a/app-admin/logrotate/files/logrotate-3.20.1-log-changes.patch b/app-admin/logrotate/files/logrotate-3.20.1-log-changes.patch new file mode 100644 index 000000000000..b7c4bb5275db --- /dev/null +++ b/app-admin/logrotate/files/logrotate-3.20.1-log-changes.patch @@ -0,0 +1,147 @@ +https://bugs.gentoo.org/847382#c3 +https://github.com/logrotate/logrotate/commit/31cf1099ab8514dfcae5a980bc77352edd5292f8 +https://github.com/logrotate/logrotate/commit/7b1fa328bf70eb8434166f151bd075cd1440d0dc + +From 31cf1099ab8514dfcae5a980bc77352edd5292f8 Mon Sep 17 00:00:00 2001 +From: Kamil Dudka +Date: Fri, 27 May 2022 09:56:07 +0200 +Subject: [PATCH] lockState: do not print `error:` when exit code is unaffected + +Closes: https://github.com/logrotate/logrotate/pull/448 +--- a/logrotate.c ++++ b/logrotate.c +@@ -3050,8 +3050,8 @@ static int lockState(const char *stateFilename, int skip_state_lock) + } + + if (sb.st_mode & S_IROTH) { +- message(MESS_ERROR, "state file %s is world-readable and thus can" +- " be locked from other unprivileged users." ++ message(MESS_NORMAL, "warning: state file %s is world-readable" ++ " and thus can be locked from other unprivileged users." + " Skipping lock acquisition...\n", + stateFilename); + close(lockFd); + +From 7b1fa328bf70eb8434166f151bd075cd1440d0dc Mon Sep 17 00:00:00 2001 +From: Kamil Dudka +Date: Fri, 27 May 2022 16:02:57 +0200 +Subject: [PATCH] log: unify handling of log levels + +Use MESS_WARN instead of MESS_NORMAL and make it always use +the `warning:` prefix. MESS_WARN is now mapped to LOG_WARNING +for syslog. + +Also drop MESS_VERBOSE, which was not set anywhere. + +Closes: https://github.com/logrotate/logrotate/pull/239 +Closes: https://github.com/logrotate/logrotate/pull/449 +--- a/config.c ++++ b/config.c +@@ -643,7 +643,7 @@ static void set_criterium(enum criterium *pDst, enum criterium src, int *pSet) + { + if (*pSet && (*pDst != src)) { + /* we are overriding a previously set criterium */ +- message(MESS_VERBOSE, "warning: '%s' overrides previously specified '%s'\n", ++ message(MESS_DEBUG, "note: '%s' overrides previously specified '%s'\n", + crit_to_string(src), crit_to_string(*pDst)); + } + *pDst = src; +@@ -1021,7 +1021,7 @@ static int readConfigFile(const char *configFile, struct logInfo *defConfig) + + if (getuid() == ROOT_UID) { + if ((sb_config.st_mode & 07533) != 0400) { +- message(MESS_NORMAL, ++ message(MESS_WARN, + "Potentially dangerous mode on %s: 0%o\n", + configFile, (unsigned) (sb_config.st_mode & 07777)); + } +@@ -1386,7 +1386,7 @@ static int readConfigFile(const char *configFile, struct logInfo *defConfig) + RAISE_ERROR(); + } + } else if (!strcmp(key, "errors")) { +- message(MESS_NORMAL, ++ message(MESS_WARN, + "%s: %d: the errors directive is deprecated and no longer used.\n", + configFile, lineNum); + } else if (!strcmp(key, "mail")) { +--- a/log.c ++++ b/log.c +@@ -40,9 +40,12 @@ static void log_once(FILE *where, int level, const char *format, va_list args) + { + switch (level) { + case MESS_DEBUG: +- case MESS_NORMAL: +- case MESS_VERBOSE: + break; ++ ++ case MESS_WARN: ++ fprintf(where, "warning: "); ++ break; ++ + default: + fprintf(where, "error: "); + break; +@@ -78,10 +81,11 @@ void message(int level, const char *format, ...) + priority |= LOG_DEBUG; + break; + case MESS_DEBUG: +- case MESS_VERBOSE: +- case MESS_NORMAL: + priority |= LOG_INFO; + break; ++ case MESS_WARN: ++ priority |= LOG_WARNING; ++ break; + case MESS_ERROR: + priority |= LOG_ERR; + break; +--- a/log.h ++++ b/log.h +@@ -5,8 +5,7 @@ + + #define MESS_REALDEBUG 1 + #define MESS_DEBUG 2 +-#define MESS_VERBOSE 3 +-#define MESS_NORMAL 4 ++#define MESS_WARN 4 + #define MESS_ERROR 5 + #define MESS_FATAL 6 + +--- a/logrotate.c ++++ b/logrotate.c +@@ -3050,7 +3050,7 @@ static int lockState(const char *stateFilename, int skip_state_lock) + } + + if (sb.st_mode & S_IROTH) { +- message(MESS_NORMAL, "warning: state file %s is world-readable" ++ message(MESS_WARN, "state file %s is world-readable" + " and thus can be locked from other unprivileged users." + " Skipping lock acquisition...\n", + stateFilename); +@@ -3106,7 +3106,7 @@ int main(int argc, const char **argv) + POPT_AUTOHELP { NULL, 0, 0, NULL, 0, NULL, NULL } + }; + +- logSetLevel(MESS_NORMAL); ++ logSetLevel(MESS_WARN); + setlocale (LC_ALL, ""); + + optCon = poptGetContext("logrotate", argc, argv, options, 0); +@@ -3117,7 +3117,7 @@ int main(int argc, const char **argv) + switch (arg) { + case 'd': + debug = 1; +- message(MESS_NORMAL, "WARNING: logrotate in debug mode does nothing" ++ message(MESS_WARN, "logrotate in debug mode does nothing" + " except printing debug messages! Consider using verbose" + " mode (-v) instead if this is not what you want.\n\n"); + /* fallthrough */ +--- a/test/test-0080.sh ++++ b/test/test-0080.sh +@@ -10,4 +10,4 @@ cleanup 80 + preptest test.log 80 1 0 + + $RLR -d test-config.80 2>&1 | \ +- grep -q "warning: 'daily' overrides previously specified 'size'" ++ grep -q "note: 'daily' overrides previously specified 'size'" + diff --git a/app-admin/logrotate/logrotate-3.20.1-r1.ebuild b/app-admin/logrotate/logrotate-3.20.1-r1.ebuild new file mode 100644 index 000000000000..9023bd91b43b --- /dev/null +++ b/app-admin/logrotate/logrotate-3.20.1-r1.ebuild @@ -0,0 +1,96 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/kamildudka.asc +inherit systemd tmpfiles verify-sig + +DESCRIPTION="Rotates, compresses, and mails system logs" +HOMEPAGE="https://github.com/logrotate/logrotate" +SRC_URI="https://github.com/${PN}/${PN}/releases/download/${PV}/${P}.tar.xz" +SRC_URI+=" verify-sig? ( https://github.com/${PN}/${PN}/releases/download/${PV}/${P}.tar.xz.asc )" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" +IUSE="acl +cron selinux" + +DEPEND=">=dev-libs/popt-1.5 + selinux? ( sys-libs/libselinux ) + acl? ( virtual/acl )" +RDEPEND="${DEPEND} + selinux? ( sec-policy/selinux-logrotate ) + cron? ( virtual/cron )" +BDEPEND="verify-sig? ( sec-keys/openpgp-keys-kamildudka )" + +STATEFILE="${EPREFIX}/var/lib/misc/logrotate.status" +OLDSTATEFILE="${EPREFIX}/var/lib/logrotate.status" + +PATCHES=( + "${FILESDIR}"/${PN}-3.15.0-ignore-hidden.patch + "${FILESDIR}"/${P}-log-changes.patch +) + +move_old_state_file() { + elog "logrotate state file is now located at ${STATEFILE}" + elog "See bug #357275" + if [[ -e "${OLDSTATEFILE}" ]] ; then + elog "Moving your current state file to new location: ${STATEFILE}" + mv -n "${OLDSTATEFILE}" "${STATEFILE}" || die + fi +} + +install_cron_file() { + exeinto /etc/cron.daily + newexe "${S}"/examples/logrotate.cron "${PN}" +} + +src_prepare() { + default + + sed -i -e 's#/usr/sbin/logrotate#/usr/bin/logrotate#' examples/logrotate.{cron,service} || die +} + +src_configure() { + econf \ + $(use_with acl) \ + $(use_with selinux) \ + --with-state-file-path="${STATEFILE}" +} + +src_install() { + dobin logrotate + doman logrotate.8 + dodoc ChangeLog.md + + insinto /etc + doins "${FILESDIR}"/logrotate.conf + + use cron && install_cron_file + + systemd_dounit examples/logrotate.{service,timer} + newtmpfiles "${FILESDIR}"/${PN}.tmpfiles ${PN}.conf + + keepdir /etc/logrotate.d +} + +pkg_postinst() { + elog + elog "The ${PN} binary is now installed under /usr/bin. Please" + elog "update your links" + elog + + move_old_state_file + + tmpfiles_process ${PN}.conf + + if [[ -z ${REPLACING_VERSIONS} ]] ; then + elog "If you wish to have logrotate e-mail you updates, please" + elog "emerge virtual/mailx and configure logrotate in" + elog "/etc/logrotate.conf appropriately" + elog + elog "Additionally, /etc/logrotate.conf may need to be modified" + elog "for your particular needs. See man logrotate for details." + fi +}