From 8dc1d72b6a3e72b5bee2666756077d64fabe63b8 Mon Sep 17 00:00:00 2001 From: eabdullin Date: Tue, 11 Nov 2025 21:58:26 +0000 Subject: [PATCH] import UBI cronie-1.7.0-12.el10 --- ...kup-failure-when-cache-directory-mis.patch | 40 +++++++++++++++++++ cronie.spec | 24 +++++++++-- fix-range-parsing.patch | 26 ++++++++++++ move_parsing_code.patch | 36 +++++++++++++++++ 4 files changed, 122 insertions(+), 4 deletions(-) create mode 100644 0001-crontab-Fix-backup-failure-when-cache-directory-mis.patch create mode 100644 fix-range-parsing.patch create mode 100644 move_parsing_code.patch diff --git a/0001-crontab-Fix-backup-failure-when-cache-directory-mis.patch b/0001-crontab-Fix-backup-failure-when-cache-directory-mis.patch new file mode 100644 index 0000000..793b9d3 --- /dev/null +++ b/0001-crontab-Fix-backup-failure-when-cache-directory-mis.patch @@ -0,0 +1,40 @@ +From 8ad9e9179ec806ec1031c94b218ae6ef9dc11c28 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ond=C5=99ej=20Poho=C5=99elsk=C3=BD?= +Date: Wed, 2 Jul 2025 11:58:41 +0200 +Subject: [PATCH] crontab: Fix backup failure when ~/.cache directory missing + +Create ~/.cache parent directory before creating ~/.cache/crontab backup +directory to prevent "mkdir: No such file or directory" errors when users +edit crontabs and their cache directory doesn't exist. +--- + src/crontab.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/src/crontab.c b/src/crontab.c +index c11dc81..f6fae67 100644 +--- a/src/crontab.c ++++ b/src/crontab.c +@@ -578,7 +578,20 @@ static int backup_crontab(const char *crontab_path) { + exit(ERROR_EXIT); + } + ++ /* Try to create parent directory if needed */ + if (stat(backup_dir, &sb) < OK && errno == ENOENT) { ++ char *last_slash = strrchr(backup_dir, '/'); ++ if (last_slash && last_slash != backup_dir) { ++ char parent_dir[MAX_FNAME]; ++ size_t parent_len = last_slash - backup_dir; ++ ++ if (parent_len < sizeof(parent_dir)) { ++ strncpy(parent_dir, backup_dir, parent_len); ++ parent_dir[parent_len] = '\0'; ++ mkdir(parent_dir, 0755); ++ } ++ } ++ + if (OK != mkdir(backup_dir, 0755)) { + fprintf(stderr, "%s: ", backup_dir); + perror("mkdir"); +-- +2.50.1 + diff --git a/cronie.spec b/cronie.spec index a4baa02..dce01b1 100644 --- a/cronie.spec +++ b/cronie.spec @@ -2,7 +2,7 @@ ## (rpmautospec version 0.6.5) ## RPMAUTOSPEC: autorelease, autochangelog %define autorelease(e:s:pb:n) %{?-p:0.}%{lua: - release_number = 9; + release_number = 12; base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}")); print(release_number + base_release_number - 1); }%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}} @@ -30,6 +30,14 @@ 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 +# https://github.com/cronie-crond/cronie/pull/201 +Patch: fix-range-parsing.patch +Patch: move_parsing_code.patch + +# https://github.com/cronie-crond/cronie/pull/206 +Patch: 0001-crontab-Fix-backup-failure-when-cache-directory-mis.patch + Requires: dailyjobs %if %{with selinux} @@ -140,8 +148,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 @@ -207,7 +214,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 @@ -225,6 +232,15 @@ exit 0 %changelog ## START: Generated by rpmautospec +* Tue Aug 12 2025 Ondřej Pohořelský - 1.7.0-12 +- Crontab fix backup failure + +* Wed May 14 2025 Ondřej Pohořelský - 1.7.0-11 +- Move parsing code before separator check + +* Wed Apr 23 2025 Ondřej Pohořelský - 1.7.0-10 +- Fix range parsing + * Wed Dec 11 2024 Ondřej Pohořelský - 1.7.0-9 - Reintroduce file existence check and fix timestamp file permissions 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: diff --git a/move_parsing_code.patch b/move_parsing_code.patch new file mode 100644 index 0000000..abb83a0 --- /dev/null +++ b/move_parsing_code.patch @@ -0,0 +1,36 @@ +From e6c2853856c3103a4add4c3673b3306cc21d341e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ond=C5=99ej=20Poho=C5=99elsk=C3=BD?= +Date: Wed, 7 May 2025 13:25:19 +0200 +Subject: [PATCH] get_range() move parsing code before separator check + +In the previous commit the parsing fix was added after a separator check +by accident, making it not execute properly. This commit moves it into the +right place. +--- + src/entry.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/entry.c b/src/entry.c +index 30bedb3..da1a02c 100644 +--- a/src/entry.c ++++ b/src/entry.c +@@ -638,13 +638,13 @@ get_range(bitstr_t * bits, int low, int high, const char *names[], + state = R_STEP; + break; + } ++ if (low_ > high_ && high_ == 0) { ++ high_ = 7; ++ } + if (is_separator(ch)) { + state = R_FINISH; + break; + } +- if (low_ > high_ && high_ == 0) { +- high_ = 7; +- } + return (EOF); + + case R_RANDOM: +-- +2.49.0 +