From 65700164d93a096fc1dc0aeb295e70c8b2225e07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Mon, 2 Dec 2013 16:34:37 +0100 Subject: [PATCH] There are two bugs: 1. It looks like the at command does not validate that it has succeeded to write all data before it makes the file executable (i.e on a disk full an empty file might get created). 2. After 60 minutes (run_time + CHECK_INTERVAL <= now), atd (approx line 750) starts to unlink the lockfile and retries the execution of the job, leaving us with this unfortunate loop. Reproducer: ATD_PID=$(ps -C atd -o pid=) QUEUE=a JOBNO=$(printf '%05x' 123) BAD_TIME=$(expr $(date +%s) / 60 - 61) CTM=$(printf '%08x' $BAD_TIME ) FILENAME=/var/spool/at/${QUEUE}${JOBNO}${CTM} touch $FILENAME chmod 0700 $FILENAME kill -HUP ${ATD_PID} sleep 0.5 ls -l $FILENAME rm -f $FILENAME Thanks to: Anders Blomdell --- at-3.1.14-wrong_format.patch | 23 +++++++++++++++++++++++ at.spec | 10 ++++++---- 2 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 at-3.1.14-wrong_format.patch diff --git a/at-3.1.14-wrong_format.patch b/at-3.1.14-wrong_format.patch new file mode 100644 index 0000000..b2a5ef4 --- /dev/null +++ b/at-3.1.14-wrong_format.patch @@ -0,0 +1,23 @@ +diff -up at-3.1.14/atd.c.seg at-3.1.14/atd.c +--- at-3.1.14/atd.c.seg 2013-12-02 14:33:48.650769756 +0100 ++++ at-3.1.14/atd.c 2013-12-02 14:52:49.057437721 +0100 +@@ -752,14 +752,17 @@ run_loop() + /* Is the file already locked? + */ + if (buf.st_nlink > 1) { +- if (run_time + CHECK_INTERVAL <= now) { +- ++ if (buf.st_mtime + CHECK_INTERVAL <= now) { + /* Something went wrong the last time this was executed. + * Let's remove the lockfile and reschedule. ++ * We also change the timestamp to avoid rerunning the job more ++ * than once every CHECK_INTERVAL. + */ + strncpy(lock_name, dirent->d_name, sizeof(lock_name)); + lock_name[sizeof(lock_name)-1] = '\0'; + lock_name[0] = '='; ++ if (utime(lock_name, 0) < 0) ++ syslog(LOG_ERR, "utime couldn't be set for lock file %s\n", lock_name); + unlink(lock_name); + next_job = now; + nothing_to_do = 0; diff --git a/at.spec b/at.spec index b6e9e65..8658a5e 100644 --- a/at.spec +++ b/at.spec @@ -19,7 +19,7 @@ Source5: atd.systemd Patch1: at-3.1.14-makefile.patch Patch2: at-3.1.14-pam.patch -Patch3: at-3.1.14-selinux.patch +Patch3: at-3.1.14-selinux.patch Patch4: at-3.1.14-opt_V.patch Patch5: at-3.1.14-shell.patch Patch6: at-3.1.14-nitpicks.patch @@ -27,7 +27,8 @@ Patch7: at-3.1.14-nowrap.patch Patch8: at-3.1.14-fix_no_export.patch Patch9: at-3.1.14-mailwithhostname.patch Patch10: at-3.1.14-usePOSIXtimers.patch -Patch11: at-3.1.14-help.patch +Patch11: at-3.1.14-help.patch +Patch12: at-3.1.14-wrong_format.patch BuildRequires: fileutils /etc/init.d BuildRequires: flex flex-static bison autoconf @@ -78,10 +79,10 @@ cp %{SOURCE1} . %patch6 -p1 -b .nit %patch7 -p1 -b .nowrap %patch8 -p1 -b .export - %patch9 -p1 -b .mail %patch10 -p1 -b .posix %patch11 -p1 -b .help +%patch12 -p1 -b .wrong %build # patch9 touches configure.in @@ -188,9 +189,10 @@ chown daemon:daemon %{_localstatedir}/spool/at/.SEQ %attr(0755,root,root) %{_initrddir}/atd %changelog -* Mon Sep 23 2013 Marcela Mašláňová - 3.1.14-1 +* Mon Dec 2 2013 Marcela Mašláňová - 3.1.14-1 - new release 3.1.14 - all Fedora specifics backported +- 718422 File a0000f0149b7f3 is in wrong format - aborting * Sat Aug 03 2013 Fedora Release Engineering - 3.1.13-13 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild