Bug 55980 - config registry warns about valid cron entries
Summary: config registry warns about valid cron entries
Status: RESOLVED INVALID
Alias: None
Product: UCS
Classification: Unclassified
Component: UCR
Version: UCS 5.0
Hardware: Other All
: P5 normal
Target Milestone: ---
Assignee: UCS maintainers
QA Contact: UCS maintainers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-17 21:18 CEST by Moritz Bunkus
Modified: 2023-04-18 09:37 CEST (History)
1 user (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 1: Cosmetic issue or missing function but workaround exists
Who will be affected by this bug?: 1: Will affect a very few installed domains
How will those affected feel about the bug?: 1: Nuisance – not a big deal but noticeable
User Pain: 0.006
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Customer ID:
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Moritz Bunkus 2023-04-17 21:18:11 CEST
Setting variables that have type "cron" such as "update/check/cron/entry" to values containing a name-based range such as "5 4 * * Thu,Fri" emits a warning that the value is invalid. This is not be a huge problem with the univention-config-registry program as it still exits with code 0. However, the check is still wrong.

More problematic is that the "univention_config_registry" Ansible plugin from the "ucs_modules" collection fails due to stuff being emitted on STDERR, and I'm pretty sure the same validation code is used for both.

How to reprocue:

ucr set update/check/cron/entry='5 4 * * Thu,Fri'
ucr set update/check/cron/entry='5 4 * * Thu-Fri'
ucr set update/check/cron/entry='5 4 * aug,sep *'
ucr set update/check/cron/entry='5 4 * aug-sep *'

Now "man 5 crontab" doesn't explicitly list an example combining month names & ranges, but it states:

> day of week    0–7 (0 or 7 is Sun, or use names)

and

> A field may be an asterisk (*), which always stands for ``first-last''.

hinting that names & numbers can be used interchangeably.

Additionally it just plain works. I've used name-based ranges for ages, and looking at my syslog I can confirm that the job is definitely executed.

Ranges with numbers are accepted (e.g. '5 4 * * 4,5' and '5 4  * * 4-5'), as are single names (e.g. '5 4 * * Thu'). The same applies to month numbers & names.
Comment 1 Philipp Hahn univentionstaff 2023-04-18 09:30:24 CEST
(In reply to Moritz Bunkus from comment #0)
> Now "man 5 crontab" doesn't explicitly list an example combining month names
> & ranges, but it states:
> 
> > day of week    0–7 (0 or 7 is Sun, or use names)
> and
> > A field may be an asterisk (*), which always stands for ``first-last''.

The next lines of <man:crontab(5)> forbids using names in ranges:

> Ranges of numbers are allowed.  Ranges are two numbers separated with a hyphen.
and later
> Ranges or lists of names are not allowed.

There are many more implementations for the Cron-syntax <https://en.wikipedia.org/wiki/Cron>. While Vixie-Cron may allow it, other implementations might not.


> More problematic is that the "univention_config_registry" Ansible plugin
> from the "ucs_modules" collection fails due to stuff being emitted on
> STDERR, and I'm pretty sure the same validation code is used for both.

That's a bug in the Ansible module as handling any output to STDERR as an error is wrong; UCR prints a "Warning" only.
Comment 2 Moritz Bunkus 2023-04-18 09:37:29 CEST
Huh… I totally overlooked that sentence. Sorry!