Conversation
_validate_cron_component checked for /, - and , in a fixed order, so a
stepped range like "1-5/2" (valid cron) was rejected, as was any
comma-list whose items used ranges or steps. Split each field on ","
first, then parse each item as an optional base ("*", a number or a
range) followed by an optional step.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cron()rejects a step applied to a range, e.g.1-5/2, which is valid cron (every 2nd value from 1 to 5). It also rejects any comma-list whose items use a range or step, e.g.15,45 6-18/3 * * *._validate_cron_componentlooked for/,-and,in a fixed order. For1-5/2it split on/first, so the base became"1-5", which is neither*nor a decimal, and the item was refused. A field like6-18/3never reached the range branch at all. The test file already noted this:# "5-10/2 * * * *", # this is valid, but not supported yetThis splits each field on
,first, then parses each item as an optional base (*, a number, or ann-mrange) followed by an optional/step. Behaviour is unchanged for every currently-passing case:*/61(step wider than the range) still passes,*/0and reversed ranges like30-20still fail, and out-of-range list members like0,6,12,24in the hours field still fail.Uncommented the noted
5-10/2case and added1-30/2and15,45 6-18/3to the valid tests. The 3 new cases fail onmasterand pass here; the fulltest_cron.pypasses (29).