Bug#1106860: unblock: anacron/2.3-43
Control: tags -1 confirmed
On 2025-05-30 22:22:24 +0700, Lin Qigang wrote:
> Package: release.debian.org
> Severity: normal
> X-Debbugs-Cc: anacron@packages.debian.org
> Control: affects -1 + src:anacron
> User: release.debian.org@packages.debian.org
> Usertags: unblock
>
> Please unblock package anacron
>
> [ Reason ]
> There are two anacron bugs this release fixes. One bug is now
> set to important, and the other bug is normal severity. The normal
> bug is a small targeted fix that should not cause issues.
>
> [ Impact ]
> Bug#1092269: Temporary files anacron generates will not be removed
> during a run.
>
> Bug#1106000: An error message will appear in the journal when anacron
> is purged.
>
> [ Tests ]
> I manually tested that temporary files are removed automatically.
> The systemd-cron maintainer tested purging anacron.
>
> [ Risks ]
> There should be no risk with this update.
>
> [ Checklist ]
> [X] all changes are documented in the d/changelog
> [X] I reviewed all changes and I approve them
> [X] attach debdiff against the package in testing
>
> [ Other info ]
> There are other small changes to debian files that should not be an
> issue to update.
Please go ahead without these additional changes. We are in hard freeze
which means only targetted fixes. So please only include the two fixes
for #1092269 and 1106000 in your upload.
Cheers
>
> unblock anacron/2.3-43
>
> --
> Lance Lin
> GPG Fingerprint: 4A31 DB5A 1EE4 096C 8739 9880 9036 4929 4C33 F9B7
> diff -Nru anacron-2.3/debian/changelog anacron-2.3/debian/changelog
> --- anacron-2.3/debian/changelog 2025-02-25 19:38:16.000000000 +0700
> +++ anacron-2.3/debian/changelog 2025-05-30 19:40:55.000000000 +0700
> @@ -1,3 +1,20 @@
> +anacron (2.3-43) unstable; urgency=medium
> +
> + [ Christian Goeschel Ndjomouo ]
> + * global.h, runjob.c: Clean up temporary files (Closes: #1092269)
> +
> + [ Lance Lin ]
> + * d/copyright: Update for debian/* copyright to include 2025
> + * d/source/local-patch-header: Add Last-Update field for latest
> + updates to single-debian-patch
> + * d/control: Update standards version to 4.7.2
> +
> + [ наб ]
> + * d/cron.d: move [ -x test into if so it doesn't fail the job if it
> + fails (Closes: #1106000)
> +
> + -- Lance Lin <lq27267@gmail.com> Fri, 30 May 2025 19:40:55 +0700
> +
> anacron (2.3-42) unstable; urgency=medium
>
> * main.c: Fix FTBFS with GCC-15
> diff -Nru anacron-2.3/debian/control anacron-2.3/debian/control
> --- anacron-2.3/debian/control 2025-02-25 19:25:35.000000000 +0700
> +++ anacron-2.3/debian/control 2025-04-26 19:19:13.000000000 +0700
> @@ -4,7 +4,7 @@
> Build-Depends:
> debhelper-compat (= 13)
> Maintainer: Lance Lin <lq27267@gmail.com>
> -Standards-Version: 4.7.0
> +Standards-Version: 4.7.2
> Rules-Requires-Root: no
> Homepage: http://sourceforge.net/projects/anacron/
> Vcs-Git: https://salsa.debian.org/debian/anacron.git
> diff -Nru anacron-2.3/debian/copyright anacron-2.3/debian/copyright
> --- anacron-2.3/debian/copyright 2025-02-25 19:25:35.000000000 +0700
> +++ anacron-2.3/debian/copyright 2025-04-26 19:01:28.000000000 +0700
> @@ -9,7 +9,7 @@
>
> Files: debian/*
> Copyright: 1999-2023 Sean 'Shaleh' Perry <shaleh@debian.org>
> - 2024 Lance Lin <lq27267@gmail.com>
> + 2024-2025 Lance Lin <lq27267@gmail.com>
> License: GPL-2+
>
> License: GPL-2+
> diff -Nru anacron-2.3/debian/cron.d anacron-2.3/debian/cron.d
> --- anacron-2.3/debian/cron.d 2025-02-25 19:25:35.000000000 +0700
> +++ anacron-2.3/debian/cron.d 2025-05-19 22:21:58.000000000 +0700
> @@ -3,4 +3,4 @@
> SHELL=/bin/sh
> PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
>
> -30 7-23 * * * root [ -x /etc/init.d/anacron ] && if [ ! -d /run/systemd/system ]; then /usr/sbin/invoke-rc.d anacron start >/dev/null; fi
> +30 7-23 * * * root if [ -x /etc/init.d/anacron ] && ! [ -d /run/systemd/system ]; then exec /usr/sbin/invoke-rc.d anacron start >/dev/null; fi
> diff -Nru anacron-2.3/debian/patches/debian-changes anacron-2.3/debian/patches/debian-changes
> --- anacron-2.3/debian/patches/debian-changes 2025-02-25 19:38:16.000000000 +0700
> +++ anacron-2.3/debian/patches/debian-changes 2025-05-30 19:40:55.000000000 +0700
> @@ -535,7 +535,7 @@
>
> This program is free software; you can redistribute it and/or modify
> it under the terms of the GNU General Public License as published by
> -@@ -53,9 +54,11 @@ typedef struct env_rec1 env_rec;
> +@@ -53,9 +54,12 @@ typedef struct env_rec1 env_rec;
>
> struct job_rec1 {
> int period;
> @@ -544,10 +544,11 @@
> char *ident;
> char *command;
> + char *mailto;
> ++ char *temp_file_path;
>
> int tab_line;
> int arg_num;
> -@@ -75,9 +78,10 @@ typedef struct job_rec1 job_rec;
> +@@ -75,9 +79,10 @@ typedef struct job_rec1 job_rec;
> extern pid_t primary_pid;
> extern char *program_name;
> extern char *anacrontab;
> @@ -559,7 +560,7 @@
> extern int day_now;
> extern int year,month,day_of_month;
> extern int in_background;
> -@@ -93,6 +97,9 @@ extern job_rec **job_array;
> +@@ -93,6 +98,9 @@ extern job_rec **job_array;
>
> extern int running_jobs,running_mailers;
>
> @@ -569,7 +570,7 @@
>
> /* Function prototypes */
>
> -@@ -121,7 +128,7 @@ void xcloselog();
> +@@ -121,7 +129,7 @@ void xcloselog();
> #endif /* not DEBUG */
>
> /* readtab.c */
> @@ -1232,37 +1233,49 @@
> obstack_grow(&tab_o, &j, sizeof(j));
> --- anacron-2.3.orig/runjob.c
> +++ anacron-2.3/runjob.c
> -@@ -40,25 +40,18 @@ temp_file()
> +@@ -36,29 +36,30 @@
> + #include "global.h"
> +
> + static int
> +-temp_file()
> ++temp_file(job_rec *jr)
> /* Open a temporary file and return its file descriptor */
> {
> const int max_retries = 50;
> -- char *name;
> -+ char template[] = "/tmp/anacron-XXXXXX";
> + char *name;
> ++ char template[] = "/tmp/anacron-XXXXXXX";
> int fd, i;
>
> - i = 0;
> -- name = NULL;
> +- i = 0;
> + name = NULL;
> ++ i = 0;
> do
> {
> - i++;
> +- i++;
> - free(name);
> - name = tempnam(NULL, NULL);
> - if (name == NULL) die("Can't find a unique temporary filename");
> - fd = open(name, O_RDWR | O_CREAT | O_EXCL | O_APPEND,
> - S_IRUSR | S_IWUSR);
> -+ fd = mkstemp(template);
> ++ i++;
> ++ free(name);
> ++ name = mktemp(template);
> ++ if (name == NULL) die("Can't find a unique temporary filename");
> ++ fd = open(name, O_RDWR | O_CREAT | O_EXCL | O_APPEND,
> ++ S_IRUSR | S_IWUSR);
> ++
> /* I'm not sure we actually need to be so persistent here */
> -- } while (fd == -1 && errno == EEXIST && i < max_retries);
> -+ } while (fd == -1 && i < max_retries);
> + } while (fd == -1 && errno == EEXIST && i < max_retries);
>
> - if (fd == -1) die_e("Can't open temporary file");
> - if (unlink(name)) die_e("Can't unlink temporary file");
> - free(name);
> + if (fd == -1) die_e("Failed to create and open unique temporary filename");
> ++ jr->temp_file_path = strdup(name);
> fcntl(fd, F_SETFD, 1); /* set close-on-exec flag */
> return fd;
> }
> -@@ -84,7 +77,7 @@ username()
> +@@ -84,7 +85,7 @@ username()
> }
>
> static void
> @@ -1271,7 +1284,7 @@
> {
> if (putenv(s)) die_e("Can't set the environment");
> }
> -@@ -109,7 +102,6 @@ static void
> +@@ -109,7 +110,6 @@ static void
> run_job(const job_rec *jr)
> /* This is called to start the job, after the fork */
> {
> @@ -1279,7 +1292,7 @@
> /* setup stdout and stderr */
> xclose(1);
> xclose(2);
> -@@ -153,6 +145,14 @@ static void
> +@@ -153,6 +153,14 @@ static void
> launch_mailer(job_rec *jr)
> {
> pid_t pid;
> @@ -1294,7 +1307,7 @@
>
> pid = xfork();
> if (pid == 0)
> -@@ -173,7 +173,7 @@ launch_mailer(job_rec *jr)
> +@@ -173,7 +181,7 @@ launch_mailer(job_rec *jr)
> * options, which don't seem to be appropriate here.
> * Hopefully, this will keep all the MTAs happy. */
> execl(SENDMAIL, SENDMAIL, "-FAnacron", "-odi",
> @@ -1303,7 +1316,7 @@
> die_e("Can't exec " SENDMAIL);
> }
> /* parent */
> -@@ -187,7 +187,7 @@ tend_mailer(job_rec *jr, int status)
> +@@ -187,7 +195,7 @@ tend_mailer(job_rec *jr, int status)
> {
> if (WIFEXITED(status) && WEXITSTATUS(status) != 0)
> complain("Tried to mail output of job `%s', "
> @@ -1312,7 +1325,7 @@
> jr->ident, WEXITSTATUS(status));
> else if (!WIFEXITED(status) && WIFSIGNALED(status))
> complain("Tried to mail output of job `%s', "
> -@@ -207,19 +207,47 @@ launch_job(job_rec *jr)
> +@@ -207,19 +215,47 @@ launch_job(job_rec *jr)
> {
> pid_t pid;
> int fd;
> @@ -1335,7 +1348,8 @@
> + jr->mailto = username ();
>
> /* create temporary file for stdout and stderr of the job */
> - fd = jr->output_fd = temp_file();
> +- fd = jr->output_fd = temp_file();
> ++ fd = jr->output_fd = temp_file(jr);
> /* write mail header */
> xwrite(fd, "From: ");
> + xwrite(fd, "Anacron <");
> @@ -1363,3 +1377,11 @@
> jr->mail_header_size = file_size(fd);
>
> pid = xfork();
> +@@ -263,6 +299,7 @@ tend_job(job_rec *jr, int status)
> + jr->job_pid = 0;
> + running_jobs--;
> + if (mail_output) launch_mailer(jr);
> ++ if (unlink(jr->temp_file_path)) die_e("Can't unlink temporary file");
> + xclose(jr->output_fd);
> + }
> +
--
Sebastian Ramacher
Reply to: