Package: systemd-cron
Version: 1.3.1+ds1-1
Severity: important

Ranges without steps (1-12) are not correctly parsed by 
systemd-crontab-generator.

For example, the line:

55-59 11 * * 1-6        true

results in the following:

$ ./systemd-crontab-generator /tmp/test
Traceback (most recent call last):
  File "./systemd-crontab-generator", line 273, in <module>
    for job in parse_crontab(filename, withuser=False):
  File "./systemd-crontab-generator", line 125, in parse_crontab
    'm': parse_time_unit(minutes, MINUTES_SET),
  File "./systemd-crontab-generator", line 138, in parse_time_unit
    map(parse_period(mapping), value.split(','))), set())))
  File "./systemd-crontab-generator", line 157, in parser
    value = mapping(value)
ValueError: invalid literal for int() with base 10: '55-59'

The attached patch fixes the issue.

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (900, 'unstable'), (800, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages systemd-cron depends on:
ii  init-system-helpers  1.21
ii  python               2.7.8-1
pn  python:any           <none>
ii  systemd-sysv         215-5+b1

systemd-cron recommends no packages.

systemd-cron suggests no packages.
--- systemd-crontab-generator.Orig	2014-10-22 14:53:01.915149745 +0200
+++ systemd-crontab-generator	2014-10-22 14:57:04.614228021 +0200
@@ -154,8 +154,8 @@
         try:
             range, step = value.split('/')
         except ValueError:
-            value = mapping(value)
-            return slice(value, value + 1)
+            range = value
+            step = 1
 
         if range == '*':
             return slice(None, None, int(step))

Reply via email to