Package: systemd-cron
Version: 1.16.1-1
Severity: normal
Tags: upstream patch

The latest version of this package broke a previously working
cron job:

Jul 27 00:46:21 deadeye systemd[1]: Starting cron-ben-ben-0.service - [Cron] "2 
0 * * * ~/bin/randomsig"...
Jul 27 00:46:21 deadeye sh[14398]: /run/systemd/generator/cron-ben-ben-0.sh: 1: 
/home/benbin/randomsig: not found

Notice that there is no '/' after my home directory.  Patch for
this is attached.

I already opened a PR for this upstream:
https://github.com/systemd-cron/systemd-cron/pull/92

Ben.

-- Package-specific info:
-- output of systemctl list-timers
NEXT                             LEFT LAST                               PASSED 
UNIT                                   ACTIVATES
Thu 2023-07-27 02:13:04 CEST    19min Thu 2023-07-27 01:25:20 CEST    28min ago 
fwupd-refresh.timer                    fwupd-refresh.service
Thu 2023-07-27 03:04:00 CEST 1h 10min Wed 2023-07-26 03:35:54 CEST            - 
plocate-updatedb.timer                 plocate-updatedb.service
Thu 2023-07-27 05:10:00 CEST 3h 16min -                                       - 
cron-popularity-contest-root-0.timer   cron-popularity-contest-root-0.service
Thu 2023-07-27 06:49:53 CEST 4h 56min Wed 2023-07-26 13:53:20 CEST            - 
apt-daily-upgrade.timer                apt-daily-upgrade.service
Thu 2023-07-27 09:37:37 CEST       7h Wed 2023-07-26 03:48:39 CEST            - 
man-db.timer                           man-db.service
Thu 2023-07-27 13:24:19 CEST      11h Wed 2023-07-26 19:58:22 CEST 1h 55min ago 
apt-daily.timer                        apt-daily.service
Thu 2023-07-27 20:16:44 CEST      18h Wed 2023-07-26 15:39:08 CEST 5h 36min ago 
systemd-tmpfiles-clean.timer           systemd-tmpfiles-clean.service
Fri 2023-07-28 00:00:00 CEST      22h Thu 2023-07-27 00:46:21 CEST  1h 7min ago 
dpkg-db-backup.timer                   dpkg-db-backup.service
Fri 2023-07-28 00:00:00 CEST      22h Thu 2023-07-27 00:46:21 CEST  1h 7min ago 
exim4-base.timer                       exim4-base.service
Fri 2023-07-28 00:00:00 CEST      22h Thu 2023-07-27 00:46:21 CEST  1h 7min ago 
logrotate.timer                        logrotate.service
Fri 2023-07-28 00:02:00 CEST      22h Thu 2023-07-27 00:46:21 CEST  1h 7min ago 
cron-ben-ben-0.timer                   cron-ben-ben-0.service
Fri 2023-07-28 00:10:00 CEST      22h Thu 2023-07-27 00:46:21 CEST  1h 7min ago 
cron-daily-0anacron.timer              cron-daily-0anacron.service
Fri 2023-07-28 00:10:00 CEST      22h Thu 2023-07-27 00:46:21 CEST  1h 7min ago 
cron-daily-aptitude.timer              cron-daily-aptitude.service
Fri 2023-07-28 00:10:00 CEST      22h Thu 2023-07-27 00:46:21 CEST  1h 7min ago 
cron-daily-calendar.timer              cron-daily-calendar.service
Fri 2023-07-28 00:10:00 CEST      22h Thu 2023-07-27 00:46:21 CEST  1h 7min ago 
cron-daily-debsums.timer               cron-daily-debsums.service
Fri 2023-07-28 00:10:00 CEST      22h Thu 2023-07-27 00:46:21 CEST  1h 7min ago 
cron-daily-dlocate.timer               cron-daily-dlocate.service
Fri 2023-07-28 00:10:00 CEST      22h Thu 2023-07-27 00:46:21 CEST  1h 7min ago 
cron-daily-installation-birthday.timer cron-daily-installation-birthday.service
Fri 2023-07-28 00:10:00 CEST      22h Thu 2023-07-27 00:46:21 CEST  1h 7min ago 
cron-daily-lighttpd.timer              cron-daily-lighttpd.service
Fri 2023-07-28 00:10:00 CEST      22h Thu 2023-07-27 00:46:21 CEST  1h 7min ago 
cron-daily-popularity-contest.timer    cron-daily-popularity-contest.service
Fri 2023-07-28 00:10:00 CEST      22h Thu 2023-07-27 00:46:21 CEST  1h 7min ago 
cron-daily-prelink.timer               cron-daily-prelink.service
Fri 2023-07-28 00:10:00 CEST      22h Thu 2023-07-27 00:46:21 CEST  1h 7min ago 
cron-daily-sysstat.timer               cron-daily-sysstat.service
Sun 2023-07-30 03:10:36 CEST   3 days Sun 2023-07-23 03:10:50 CEST            - 
e2scrub_all.timer                      e2scrub_all.service
Mon 2023-07-31 00:02:38 CEST   3 days Mon 2023-07-24 00:44:02 CEST            - 
fstrim.timer                           fstrim.service
Mon 2023-07-31 00:15:00 CEST   3 days Mon 2023-07-24 00:15:17 CEST            - 
cron-weekly-0anacron.timer             cron-weekly-0anacron.service
Mon 2023-07-31 00:15:00 CEST   3 days Mon 2023-07-24 00:15:17 CEST            - 
cron-weekly-apt-xapian-index.timer     cron-weekly-apt-xapian-index.service
Mon 2023-07-31 00:15:00 CEST   3 days Mon 2023-07-24 00:15:17 CEST            - 
cron-weekly-debsums.timer              cron-weekly-debsums.service
Mon 2023-07-31 00:15:00 CEST   3 days Mon 2023-07-24 00:15:17 CEST            - 
cron-weekly-tor.timer                  cron-weekly-tor.service
Mon 2023-07-31 00:15:00 CEST   3 days Wed 2023-07-26 14:02:28 CEST            - 
systemd-cron-cleaner.timer             systemd-cron-cleaner.service
Tue 2023-08-01 00:20:00 CEST   4 days Sat 2023-07-08 15:22:45 CEST            - 
cron-monthly-0anacron.timer            cron-monthly-0anacron.service
Tue 2023-08-01 00:20:00 CEST   4 days Sat 2023-07-08 15:22:45 CEST            - 
cron-monthly-debsums.timer             cron-monthly-debsums.service

