From 23d5ff6d725b3c8396a2a58f0324039968a1b009 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Poho=C5=99elsk=C3=BD?= Date: Fri, 11 Apr 2025 10:54:33 +0200 Subject: [PATCH] Fix range parsing Adds patch from this PR: https://github.com/cronie-crond/cronie/pull/200 Additionally this commit changes installation path for crond.service from /lib to /usr/lib: https://gitlab.com/redhat/centos-stream/rpms/cronie/-/commit/bd2576816fb80e2f4340b4b5066471c6d38b3978 Resolves: RHEL-83153 --- cronie.spec | 8 +++++--- fix-range-parsing.patch | 26 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 fix-range-parsing.patch diff --git a/cronie.spec b/cronie.spec index f646efa..62ec996 100644 --- a/cronie.spec +++ b/cronie.spec @@ -20,6 +20,9 @@ Patch: 0001-Do-not-leak-file-descriptors-in-backup_crontab.patch # https://github.com/cronie-crond/cronie/pull/161 Patch: re-introduce-the-test-for-existence-of-file.patch +# https://github.com/cronie-crond/cronie/pull/200 +Patch: fix-range-parsing.patch + Requires: dailyjobs %if %{with selinux} @@ -130,8 +133,7 @@ touch $RPM_BUILD_ROOT/var/spool/anacron/cron.monthly install -m 644 contrib/dailyjobs $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/dailyjobs # install systemd initscript -mkdir -p $RPM_BUILD_ROOT/lib/systemd/system/ -install -m 644 contrib/cronie.systemd $RPM_BUILD_ROOT/lib/systemd/system/crond.service +install -m 644 -D contrib/cronie.systemd $RPM_BUILD_ROOT/usr/lib/systemd/system/crond.service %post # run after an installation @@ -197,7 +199,7 @@ exit 0 %config(noreplace) %{_sysconfdir}/sysconfig/crond %config(noreplace,missingok) %{_sysconfdir}/cron.deny %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/cron.d/0hourly -%attr(0644,root,root) /lib/systemd/system/crond.service +%attr(0644,root,root) /usr/lib/systemd/system/crond.service %files anacron %{_sbindir}/anacron diff --git a/fix-range-parsing.patch b/fix-range-parsing.patch new file mode 100644 index 0000000..81e07c5 --- /dev/null +++ b/fix-range-parsing.patch @@ -0,0 +1,26 @@ +From d037042129eacdd9d7760d74437842ee5a2d116e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ond=C5=99ej=20Poho=C5=99elsk=C3=BD?= +Date: Tue, 11 Mar 2025 15:12:38 +0100 +Subject: [PATCH] get_range() fix range parsing for Sunday as 0 or 7 + +In fc8b0e5, we changed how the ranges are parsed. This created a +regression for parsing Sunday at the end of the range. This commit adds +the logic to correctly handle Sunday as the end of the range. +--- + src/entry.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/entry.c b/src/entry.c +index a2077e8..30bedb3 100644 +--- a/src/entry.c ++++ b/src/entry.c +@@ -642,6 +642,9 @@ get_range(bitstr_t * bits, int low, int high, const char *names[], + state = R_FINISH; + break; + } ++ if (low_ > high_ && high_ == 0) { ++ high_ = 7; ++ } + return (EOF); + + case R_RANDOM: