Bug#929763: runs backup files

Trent W. Buck trentbuck at gmail.com
Thu May 30 16:44:49 BST 2019


Package: systemd-cron
Version: 1.5.14-2
Severity: normal

This log strongly indicates systemd-cron is trying to "do things" with backup files:

    2019-05-31T01:29:30+1000 not-omega systemd[1]: cron.target: Wants dependency dropin /run/systemd/generator/cron.target.wants/cron-ntpsec~-root-0.timer is not a valid unit name, ignoring.

This happened after I edited /etc/cron.d/ntpsec-ntpviz, thereby creating a backup file /etc/cron.d/ntpsec-ntpviz~.

    https://manpages.debian.org/stretch/cron/cron.8.en.html#DEBIAN_SPECIFIC
    https://manpages.debian.org/run-parts

Vixie cron ignores backups in /etc/cron.d/, so systemd-cron should, too.
The actual code in Vixie cron is below; it's the same as run-parts(8).
systemd-cron needs similar logic.

    pathnames.h:#define SYSCRONDIR      "/etc/cron.d"

    database.c:     if (!(dir = opendir(SYSCRONDIR))) {

    database.c:	while (dir != NULL && NULL != (dp = readdir(dir))) {

    database.c:		/* skipfile names with letters outside the set
    database.c:		 * [A-Za-z0-9_-], like run-parts.
    database.c:		 */
    database.c:		if (!valid_name(dp->d_name))
    database.c:		  continue;


    database.c:/* True or false? Is this a valid filename? */
    database.c:
    database.c:/* Taken from Clint Adams 'run-parts' version to support lsb style
    database.c:   names, originally GPL, but relicensed to cron license per e-mail of
    database.c:   27 September 2003. I've changed it to do regcomp() only once. */
    database.c:
    database.c:static int
    database.c:valid_name(char *filename)
    database.c:{
    database.c:  static regex_t hierre, tradre, excsre, classicalre;
    database.c:  static int donere = 0;
    database.c:
    database.c:  if (!donere) {
    database.c:      donere = 1;
    database.c:      if (regcomp(&hierre, "^_?([a-z0-9_.]+-)+[a-z0-9]+$",
    database.c:                  REG_EXTENDED | REG_NOSUB)
    database.c:          || regcomp(&excsre, "^[a-z0-9-].*dpkg-(old|dist)$",
    database.c:                     REG_EXTENDED | REG_NOSUB)
    database.c:          || regcomp(&tradre, "^[a-z0-9][a-z0-9-]*$", REG_NOSUB)
    database.c:          || regcomp(&classicalre, "^[a-zA-Z0-9_-]+$",
    database.c:                     REG_EXTENDED | REG_NOSUB)) {
    database.c:          log_it("CRON", getpid(), "REGEX FAILED", "valid_name");
    database.c:          (void) exit(ERROR_EXIT);
    database.c:      }
    database.c:  }
    database.c:  if (lsbsysinit_mode) {
    database.c:      if (!regexec(&hierre, filename, 0, NULL, 0)) {
    database.c:          return regexec(&excsre, filename, 0, NULL, 0);
    database.c:      } else {
    database.c:          return !regexec(&tradre, filename, 0, NULL, 0);
    database.c:      }
    database.c:  }
    database.c:  /* Old standard style */
    database.c:  return !regexec(&classicalre, filename, 0, NULL, 0);
    database.c:}



More information about the Pkg-systemd-maintainers mailing list