30 timers listed.
Pass --all to see loaded but inactive timers, too.
-- output of systemd-delta

-- System Information:
Debian Release: trixie/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'stable-updates'), (500, 
'stable-security'), (500, 'oldstable-updates'), (500, 'oldstable-security'), 
(500, 'oldoldstable-updates'), (500, 'oldoldstable'), (500, 'unstable'), (500, 
'stable'), (500, 'oldstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.4.0-1-amd64 (SMP w/12 CPU threads; PREEMPT)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages systemd-cron depends on:
ii  cron-daemon-common          3.0pl1-162
ii  libc6                       2.37-6
ii  python3                     3.11.4-5
ii  systemd [systemd-sysusers]  254~rc3-3
ii  systemd-sysv                254~rc3-3

systemd-cron recommends no packages.

Versions of packages systemd-cron suggests:
ii  exim4                                      4.96-16
ii  exim4-daemon-light [mail-transport-agent]  4.96-16

-- debconf-show failed
>From f139068a8fb06affdad2ba9cceea4a5ca8e40c16 Mon Sep 17 00:00:00 2001
From: Ben Hutchings <b...@debian.org>
Date: Thu, 27 Jul 2023 01:39:25 +0200
Subject: [PATCH] Fix expansion of commands starting with '~/'

We need to replace the '~' with home but keep '/' and everything
afterwards, i.e. slice [1:] from the command.  This was recently
changed to take slice [2:], losing the '/'.

Fixes: 9ef7b89523e8 ("keep job.command as a List[str] all along")
---
 src/bin/systemd-crontab-generator.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/systemd-crontab-generator.py 
b/src/bin/systemd-crontab-generator.py
index 785e977..4a3708a 100755
--- a/src/bin/systemd-crontab-generator.py
+++ b/src/bin/systemd-crontab-generator.py
@@ -276,7 +276,7 @@ CROND2TIMER = {
             pass
         if self.home:
             if self.command[0].startswith('~/'):
-                self.command[0] = self.home + self.command[0][2:]
+                self.command[0] = self.home + self.command[0][1:]
 
             if 'PATH' in self.environment:
                 parts = self.environment['PATH'].split(':')

Reply via email to