Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package cronie for openSUSE:Factory checked 
in at 2023-12-21 23:38:05
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/cronie (Old)
 and      /work/SRC/openSUSE:Factory/.cronie.new.1840 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "cronie"

Thu Dec 21 23:38:05 2023 rev:89 rq:1127725 version:unknown

Changes:
--------
--- /work/SRC/openSUSE:Factory/cronie/cronie.changes    2022-12-24 
14:52:06.315566389 +0100
+++ /work/SRC/openSUSE:Factory/.cronie.new.1840/cronie.changes  2023-12-21 
23:38:14.065708419 +0100
@@ -1,0 +2,21 @@
+Sat Nov 11 15:17:43 UTC 2023 - Andrea Manzini <andrea.manz...@suse.com>
+
+- Update to 1.7.0:
+  * anacron: Add support for NO_MAIL_OUTPUT environment variable
+  * anacron: Support enabling anacron jobs on battery power
+  * crond: Support -n crontab entry option to disable mailing the output
+  * crontab: Make a backup of the crontab file on edition and deletion
+- Add patch cronie-pam_config-nonlogin.diff
+- Refreshed patches:
+  * cronie-crond_pid.diff
+  * cronie-pam_config.diff
+  * cronie-nheader_lines.diff
+  * fix-manpage-replace-anacrontab-with-crontab.patch
+
+-------------------------------------------------------------------
+Fri Mar 31 13:54:41 UTC 2023 - Michal Koutný <mkou...@suse.com>
+
+- PAM: Use common-session-nonlogin for >15 codestreams
+  More info in https://github.com/SUSE/pam-config/pull/16
+
+-------------------------------------------------------------------

Old:
----
  cronie-1.6.1.tar.gz

New:
----
  cronie-1.7.0.tar.gz
  cronie-pam_config-nonlogin.diff

BETA DEBUG BEGIN:
  New:  * crontab: Make a backup of the crontab file on edition and deletion
- Add patch cronie-pam_config-nonlogin.diff
- Refreshed patches:
BETA DEBUG END:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ cronie.spec ++++++
--- /var/tmp/diff_new_pack.OYN21b/_old  2023-12-21 23:38:15.413757579 +0100
+++ /var/tmp/diff_new_pack.OYN21b/_new  2023-12-21 23:38:15.413757579 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package cronie
 #
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -22,7 +22,7 @@
   %define _fillupdir %{_localstatedir}/adm/fillup-templates
 %endif
 Name:           cronie
-Version:        1.6.1
+Version:        1.7.0
 Release:        0
 Summary:        Cron Daemon
 License:        BSD-3-Clause AND GPL-2.0-only AND MIT
@@ -46,6 +46,8 @@
 # PATCH-FIX-SUSE the first occurance of "/etc/anacrontab" was replaced by 
"/etc/crontab"
 # in manpage file because the /etc/crontab is still used in SUSE.
 Patch13:        fix-manpage-replace-anacrontab-with-crontab.patch
+# PATCH-FEATURE-OPENSUSE user common-session-nonlogin
+Patch14:        cronie-pam_config-nonlogin.diff
 BuildRequires:  audit-devel
 BuildRequires:  autoconf
 BuildRequires:  automake
@@ -104,6 +106,9 @@
 %patch5 -p1
 cp %{SOURCE7} ./cron_to_cronie.README
 %patch13 -p1
+%if 0%{?suse_version} > 1500
+%patch14 -p1
+%endif
 
 %build
 # fill macro CRON_VERSION it is used in top three lines of crontab file,should 
be reworked

++++++ cronie-1.6.1.tar.gz -> cronie-1.7.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cronie-cronie-1.6.1/.packit.yaml 
new/cronie-cronie-1.7.0/.packit.yaml
--- old/cronie-cronie-1.6.1/.packit.yaml        2022-04-25 14:46:41.000000000 
+0200
+++ new/cronie-cronie-1.7.0/.packit.yaml        2023-10-13 10:59:54.000000000 
+0200
@@ -12,3 +12,6 @@
 - cronie.spec
 - .packit.yaml
 upstream_package_name: cronie
+srpm_build_deps:
+- gcc
+- systemd
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cronie-cronie-1.6.1/ChangeLog 
new/cronie-cronie-1.7.0/ChangeLog
--- old/cronie-cronie-1.6.1/ChangeLog   2022-04-25 14:46:41.000000000 +0200
+++ new/cronie-cronie-1.7.0/ChangeLog   2023-10-13 10:59:54.000000000 +0200
@@ -1,3 +1,115 @@
+2023-10-13  Tomas Mraz <tm...@fedoraproject.org>
+
+       * anacron: Use xclose() instead of fclose()
+      When replacing standard descriptors we use
+         xclose() elsewhere and it is less error-prone.
+
+2023-09-28  Alexander Schwinn <alexxc...@xfce.org>
+
+       * Show error when step size is out of bound
+
+2023-09-28  Alexander Schwinn <alexxc...@xfce.org>
+
+       * Rename variables in 'get_range' to make code more readable
+
+2023-09-17  Jonathan Kamens <j...@kamens.us>
+
+       * Explain how to do skip values for non-multiples of the time unit
+
+2023-09-07  bwelterl <bwelt...@redhat.com>
+
+       * Optimization to close fds from /proc/self/fd in case of high
+      nofile limit after fork
+
+2023-07-25  Tomas Mraz <tm...@fedoraproject.org>
+
+       * cronnext: Round up the start time to whole minute
+
+2023-04-28  lilinjie <lilin...@uniontech.com>
+
+       * fix typo
+
+2023-04-27  Johnny <39348311+johnnyjay...@users.noreply.github.com>
+
+       * anacron: Add support for NO_MAIL_OUTPUT environment variable
+
+2023-03-29  YoruStar <524413...@qq.com>
+
+       * Support reloading with SIGURG in addition to SIGHUP
+
+2023-03-13  Tomas Mraz <tm...@fedoraproject.org>
+
+       * crontab.5: Clarify the evaluation of the step values
+
+2023-02-14  Li kunyu <ku...@nfschina.com>
+
+       * cronie_common.c: Check memory allocation result in expand_envvar() 
function.
+
+2023-01-12  lilinjie <102012657+uniontech-lilin...@users.noreply.github.com>
+
+       * ChangeLog: fix typos
+
+2023-01-11  lilinjie <102012657+uniontech-lilin...@users.noreply.github.com>
+
+       * CHANGELOG: fix typo
+
+2022-06-17  fgozzini <49639209+fgozz...@users.noreply.github.com>
+
+       * Added double quotes
+
+2022-06-15  fgozzini <49639209+fgozz...@users.noreply.github.com>
+
+       * Source directly from `/etc/default/anacron`
+
+2022-06-14  fgozzini <49639209+fgozz...@users.noreply.github.com>
+
+       * Allow user to run anacron jobs on battery
+         The user can allow running anacron jobs on battery by adding
+      the string `ANACRON_RUN_ON_BATTERY_POWER=yes` to the
+      file `/etc/default/anacron`.
+
+2022-08-16  Antti Antinoja <an...@fennosys.fi>
+
+       * Use _PATH_STDPATH instead of _PATH_DEFPATH
+
+2022-08-24  Christopher Odenbach <odenb...@uni-paderborn.de>
+
+       * do not put <> in quotation marks
+
+2022-08-23  Christopher Odenbach <odenb...@uni-paderborn.de>
+
+       * set the return-path hard to "<>"
+
+2022-09-26  Ondřej Pohořelský <opoho...@redhat.com>
+
+       * Add -n option for crontab entries
+      The -n option causes no mail to be sent
+         when the command finishes successfully.
+
+2022-12-16  iTrooz <itr...@protonmail.com>
+
+       * Make a backup of the crontab file on edition and deletion
+
+2022-12-23  iTrooz <itr...@protonmail.com>
+
+       * use packit srpm_build_deps key
+
+2022-12-16  Masanari Iida <standby2...@gmail.com>
+
+       * man: Fix some spelling typos in anacron.8 and cronnext.1
+
+2022-12-12  lilinjie <lilin...@uniontech.com>
+
+       * fix spelling error
+
+2022-08-31  Daniel M. Capella <poly...@users.noreply.github.com>
+
+       * Remove excess comma
+
+2022-04-25  Tomas Mraz <tm...@fedoraproject.org>
+
+       * Release version 1.6.1
+
 2022-03-23  w30023233 <wangyuhan...@huawei.com>
 
        * Fix regression in handling 1-5 crontab entries
@@ -1206,7 +1318,7 @@
 
 2011-05-26  Marcela Mašláňová <mmasl...@redhat.com>
 
-       * man/cron.8, man/crontab.1: Change of email adress of cluster
+       * man/cron.8, man/crontab.1: Change of email address of cluster
        support author.
 
 2011-05-16  Kiyoshi OHGISHI <ohgi...@gaia.eonet.ne.jp>
@@ -1595,12 +1707,12 @@
 
 2009-11-27  Marcela Mašláňová <mmasl...@redhat.com>
 
-       * cronie.init: Initscript: if unprivileged user stop deamon, it
+       * cronie.init: Initscript: if unprivileged user stop daemon, it
        should return 4.
 
 2009-11-27  Marcela Mašláňová <mmasl...@redhat.com>
 
-       * cronie.init: Initscript: if unprivileged user restart deamon, it
+       * cronie.init: Initscript: if unprivileged user restart daemon, it
        should return 4.
 
 2009-11-05  Guido Trentalancia <gu...@trentalancia.com>
@@ -1852,7 +1964,7 @@
 2009-06-05  Marcela Mašláňová <mmasl...@redhat.com>
 
        * src/cron.c, src/do_command.c, src/globals.h: ValidateMailRcpts
-       removed for problems when could be enviromental settings exported
+       removed for problems when could be environmental settings exported
        under wrong user.
 
 2009-05-29  Marcela Mašláňová <mmasl...@redhat.com>
@@ -2341,7 +2453,7 @@
 
 2007-08-24  mmaslano <mmasl...@redhat.com>
 
-       * src/funcs.h: Change definiton from popen.c in header file.
+       * src/funcs.h: Change definition from popen.c in header file.
 
 2007-08-24  mmaslano <mmasl...@redhat.com>
 
@@ -2513,7 +2625,7 @@
 
 2007-08-17  mmaslano <mmasl...@redhat.com>
 
-       * do_command.c: 'Build enviroment' is set in pam section for better
+       * do_command.c: 'Build environment' is set in pam section for better
        security.
 
 2007-08-17  mmaslano <mmasl...@redhat.com>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cronie-cronie-1.6.1/NEWS new/cronie-cronie-1.7.0/NEWS
--- old/cronie-cronie-1.6.1/NEWS        2022-04-25 14:46:41.000000000 +0200
+++ new/cronie-cronie-1.7.0/NEWS        2023-10-13 10:59:54.000000000 +0200
@@ -1,5 +1,12 @@
 cronie NEWS -- history of user-visible changes.
 
+Release 1.7.0
+
+* anacron: Add support for NO_MAIL_OUTPUT environment variable
+* anacron: Support enabling anacron jobs on battery power
+* crond: Support -n crontab entry option to disable mailing the output
+* crontab: Make a backup of the crontab file on edition and deletion
+
 Release 1.6.1
 
 * crond: Fix regression of handling ranges (x-y) in crontab
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cronie-cronie-1.6.1/anacron/global.h 
new/cronie-cronie-1.7.0/anacron/global.h
--- old/cronie-cronie-1.6.1/anacron/global.h    2022-04-25 14:46:41.000000000 
+0200
+++ new/cronie-cronie-1.7.0/anacron/global.h    2023-10-13 10:59:54.000000000 
+0200
@@ -62,6 +62,7 @@
    char *ident;
    char *command;
    char *mailto;
+   int no_mail_output;
 
    int tab_line;
    int arg_num;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cronie-cronie-1.6.1/anacron/main.c 
new/cronie-cronie-1.7.0/anacron/main.c
--- old/cronie-cronie-1.6.1/anacron/main.c      2022-04-25 14:46:41.000000000 
+0200
+++ new/cronie-cronie-1.7.0/anacron/main.c      2023-10-13 10:59:54.000000000 
+0200
@@ -209,13 +209,13 @@
 
     /* stdin is already closed */
 
-    if (fclose(stdout)) die_e("Can't close stdout");
+    xclose(STDOUT_FILENO);
     /* coverity[leaked_handle] – fd 1 closed automatically */
-    xopen(1, "/dev/null", O_WRONLY);
+    xopen(STDOUT_FILENO, "/dev/null", O_WRONLY);
 
-    if (fclose(stderr)) die_e("Can't close stderr");
+    xclose(STDERR_FILENO);
     /* coverity[leaked_handle] – fd 2 closed automatically */
-    xopen(2, "/dev/null", O_WRONLY);
+    xopen(STDERR_FILENO, "/dev/null", O_WRONLY);
 
     pid = xfork();
     if (pid != 0)
@@ -476,7 +476,7 @@
 
     if (sigprocmask(0, NULL, &old_sigmask)) die_e("sigset error");
 
-    if (fclose(stdin)) die_e("Can't close stdin");
+    xclose(STDIN_FILENO);
     xopen(STDIN_FILENO, "/dev/null", O_RDONLY);
 
     if (!no_daemon && !testing_only)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cronie-cronie-1.6.1/anacron/runjob.c 
new/cronie-cronie-1.7.0/anacron/runjob.c
--- old/cronie-cronie-1.6.1/anacron/runjob.c    2022-04-25 14:46:41.000000000 
+0200
+++ new/cronie-cronie-1.7.0/anacron/runjob.c    2023-10-13 10:59:54.000000000 
+0200
@@ -166,12 +166,16 @@
 run_job(const job_rec *jr)
 /* This is called to start the job, after the fork */
 {
-    /* setup stdout and stderr */
-    xclose(1);
-    xclose(2);
-    if (dup2(jr->output_fd, 1) != 1 || dup2(jr->output_fd, 2) != 2)
-       die_e("dup2() error");     /* dup2 also clears close-on-exec flag */
-    in_background = 0;  /* now, errors will be mailed to the user */
+    /* If mail functionality is not disabled, pipe outputs to temp file */
+    if (!jr->no_mail_output) {
+        /* setup stdout and stderr */
+        xclose(1);
+        xclose(2);
+        if (dup2(jr->output_fd, 1) != 1 || dup2(jr->output_fd, 2) != 2)
+            die_e("dup2() error");     /* dup2 also clears close-on-exec flag 
*/
+        in_background = 0;  /* now, errors will be mailed to the user */
+    }
+
     if (chdir("/")) die_e("Can't chdir to '/'");
 
     if (sigprocmask(SIG_SETMASK, &old_sigmask, NULL))
@@ -291,6 +295,7 @@
     char *mailfrom;
     char mailto_expanded[MAX_EMAILSTR];
     char mailfrom_expanded[MAX_EMAILSTR];
+    char *no_mail_output;
 
     /* get hostname */
     if (gethostname(hostname, 512)) {
@@ -299,62 +304,68 @@
 
     setup_env(jr);
 
-    /* Get the destination email address if set, or current user otherwise */
-    mailto = getenv("MAILTO");
-    if (mailto == NULL) {
-        mailto = username();
-    }
-    else {
-        if (expand_envvar(mailto, mailto_expanded, sizeof(mailto_expanded))) {
-            mailto = mailto_expanded; 
+    no_mail_output = getenv("NO_MAIL_OUTPUT");
+    jr->no_mail_output = no_mail_output != NULL && *no_mail_output;
+
+    /* Set up email functionality if it isn't disabled  */
+    if (!jr->no_mail_output) {
+        /* Get the destination email address if set, or current user otherwise 
*/
+        mailto = getenv("MAILTO");
+        if (mailto == NULL) {
+            mailto = username();
         }
         else {
-            complain("The environment variable 'MAILTO' could not be expanded. 
The non-expanded value will be used.");
-        }     
-    }
+            if (expand_envvar(mailto, mailto_expanded, 
sizeof(mailto_expanded))) {
+                mailto = mailto_expanded;
+            }
+            else {
+                complain("The environment variable 'MAILTO' could not be 
expanded. The non-expanded value will be used.");
+            }
+        }
 
-    /* Get the source email address if set, or current user otherwise */
-    mailfrom = getenv("MAILFROM");
-    if (mailfrom == NULL) {
-        mailfrom = username();
-    }
-    else {
-        if (expand_envvar(mailfrom, mailfrom_expanded, 
sizeof(mailfrom_expanded))) {
-            mailfrom = mailfrom_expanded;
+        /* Get the source email address if set, or current user otherwise */
+        mailfrom = getenv("MAILFROM");
+        if (mailfrom == NULL) {
+            mailfrom = username();
         }
         else {
-            complain("The environment variable 'MAILFROM' could not be 
expanded. The non-expanded value will be used.");
-        }   
-    }
+            if (expand_envvar(mailfrom, mailfrom_expanded, 
sizeof(mailfrom_expanded))) {
+                mailfrom = mailfrom_expanded;
+            }
+            else {
+                complain("The environment variable 'MAILFROM' could not be 
expanded. The non-expanded value will be used.");
+            }
+        }
 
-    /* create temporary file for stdout and stderr of the job */
-    temp_file(jr); fd = jr->output_fd;
-    /* write mail header */
-    xwrite(fd, "From: ");
-    xwrite(fd, "Anacron <");
-    xwrite(fd, mailfrom);
-    xwrite(fd, ">\n");
-    xwrite(fd, "To: ");
-    xwrite(fd, mailto);
-    xwrite(fd, "\n");
-    xwrite(fd, "MIME-Version: 1.0\n");
-    xwrite(fd, "Content-Type: text/plain; charset=\"");
-    xwrite(fd, nl_langinfo(CODESET));
-    xwrite(fd, "\"\n");
-    xwrite(fd, "Content-Transfer-Encoding: 8bit\n");
-    xwrite(fd, "Subject: Anacron job '");
-    xwrite(fd, jr->ident);
-    xwrite(fd, "' on ");
-    xwrite(fd, hostname);
-    xwrite(fd, "\n\n");
-
-    if (*mailto == '\0')
-       jr->mailto = NULL;
-    else
-       /* ugly but works without strdup() */
-       jr->mailto = mailto;
+        /* create temporary file for stdout and stderr of the job */
+        temp_file(jr); fd = jr->output_fd;
+        /* write mail header */
+        xwrite(fd, "From: ");
+        xwrite(fd, "Anacron <");
+        xwrite(fd, mailfrom);
+        xwrite(fd, ">\n");
+        xwrite(fd, "To: ");
+        xwrite(fd, mailto);
+        xwrite(fd, "\n");
+        xwrite(fd, "MIME-Version: 1.0\n");
+        xwrite(fd, "Content-Type: text/plain; charset=\"");
+        xwrite(fd, nl_langinfo(CODESET));
+        xwrite(fd, "\"\n");
+        xwrite(fd, "Content-Transfer-Encoding: 8bit\n");
+        xwrite(fd, "Subject: Anacron job '");
+        xwrite(fd, jr->ident);
+        xwrite(fd, "' on ");
+        xwrite(fd, hostname);
+        xwrite(fd, "\n\n");
+
+        if (*mailto == '\0')
+            jr->mailto = NULL;
+        else
+            /* ugly but works without strdup() */
+            jr->mailto = mailto;
 
-    jr->mail_header_size = file_size(fd);
+        jr->mail_header_size = file_size(fd);
+    }
 
     pid = xfork();
     if (pid == 0)
@@ -379,8 +390,8 @@
 
     update_timestamp(jr);
     unlock(jr);
-    if (file_size(jr->output_fd) > jr->mail_header_size) mail_output = 1;
-    else mail_output = 0;
+
+    mail_output = !jr->no_mail_output && file_size(jr->output_fd) > 
jr->mail_header_size;
 
     m = mail_output ? " (produced output)" : "";
     if (WIFEXITED(status) && WEXITSTATUS(status) == 0)
@@ -397,8 +408,11 @@
     jr->job_pid = 0;
     running_jobs--;
     if (mail_output) launch_mailer(jr);
-    xclose(jr->output_fd);
-    xclose(jr->input_fd);
+    /* output_fd and input_fd are only set if mail functionality is enabled  */
+    if (!jr->no_mail_output) {
+        xclose(jr->output_fd);
+        xclose(jr->input_fd);
+    }
 }
 
 void
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cronie-cronie-1.6.1/configure.ac 
new/cronie-cronie-1.7.0/configure.ac
--- old/cronie-cronie-1.6.1/configure.ac        2022-04-25 14:46:41.000000000 
+0200
+++ new/cronie-cronie-1.7.0/configure.ac        2023-10-13 10:59:54.000000000 
+0200
@@ -1,4 +1,4 @@
-AC_INIT([cronie],[1.6.1])
+AC_INIT([cronie],[1.7.0])
 AC_CONFIG_HEADERS([config.h])
 AC_PREREQ([2.64])
 
@@ -196,14 +196,14 @@
 
 AC_DEFINE(MAILARG,"/usr/sbin/sendmail",[There will be path to sendmail.])
 
-AC_DEFINE(MAILFMT,"%s -FCronDaemon -i -odi -oem -oi -t -f %s",
+AC_DEFINE(MAILFMT,"%s -FCronDaemon -i -odi -oem -oi -t -f <>",
 [-i    = don't terminate on "." by itself
 -Fx   = Set full-name of sender
 -odi  = Option Deliverymode Interactive
 -oem  = Option Errors Mailedtosender
 -oi   = Ignore "." alone on a line
 -t    = Get recipient from headers
--f %s = Envelope sender address
+-f <> = Empty envelope sender address
 -d = undocumented but common flag.])
 
 AC_DEFINE(SYSLOG,1,[Using syslog for log messages.])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cronie-cronie-1.6.1/contrib/0anacron 
new/cronie-cronie-1.7.0/contrib/0anacron
--- old/cronie-cronie-1.6.1/contrib/0anacron    2022-04-25 14:46:41.000000000 
+0200
+++ new/cronie-cronie-1.7.0/contrib/0anacron    2023-10-13 10:59:54.000000000 
+0200
@@ -7,19 +7,26 @@
     exit 0
 fi
 
-# Do not run jobs when on battery power
-online=1
-for psupply in /sys/class/power_supply/* ; do
-    if [ `cat "$psupply/type" 2>/dev/null`x = Mainsx ] && [ -f 
"$psupply/online" ]; then
-        if [ `cat "$psupply/online" 2>/dev/null`x = 1x ]; then
-            online=1
-            break
-        else
-            online=0
+# Check whether run on battery should be allowed
+. /etc/default/anacron
+
+if [ "$ANACRON_RUN_ON_BATTERY_POWER" != "yes" ]; then
+
+    # Do not run jobs when on battery power
+    online=1
+    for psupply in /sys/class/power_supply/* ; do
+        if [ `cat "$psupply/type" 2>/dev/null`x = Mainsx ] && [ -f 
"$psupply/online" ]; then
+            if [ `cat "$psupply/online" 2>/dev/null`x = 1x ]; then
+                online=1
+                break
+            else
+                online=0
+            fi
         fi
+    done
+    if [ $online = 0 ]; then
+        exit 0
     fi
-done
-if [ $online = 0 ]; then
-    exit 0
+
 fi
 /usr/sbin/anacron -s
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cronie-cronie-1.6.1/contrib/cronie.systemd 
new/cronie-cronie-1.7.0/contrib/cronie.systemd
--- old/cronie-cronie-1.6.1/contrib/cronie.systemd      2022-04-25 
14:46:41.000000000 +0200
+++ new/cronie-cronie-1.7.0/contrib/cronie.systemd      2023-10-13 
10:59:54.000000000 +0200
@@ -5,7 +5,7 @@
 [Service]
 EnvironmentFile=/etc/sysconfig/crond
 ExecStart=/usr/sbin/crond -n $CRONDARGS
-ExecReload=/bin/kill -HUP $MAINPID
+ExecReload=/bin/kill -URG $MAINPID
 KillMode=process
 Restart=on-failure
 RestartSec=30s
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cronie-cronie-1.6.1/cronie.spec 
new/cronie-cronie-1.7.0/cronie.spec
--- old/cronie-cronie-1.6.1/cronie.spec 2022-04-25 14:46:41.000000000 +0200
+++ new/cronie-cronie-1.7.0/cronie.spec 2023-10-13 10:59:54.000000000 +0200
@@ -5,7 +5,7 @@
 
 Summary:   Cron daemon for executing programs at set times
 Name:      cronie
-Version:   1.6.1
+Version:   1.7.0
 Release:   0packit%{?dist}
 License:   MIT and BSD and ISC and GPLv2+
 URL:       https://github.com/cronie-crond/cronie
@@ -30,6 +30,7 @@
 
 BuildRequires: gcc
 BuildRequires: systemd
+BuildRequires: make
 Obsoletes:     %{name}-sysvinit
 
 Requires(post):   coreutils sed
@@ -78,7 +79,7 @@
 extra features.
 
 %prep
-%setup -q
+%autosetup -p1
 
 %build
 ./autogen.sh
@@ -100,10 +101,10 @@
 --enable-pie \
 --enable-relro
 
-make %{?_smp_mflags} V=2
+%make_build V=2
 
 %install
-make install DESTDIR=$RPM_BUILD_ROOT DESTMAN=$RPM_BUILD_ROOT%{_mandir}
+%make_install DESTMAN=$RPM_BUILD_ROOT%{_mandir}
 mkdir -pm700 $RPM_BUILD_ROOT%{_localstatedir}/spool/cron
 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/
 mkdir -pm755 $RPM_BUILD_ROOT%{_sysconfdir}/cron.d/
@@ -209,10 +210,16 @@
 %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/cron.d/dailyjobs
 
 %changelog
-* Mon Apr 25 2022 Packit <pac...@packit.dev> - 1.6.1-0packit
+* Mon Apr 25 2022 Packit <pac...@packit.dev> - 1.7.0-0packit
 - Packit build
 
-* Thu Oct 31 2019 Tomáš Mráz <tm...@redhat.com> - 1.5.5-1
+* Mon Mar 29 2021 Tomáš Mráz <tm...@fedoraproject.org> - 1.5.7-1
+- new upstream release 1.5.7 with bug fixes and enhancements
+
+* Wed Mar 17 2021 Tomáš Mráz <tm...@fedoraproject.org> - 1.5.6-1
+- new upstream release 1.5.6 with bug fixes and enhancements
+
+** Thu Oct 31 2019 Tomáš Mráz <tm...@redhat.com> - 1.5.5-1
 - new upstream release 1.5.5 with multiple bug fixes and improvements
 
 * Wed Jul 24 2019 Fedora Release Engineering <rel...@fedoraproject.org> - 
1.5.4-2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cronie-cronie-1.6.1/cronie_common.c 
new/cronie-cronie-1.7.0/cronie_common.c
--- old/cronie-cronie-1.6.1/cronie_common.c     2022-04-25 14:46:41.000000000 
+0200
+++ new/cronie-cronie-1.7.0/cronie_common.c     2023-10-13 10:59:54.000000000 
+0200
@@ -107,6 +107,9 @@
         }
 
         envvar_name = malloc(envvar_name_size + 1);
+        if (envvar_name == NULL)
+            goto too_big;
+
         strncpy(envvar_name, envvar_p, envvar_name_size);
         envvar_name[envvar_name_size] = '\0';
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cronie-cronie-1.6.1/man/anacron.8 
new/cronie-cronie-1.7.0/man/anacron.8
--- old/cronie-cronie-1.6.1/man/anacron.8       2022-04-25 14:46:41.000000000 
+0200
+++ new/cronie-cronie-1.7.0/man/anacron.8       2023-10-13 10:59:54.000000000 
+0200
@@ -184,7 +184,7 @@
 Anacron uses up to two file descriptors for each active job.  It may run
 out of descriptors if there are lots of active jobs.  See
 .B echo $(($(ulimit -n) / 2))
-for information how many concurent jobs anacron may run.
+for information how many concurrent jobs anacron may run.
 .PP
 Mail comments, suggestions and bug reports to
 .MT shaleh@\:(debian.\:org|\:valinux.\:com)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cronie-cronie-1.6.1/man/anacrontab.5 
new/cronie-cronie-1.7.0/man/anacrontab.5
--- old/cronie-cronie-1.6.1/man/anacrontab.5    2022-04-25 14:46:41.000000000 
+0200
+++ new/cronie-cronie-1.7.0/man/anacrontab.5    2023-10-13 10:59:54.000000000 
+0200
@@ -81,6 +81,10 @@
 .I MAILTO 
 variables are expanded, so setting them as in the following example works as 
expected: MAILFROM=cron-$u...@cron.com ($USER is replaced by the system user) ) 
 .PP
+If
+.I NO_MAIL_OUTPUT
+is defined (and non-empty), the standard output and error descriptors of job 
processes are not redirected and e-mailed.
+.PP
 .PP
 Empty lines are either blank lines, line containing white spaces only, or
 lines with white spaces followed by a '#' followed by an arbitrary
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cronie-cronie-1.6.1/man/cron.8 
new/cronie-cronie-1.7.0/man/cron.8
--- old/cronie-cronie-1.6.1/man/cron.8  2022-04-25 14:46:41.000000000 +0200
+++ new/cronie-cronie-1.7.0/man/cron.8  2023-10-13 10:59:54.000000000 +0200
@@ -189,7 +189,7 @@
 to send the job output to the system log using
 .BR syslog (3).
 This is useful if your system does not have
-.BR sendmail (8),
+.BR sendmail (8)
 installed or if mail is disabled.
 .TP
 .B "\-x"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cronie-cronie-1.6.1/man/cronnext.1 
new/cronie-cronie-1.7.0/man/cronnext.1
--- old/cronie-cronie-1.6.1/man/cronnext.1      2022-04-25 14:46:41.000000000 
+0200
+++ new/cronie-cronie-1.7.0/man/cronnext.1      2023-10-13 10:59:54.000000000 
+0200
@@ -35,7 +35,7 @@
 Do not consider the system crontab, usually the
 .I /etc/crontab
 file.  The system crontab usually contains the hourly, daily, weekly and
-montly crontabs, which might be better dealt with
+monthly crontabs, which might be better dealt with
 .BR anacron (8).
 .TP
 .BI \-a
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cronie-cronie-1.6.1/man/crontab.1 
new/cronie-cronie-1.7.0/man/crontab.1
--- old/cronie-cronie-1.6.1/man/crontab.1       2022-04-25 14:46:41.000000000 
+0200
+++ new/cronie-cronie-1.7.0/man/crontab.1       2023-10-13 10:59:54.000000000 
+0200
@@ -119,6 +119,19 @@
 .I NO_COLOR
 is set.
 .PP
+On edition or deletion of the crontab, a backup of the last crontab will be 
saved to
+.I $XDG_CACHE_HOME/crontab/crontab.bak
+or 
+.I $XDG_CACHE_HOME/crontab/crontab.<user>.bak
+if
+.B -u
+is used.
+If the
+.I XDG_CACHE_HOME
+environment variable is not set,
+.I $HOME/.cache
+will be used instead.
+.PP
 .SH "OPTIONS"
 .TP
 .B "\-u"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cronie-cronie-1.6.1/man/crontab.5 
new/cronie-cronie-1.7.0/man/crontab.5
--- old/cronie-cronie-1.6.1/man/crontab.5       2022-04-25 14:46:41.000000000 
+0200
+++ new/cronie-cronie-1.7.0/man/crontab.5       2023-10-13 10:59:54.000000000 
+0200
@@ -223,7 +223,10 @@
 execution for every other hour (the alternative in the V7 standard is
 "0,\:2,\:4,\:6,\:8,\:10,\:12,\:14,\:16,\:18,\:20,\:22").  Step values are
 also permitted after an asterisk, so if specifying a job to be run every
-two hours, you can use "*/2".
+two hours, you can use "*/2". Please note that steps are evaluated just
+within the field they are applied to. For example "*/23" in hours field
+means to execute the job on the hour 0 and the hour 23 within a calendar
+day. See "NOTES" below for a workaround.
 .PP
 Names can also be used for the 'month' and 'day of week' fields.  Use the
 first three letters of the particular day or month (case does not
@@ -287,6 +290,20 @@
 MAILTO=root
 * * * * * root touch /tmp/file
 .fi
+.SH NOTES
+As noted above, skip values only operate within the time period they\'re
+attached to. For example, specifying "0/35" for the minute field of a
+crontab entry won\'t cause that entry to be executed every 35 minutes;
+instead, it will be executed twice every hour, at 0 and 35 minutes past.
+For more fine-grained control you can do something like this:
+.nf
+* * * * * if [ $(expr \( $(date +\%s) / 60 \) \% 58) = 0 ]; then echo this 
runs every 58 minutes; fi
+0 * * * * if [ $(expr \( $(date +\%s) / 3600 \) \% 23) = 0 ]; then echo this 
runs every 23 hours on the hour; fi
+.fi
+Adjust as needed if your
+.BR date (1)
+command does not accept "+%s" as the format string specifier to output
+the current UNIX timestamp.
 .SH SELinux with multi level security (MLS)
 In a crontab, it is important to specify a security level by
 .I crontab \-s
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cronie-cronie-1.6.1/readme.md 
new/cronie-cronie-1.7.0/readme.md
--- old/cronie-cronie-1.6.1/readme.md   2022-04-25 14:46:41.000000000 +0200
+++ new/cronie-cronie-1.7.0/readme.md   2023-10-13 10:59:54.000000000 +0200
@@ -7,10 +7,17 @@
 And why cronie? [http://www.urbandictionary.com/define.php?term=cronie]
 
 # Download
-Latest released version is 1.6.1.
+Latest released version is 1.7.0.
 
 User visible changes:
 
+Release 1.7.0
+
+- anacron: Add support for NO_MAIL_OUTPUT environment variable
+- anacron: Support enabling anacron jobs on battery power
+- crond: Support -n crontab entry option to disable mailing the output
+- crontab: Make a backup of the crontab file on edition and deletion
+
 Release 1.6.1
 
 - crond: Fix regression of handling ranges (x-y) in crontab
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cronie-cronie-1.6.1/src/cron.c 
new/cronie-cronie-1.7.0/src/cron.c
--- old/cronie-cronie-1.6.1/src/cron.c  2022-04-25 14:46:41.000000000 +0200
+++ new/cronie-cronie-1.7.0/src/cron.c  2023-10-13 10:59:54.000000000 +0200
@@ -66,10 +66,11 @@
 cron_sleep(int, cron_db *),
 sigchld_handler(int),
 sighup_handler(int ATTRIBUTE_UNUSED),
+sigurg_handler(int ATTRIBUTE_UNUSED),
 sigchld_reaper(void),
 sigintterm_handler(int ATTRIBUTE_UNUSED), parse_args(int c, char *v[]);
 
-static volatile sig_atomic_t got_sighup, got_sigchld, got_sigintterm;
+static volatile sig_atomic_t got_sighup, got_sigchld, got_sigintterm, 
got_sigurg;
 static int timeRunning, virtualTime, clockTime;
 static long GMToff;
 static int DisableInotify;
@@ -151,8 +152,9 @@
 #endif
 
 static void handle_signals(cron_db * database) {
-       if (got_sighup) {
+       if (got_sighup || got_sigurg) {
                got_sighup = 0;
+               got_sigurg = 0;
 #if defined WITH_INOTIFY
                /* watches must be reinstated on reload */
                if (inotify_enabled && (EnableClustering != 1)) {
@@ -179,13 +181,13 @@
        fprintf(stderr, "\n");
        fprintf(stderr, "Options:\n");
        fprintf(stderr, " -h         print this message \n");
-       fprintf(stderr, " -i         deamon runs without inotify support\n");
+       fprintf(stderr, " -i         daemon runs without inotify support\n");
        fprintf(stderr, " -m <comm>  off, or specify preferred client for 
sending mails\n");
        fprintf(stderr, " -n         run in foreground\n");
        fprintf(stderr, " -f         run in foreground, the same as -n\n");
        fprintf(stderr, " -p         permit any crontab\n");
        fprintf(stderr, " -P         inherit PATH from environment instead of 
using default value");
-       fprintf(stderr, "            of \"%s\"\n", _PATH_DEFPATH);
+       fprintf(stderr, "            of \"%s\"\n", _PATH_STDPATH);
        fprintf(stderr, " -c         enable clustering support\n");
        fprintf(stderr, " -s         log into syslog instead of sending 
mails\n");
        fprintf(stderr, " -V         print version and exit\n");
@@ -243,13 +245,15 @@
        sact.sa_handler = sigintterm_handler;
        (void) sigaction(SIGINT, &sact, NULL);
        (void) sigaction(SIGTERM, &sact, NULL);
+       sact.sa_handler = sigurg_handler;
+       (void) sigaction(SIGURG, &sact, NULL);
 
        acquire_daemonlock(0);
        set_cron_uid();
        check_spool_dir();
 
        if (ChangePath) {
-               if (setenv("PATH", _PATH_DEFPATH, 1) < 0) {
+               if (setenv("PATH", _PATH_STDPATH, 1) < 0) {
                        log_it("CRON", pid, "DEATH", "can't setenv PATH",
                                errno);
                        exit(1);
@@ -664,6 +668,10 @@
        got_sigintterm = 1;
 }
 
+static void sigurg_handler(int x ATTRIBUTE_UNUSED) {
+       got_sigurg = 1;
+}
+
 static void sigchld_reaper(void) {
        WAIT_T waiter;
        PID_T pid;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cronie-cronie-1.6.1/src/cronnext.c 
new/cronie-cronie-1.7.0/src/cronnext.c
--- old/cronie-cronie-1.6.1/src/cronnext.c      2022-04-25 14:46:41.000000000 
+0200
+++ new/cronie-cronie-1.7.0/src/cronnext.c      2023-10-13 10:59:54.000000000 
+0200
@@ -214,7 +214,7 @@
 }
 
 /*
- * find next sheduled job
+ * find the next scheduled job
  */
 time_t cronnext(cron_db database,
                time_t start, time_t end,
@@ -231,7 +231,7 @@
        else if (flags & ALLJOBS)
                printf("jobs:\n");
 
-       /* find next sheduled time */
+       /* find the next scheduled time */
        closest = -1;
        for (u = database.head; u; u = u->next) {
                if (include && !matchuser(u->name, include))
@@ -343,7 +343,7 @@
        flags = SYSTEM;
        endtime = 0;
        printjobs = 0;
-       start = time(NULL) / 60 * 60;
+       start = (time(NULL) + 59) / 60 * 60;
 
        while (-1 != (opt = getopt(argn, argv, "i:e:ast:q:j:lcfhV"))) {
                switch (opt) {
@@ -360,7 +360,7 @@
                        flags &= ~SYSTEM;
                        break;
                case 't':
-                       start = atoi(optarg) / 60 * 60;
+                       start = (atoi(optarg) + 59) / 60 * 60;
                        break;
                case 'q':
                        end = atoi(optarg) / 60 * 60;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cronie-cronie-1.6.1/src/crontab.c 
new/cronie-cronie-1.7.0/src/crontab.c
--- old/cronie-cronie-1.6.1/src/crontab.c       2022-04-25 14:46:41.000000000 
+0200
+++ new/cronie-cronie-1.7.0/src/crontab.c       2023-10-13 10:59:54.000000000 
+0200
@@ -113,7 +113,7 @@
 check_error(const char *), parse_args(int c, char *v[]),
 die(int) ATTRIBUTE_NORETURN;
 static int replace_cmd(void), hostset_cmd(void), hostget_cmd(void),
-test_cmd(void), check_syntax(FILE *);
+test_cmd(void), check_syntax(FILE *), backup_crontab(const char *);
 static char *host_specific_filename(const char *prefix,
 const char *suffix);
 static const char *tmp_path(void);
@@ -479,16 +479,129 @@
                fprintf(stderr, "path too long\n");
                exit(ERROR_EXIT);
        }
+       
+       if (backup_crontab(n) == -1) {
+               fprintf(stderr, "no crontab for %s\n", User);
+               exit(ERROR_EXIT);
+       }
+
        if (unlink(n) != 0) {
-               if (errno == ENOENT)
-                       fprintf(stderr, "no crontab for %s\n", User);
-               else
-                       perror(n);
+               perror(n);
                exit(ERROR_EXIT);
        }
        poke_daemon();
 }
 
+/* returns     0       on success
+ *             -1      on non existent crontab file
+ *             -2      on failure to write the backup file
+ */
+static int backup_crontab(const char *crontab_path) {
+       const char *env_value;
+       char backup_dir[MAX_FNAME], backup_path[MAX_FNAME];
+       int ch = '\0';
+       FILE *crontab_file;
+       FILE *backup_file;
+       struct stat sb;
+       int retval = 0;
+       
+       /* create backup directory */
+       if ((env_value = getenv("XDG_CACHE_HOME")) != NULL) {
+               if(!glue_strings(backup_dir, sizeof backup_dir, env_value, "", 
'\0')){
+                       fprintf(stderr, "$XDG_CACHE_HOME path too long\n");
+                       return -2;
+               }
+       }
+       else if ((env_value = getenv("HOME")) != NULL) {
+               if (!glue_strings(backup_dir, sizeof backup_dir, env_value,
+                               ".cache", '/')) {
+                       fprintf(stderr, "$HOME path too long\n");
+                       return -2;
+               }
+       }
+       else {
+               fprintf(stderr, "Could not find environment variable 
XDG_CACHE_HOME or HOME to save the backup\n");
+               return -2;
+       }
+
+       if (!glue_strings(backup_dir, sizeof backup_dir, backup_dir,
+                       "crontab", '/')) {
+               fprintf(stderr, "backup path too long\n");
+               return -2;
+       }
+
+       /* create backup file */
+       if (!glue_strings(backup_path, sizeof backup_path, backup_dir,
+                       "crontab", '/')) {
+               fprintf(stderr, "backup path too long\n");
+               return -2;
+       }
+
+       if (getuid() != pw->pw_uid) { // verify if -u is used
+               if (!glue_strings(backup_path, sizeof backup_path, backup_path,
+                               User, '.')) {
+                       fprintf(stderr, "backup path too long\n");
+                       return -2;
+               }
+       }
+
+       if (!glue_strings(backup_path, sizeof backup_path, backup_path,
+                       "bak", '.')) {
+               fprintf(stderr, "backup path too long\n");
+               return -2;
+       }
+
+       /* perform the backup */
+       if ((crontab_file = fopen(crontab_path, "r")) == NULL) {
+               if (errno != ENOENT) {
+                       perror(crontab_path);
+                       exit(ERROR_EXIT);
+               }
+               return -1;
+       }
+       
+       if (swap_uids() == -1) {
+               perror("swapping uids");
+               exit(ERROR_EXIT);
+       }
+
+       if (stat(backup_dir, &sb) < OK && errno == ENOENT) {
+               if (OK != mkdir(backup_dir, 0755)) {
+                       fprintf(stderr, "%s: ", backup_dir);
+                       perror("mkdir");
+                       retval = -2;
+                       goto swapback;
+               }
+       }
+       
+       if ((backup_file = fopen(backup_path, "w+")) == NULL) {
+               fprintf(stderr, "Failed to write to the backup file: ");
+               perror(backup_path);
+               retval = -2;
+               goto swapback;
+       }
+
+       swapback:
+       if (swap_uids_back() < OK) {
+               perror("swapping uids back");
+               exit(ERROR_EXIT);
+       }
+
+       if (retval != 0)
+               return retval;
+
+       if (EOF != ch)
+               while (EOF != (ch = get_char(crontab_file)))
+                       putc(ch, backup_file);
+
+       (void) fclose(crontab_file);
+       (void) fclose(backup_file);
+
+       printf("Backup of %s's previous crontab saved to %s\n", User, 
backup_path);
+
+       return 0;
+}
+
 static void check_error(const char *msg) {
        CheckErrorCount++;
        fprintf(stderr, "\"%s\":%d: %s\n", Filename, LineNumber - 1, msg);
@@ -906,6 +1019,9 @@
                error = -2;
                goto done;
        }
+
+       backup_crontab(n);
+
        if (rename(TempFilename, n)) {
                fprintf(stderr, "%s: error renaming %s to %s\n",
                        ProgramName, TempFilename, n);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cronie-cronie-1.6.1/src/do_command.c 
new/cronie-cronie-1.7.0/src/do_command.c
--- old/cronie-cronie-1.6.1/src/do_command.c    2022-04-25 14:46:41.000000000 
+0200
+++ new/cronie-cronie-1.7.0/src/do_command.c    2023-10-13 10:59:54.000000000 
+0200
@@ -30,6 +30,7 @@
 #include <string.h>
 #include <sys/wait.h>
 #include <unistd.h>
+#include <dirent.h>
 
 #include "externs.h"
 #include "funcs.h"
@@ -94,6 +95,7 @@
        char mailfrom_expanded[MAX_EMAILSTR];
        int children = 0;
        pid_t pid = getpid();
+       pid_t jobpid = -1;
        struct sigaction sa;
 
        /* Ignore SIGPIPE as we will be writing to pipes and do not want to 
terminate
@@ -199,7 +201,7 @@
 
        /* fork again, this time so we can exec the user's command.
         */
-       switch (fork()) {
+       switch (jobpid = fork()) {
        case -1:
                log_it("CRON", pid, "CAN'T FORK", "child_process", errno);
                return ERROR_EXIT;
@@ -263,10 +265,26 @@
                {
                        char *shell = env_get("SHELL", jobenv);
                        int fd, fdmax = TMIN(getdtablesize(), MAX_CLOSE_FD);
+                       DIR *dir;
+                       struct dirent *dent;
 
-                       /* close all unwanted open file descriptors */
-                       for(fd = STDERR + 1; fd < fdmax; fd++) {
-                               close(fd);
+                       /*
+                        * if /proc is mounted, we can optimize what fd can be 
closed,
+                        * but if it isn't available, fall back to the previous 
behavior.
+                        */
+                       if ((dir = opendir("/proc/self/fd")) != NULL) {
+                               while ((dent = readdir(dir)) != NULL) {
+                                       if (!strcmp(dent->d_name, ".") || 
!strcmp(dent->d_name, ".."))
+                                               continue;
+                                       fd = atoi(dent->d_name);
+                                       if (fd > STDERR_FILENO)
+                                               close(fd);
+                               }
+                       } else {
+                               /* close all unwanted open file descriptors */
+                               for (fd = STDERR + 1; fd < fdmax; fd++) {
+                                       close(fd);
+                               }
                        }
 
 #if DEBUGGING
@@ -453,7 +471,7 @@
                                if (MailCmd[0] == '\0') {
                                        int len;
 
-                                       len = snprintf(mailcmd, sizeof mailcmd, 
MAILFMT, MAILARG, mailfrom);
+                                       len = snprintf(mailcmd, sizeof mailcmd, 
MAILFMT, MAILARG);
                                        if (len < 0) {
                                                fprintf(stderr, "mailcmd 
snprintf failed\n");
                                                (void) _exit(ERROR_EXIT);
@@ -552,10 +570,35 @@
                                }
 #endif
                        }
-                       /* only close pipe if we opened it -- i.e., we're
-                        * mailing...
+                       /* if -n option was specified, abort the sending
+                        * now when we read all of the command output
+                        * and thus can wait for it's exit status
                         */
+                       if (mail && e->flags & MAIL_WHEN_ERR) {
+                               int jobstatus = -1;
+                               if (jobpid > 0) {
+                                       while (waitpid(jobpid, &jobstatus, 
WNOHANG) == -1) {
+                                               if (errno == EINTR) continue;
+                                               log_it("CRON", getpid(), 
"error", "invalid job pid", errno);
+                                               break;
+                                       }
+                               } else {
+                                       log_it("CRON", getpid(), "error", 
"invalid job pid", 0);
+                               }
 
+                               /* if everything went well, -n is set, and we 
have mail,
+                                * we won't be mailing – so shoot the 
messenger!
+                                */
+                               if (WIFEXITED(jobstatus) && 
WEXITSTATUS(jobstatus) == EXIT_SUCCESS) {
+                                       Debug(DPROC, ("[%ld] aborting pipe to 
mail\n", (long)getpid()));
+                                       status = cron_pabort(mail);
+                                       mail = NULL;
+                               }
+                       }
+
+                       /* only close pipe if we opened it -- i.e., we're 
(still)
+                        * mailing...
+                        */
                        if (mail) {
                                Debug(DPROC, ("[%ld] closing pipe to mail\n", 
(long) getpid()));
                                        /* Note: the pclose will probably see
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cronie-cronie-1.6.1/src/entry.c 
new/cronie-cronie-1.7.0/src/entry.c
--- old/cronie-cronie-1.6.1/src/entry.c 2022-04-25 14:46:41.000000000 +0200
+++ new/cronie-cronie-1.7.0/src/entry.c 2023-10-13 10:59:54.000000000 +0200
@@ -376,11 +376,11 @@
                char *defpath;
 
                if (ChangePath)
-                       defpath = _PATH_DEFPATH;
+                       defpath = _PATH_STDPATH;
                else {
                        defpath = getenv("PATH");
                        if (defpath == NULL)
-                               defpath = _PATH_DEFPATH;
+                               defpath = _PATH_STDPATH;
                }
 
                if (glue_strings(envstr, sizeof envstr, "PATH", defpath, '=')) {
@@ -417,6 +417,37 @@
 
        Debug(DPARS, ("load_entry()...about to parse command\n"));
 
+       /* If the first character of the command is '-', it is a cron option. */
+       ch = get_char(file);
+       while (ch == '-') {
+               switch (ch = get_char(file)) {
+                       case 'n':
+                               /* only allow user to set the option once */
+                               if ((e->flags & MAIL_WHEN_ERR) == 
MAIL_WHEN_ERR) {
+                                       ecode = e_option;
+                                       goto eof;
+                               }
+                               e->flags |= MAIL_WHEN_ERR;
+                               break;
+
+                       default:
+                               ecode = e_option;
+                               goto eof;
+               }
+
+               ch = get_char(file);
+               if (ch != '\t' && ch != ' ') {
+                       ecode = e_option;
+                       goto eof;
+               }
+               Skip_Blanks(ch, file);
+               if (ch == EOF || ch == '\n') {
+                       ecode = e_cmd;
+                       goto eof;
+               }
+       }
+       unget_char(ch, file);
+
        /* Everything up to the next \n or EOF is part of the command...
         * too bad we don't know in advance how long it will be, since we
         * need to malloc a string for it... so, we limit it to MAX_COMMAND.
@@ -523,29 +554,29 @@
         *         | [number] "~" [number]
         */
        
-       int ch, i, num1, num2, num3;
+       int ch, i, low_, high_, step;
 
        /* default value for step
         */
-       num3 = 1;
+       step = 1;
        range_state_t state = R_START;
 
        while (state != R_FINISH && ((ch = get_char(file)) != EOF)) {
                switch (state) {
                        case R_START:
                                if (ch == '*') {
-                                       num1 = low;
-                                       num2 = high;
+                                       low_ = low;
+                                       high_ = high;
                                        state = R_AST;
                                        break;
                                }
                                if (ch == '~') {
-                                       num1 = low;
+                                       low_ = low;
                                        state = R_RANDOM;
                                        break;
                                }
                                unget_char(ch, file);
-                               if (get_number(&num1, low, names, file) != EOF) 
{
+                               if (get_number(&low_, low, names, file) != EOF) 
{
                                        state = R_NUM1;
                                        break;
                                }
@@ -564,8 +595,8 @@
 
                        case R_STEP:
                                unget_char(ch, file);
-                               if (get_number(&num3, 0, PPC_NULL, file) != EOF
-                                   && num3 != 0) {
+                               if (get_number(&step, 0, PPC_NULL, file) != EOF
+                                   && step != 0) {
                                        state = R_TERMS;
                                        break;
                                }
@@ -588,7 +619,7 @@
                                        break;
                                }
                                if (is_separator(ch)) {
-                                       num2 = num1;
+                                       high_ = low_;
                                        state = R_FINISH;
                                        break;
                                }
@@ -596,7 +627,7 @@
 
                        case R_RANGE:
                                unget_char(ch, file);
-                               if (get_number(&num2, low, names, file) != EOF) 
{
+                               if (get_number(&high_, low, names, file) != 
EOF) {
                                        state = R_RANGE_NUM2;
                                        break;
                                }
@@ -615,11 +646,11 @@
 
                        case R_RANDOM:
                                if (is_separator(ch)) {
-                                       num2 = high;
+                                       high_ = high;
                                        state = R_FINISH;
                                }
                                else if (unget_char(ch, file),
-                                               get_number(&num2, low, names, 
file) != EOF) {
+                                               get_number(&high_, low, names, 
file) != EOF) {
                                        state = R_TERMS;
                                }
                                /* fail if couldn't find match on previous term
@@ -628,12 +659,12 @@
                                        return (EOF);
 
                                /* if invalid random range was selected */
-                               if (num1 > num2)
+                               if (low_ > high_)
                                        return (EOF);
 
-                               /* select random number in range <num1, num2>
+                               /* select random number in range <low_, high_>
                                 */
-                               num1 = num2 = random() % (num2 - num1 + 1) + 
num1;
+                               low_ = high_ = random() % (high_ - low_ + 1) + 
low_;
                                break;
 
 
@@ -646,7 +677,13 @@
        if (state != R_FINISH || ch == EOF)
                return (EOF);
 
-       for (i = num1; i <= num2; i += num3)
+       /* Make sure the step size makes any sense */
+       if (step > 1 && step > (high_ - low_)) {
+               int max =  high_ - low_ > 0 ? high_ - low_ : 1;
+               fprintf(stderr, "Warning: Step size %i higher than possible 
maximum of %i\n", step, max);
+       }
+
+       for (i = low_; i <= high_; i += step)
                if (EOF == set_element(bits, low, high, i)) {
                        unget_char(ch, file);
                        return (EOF);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cronie-cronie-1.6.1/src/funcs.h 
new/cronie-cronie-1.7.0/src/funcs.h
--- old/cronie-cronie-1.6.1/src/funcs.h 2022-04-25 14:46:41.000000000 +0200
+++ new/cronie-cronie-1.7.0/src/funcs.h 2023-10-13 10:59:54.000000000 +0200
@@ -67,6 +67,7 @@
                swap_uids_back(void),
                load_env(char *, FILE *),
                env_set_from_environ(char ***envpp),
+               cron_pabort(FILE *),
                cron_pclose(FILE *),
                glue_strings(char *, size_t, const char *, const char *, char),
                strcmp_until(const char *, const char *, char),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cronie-cronie-1.6.1/src/pathnames.h 
new/cronie-cronie-1.7.0/src/pathnames.h
--- old/cronie-cronie-1.6.1/src/pathnames.h     2022-04-25 14:46:41.000000000 
+0200
+++ new/cronie-cronie-1.7.0/src/pathnames.h     2023-10-13 10:59:54.000000000 
+0200
@@ -53,8 +53,8 @@
 # define _PATH_BSHELL "/bin/sh"
 #endif
 
-#ifndef _PATH_DEFPATH
-# define _PATH_DEFPATH "/usr/bin:/bin"
+#ifndef _PATH_STDPATH
+# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
 #endif
 
 #ifndef _PATH_TMP
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cronie-cronie-1.6.1/src/popen.c 
new/cronie-cronie-1.7.0/src/popen.c
--- old/cronie-cronie-1.6.1/src/popen.c 2022-04-25 14:46:41.000000000 +0200
+++ new/cronie-cronie-1.7.0/src/popen.c 2023-10-13 10:59:54.000000000 +0200
@@ -167,7 +167,7 @@
        return (iop);
 }
 
-int cron_pclose(FILE * iop) {
+static int cron_finalize(FILE * iop, int sig) {
        int fdes;
        sigset_t oset, nset;
        WAIT_T stat_loc;
@@ -180,7 +180,12 @@
        fdes = fileno(iop);
        if (pids == NULL || fdes >= fds || pids[fdes] == 0L)
                return (-1);
-       (void) fclose(iop);
+       
+       if (!sig) {
+               (void) fclose(iop);
+       } else if (kill(pids[fdes], sig) == -1) {
+               return -1;
+       }
 
        sigemptyset(&nset);
        sigaddset(&nset, SIGINT);
@@ -189,6 +194,28 @@
        (void) sigprocmask(SIG_BLOCK, &nset, &oset);
        while ((pid = wait(&stat_loc)) != pids[fdes] && pid != -1) ;
        (void) sigprocmask(SIG_SETMASK, &oset, NULL);
+       
+       if (sig) {
+               (void) fclose(iop);
+       }
        pids[fdes] = 0;
-       return (pid == -1 ? -1 : WEXITSTATUS(stat_loc));
+
+       if (pid < 0) {
+               return pid;
+       }
+
+       if (WIFEXITED(stat_loc)) {
+               return WEXITSTATUS(stat_loc);
+       } else {
+               return WTERMSIG(stat_loc);
+       }
+}
+
+int cron_pclose(FILE * iop) {
+       return cron_finalize(iop, 0);
+}
+
+int cron_pabort(FILE * iop) {
+       int esig = cron_finalize(iop, SIGKILL);
+       return esig == SIGKILL ? 0 : esig;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cronie-cronie-1.6.1/src/structs.h 
new/cronie-cronie-1.7.0/src/structs.h
--- old/cronie-cronie-1.6.1/src/structs.h       2022-04-25 14:46:41.000000000 
+0200
+++ new/cronie-cronie-1.7.0/src/structs.h       2023-10-13 10:59:54.000000000 
+0200
@@ -48,6 +48,7 @@
 #define        DOW_STAR        0x08
 #define        WHEN_REBOOT     0x10
 #define        DONT_LOG        0x20
+#define        MAIL_WHEN_ERR   0x40
 } entry;
 
                        /* the crontab database will be a list of the

++++++ cronie-crond_pid.diff ++++++
--- /var/tmp/diff_new_pack.OYN21b/_old  2023-12-21 23:38:15.517761372 +0100
+++ /var/tmp/diff_new_pack.OYN21b/_new  2023-12-21 23:38:15.521761518 +0100
@@ -1,8 +1,8 @@
-Index: cronie-1.4.4/src/pathnames.h
+Index: cronie-cronie-1.7.0/src/pathnames.h
 ===================================================================
---- cronie-1.4.4.orig/src/pathnames.h
-+++ cronie-1.4.4/src/pathnames.h
-@@ -41,7 +41,7 @@
+--- cronie-cronie-1.7.0.orig/src/pathnames.h
++++ cronie-cronie-1.7.0/src/pathnames.h
+@@ -45,7 +45,7 @@
  #  define PIDDIR SYSCONFDIR "/"
  # endif
  #endif

++++++ cronie-nheader_lines.diff ++++++
--- /var/tmp/diff_new_pack.OYN21b/_old  2023-12-21 23:38:15.533761956 +0100
+++ /var/tmp/diff_new_pack.OYN21b/_new  2023-12-21 23:38:15.533761956 +0100
@@ -43,7 +43,7 @@
        while (EOF != (ch = get_char(f))) {
                if (colorize) {
                        if (!in_comment && new_line && ch == '#') {
-@@ -533,7 +549,7 @@ static void edit_cmd(void) {
+@@ -646,7 +662,7 @@ static void edit_cmd(void) {
        char n[MAX_FNAME], q[MAX_TEMPSTR];
        const char *editor;
        FILE *f;
@@ -52,7 +52,7 @@
        struct stat statbuf;
        struct utimbuf utimebuf;
        WAIT_T waiter;
-@@ -585,10 +601,20 @@ static void edit_cmd(void) {
+@@ -698,10 +714,20 @@ static void edit_cmd(void) {
        }
  
        Set_LineNum(1);
@@ -76,7 +76,7 @@
        /* copy the rest of the crontab (if any) to the temp file.
         */
        if (EOF != ch)
-@@ -812,6 +838,7 @@ static int replace_cmd(void) {
+@@ -925,6 +951,7 @@ static int replace_cmd(void) {
        int ch, fd;
        int error = 0;
        uid_t file_owner;
@@ -84,7 +84,7 @@
        char *safename;
  
        safename = host_specific_filename("#tmp", "XXXXXXXXXX");
-@@ -839,10 +866,10 @@ static int replace_cmd(void) {
+@@ -952,10 +979,10 @@ static int replace_cmd(void) {
         *
         * VERY IMPORTANT: make sure NHEADER_LINES agrees with this code.
         */

++++++ cronie-pam_config-nonlogin.diff ++++++
---
 pam/crond |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: cronie-cronie-1.7.0/pam/crond
===================================================================
--- cronie-cronie-1.7.0.orig/pam/crond
+++ cronie-cronie-1.7.0/pam/crond
@@ -10,4 +10,4 @@ auth     include        common-auth
 account  include        common-account
 password include        common-password
 session  optional       pam_keyinit.so force revoke
-session  include        common-session
+session  include        common-session-nonlogin

++++++ cronie-pam_config.diff ++++++
--- /var/tmp/diff_new_pack.OYN21b/_old  2023-12-21 23:38:15.553762685 +0100
+++ /var/tmp/diff_new_pack.OYN21b/_new  2023-12-21 23:38:15.557762831 +0100
@@ -1,7 +1,7 @@
-Index: cronie-cronie-1.5.4/pam/crond
+Index: cronie-cronie-1.7.0/pam/crond
 ===================================================================
---- cronie-cronie-1.5.4.orig/pam/crond
-+++ cronie-cronie-1.5.4/pam/crond
+--- cronie-cronie-1.7.0.orig/pam/crond
++++ cronie-cronie-1.7.0/pam/crond
 @@ -4,8 +4,10 @@
  #
  # Although no PAM authentication is called, auth modules

++++++ fix-manpage-replace-anacrontab-with-crontab.patch ++++++
--- /var/tmp/diff_new_pack.OYN21b/_old  2023-12-21 23:38:15.577763560 +0100
+++ /var/tmp/diff_new_pack.OYN21b/_new  2023-12-21 23:38:15.581763706 +0100
@@ -9,11 +9,11 @@
  man/cron.8 | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
-diff --git a/man/cron.8 b/man/cron.8
-index 633dbc0..9716f8f 100644
---- a/man/cron.8
-+++ b/man/cron.8
-@@ -53,7 +53,7 @@ for crontab files which are named after accounts in
+Index: cronie-cronie-1.7.0/man/cron.8
+===================================================================
+--- cronie-cronie-1.7.0.orig/man/cron.8
++++ cronie-cronie-1.7.0/man/cron.8
+@@ -56,7 +56,7 @@ for crontab files which are named after
  The found crontabs are loaded into the memory.
  .I Cron
  also searches for
@@ -22,7 +22,4 @@
  and any files in the
  .I /etc/cron.d
  directory, which have a different format (see
--- 
-1.8.4.5
-
 

Reply via email to