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:
bd2576816f

Resolves: RHEL-83153
This commit is contained in:
Ondřej Pohořelský 2025-04-11 10:54:33 +02:00
parent 09ee669816
commit 23d5ff6d72
2 changed files with 31 additions and 3 deletions

View File

@ -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

26
fix-range-parsing.patch Normal file
View File

@ -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?= <opohorel@redhat.com>
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: