Open dswhite42 opened 1 year ago
Hi, first thanks for this library - it's been very useful.
I've also run into an issue with this.
An example cron string I have: "0 18 27 10 4"
This library then returns the value:
>>> from cron_descriptor import get_description as get_cron_description
>>> get_cron_description("0 18 27 10 4")
'At 06:00 PM, on day 27 of the month, only on Thursday, only in October'
But looking at other resources like: https://crontab.cronhub.io/ https://cronexpressiontogo.com/
I see "human-readable" values that say "...and on Thursday..." as opposed to "...only on..."
Examples:
At 06:00 PM, on day 27 of the month, and on Thursday, only in October At 18:00, on day 27 of the month, and on Thursday, only in October
Is it possible to update this library to make a change to that wording? Thanks again.
Hello. Thank you very much for this library. It seems to be working well, except for a couple of corner-case issues. Here's some code:
Output:
This should actually be something like:
This is in keeping with the crontab(5) man page which indicates the day-of-month and day-of-week criteria should be combined with OR rather than AND.
However, there is an exception to this due to a bug in Vixie cron/ISC cron/cronie. Because cron fails to parse asterisk fields that contain more than just a single asterisk (for example,
*/2
), it will join the criteria together with AND rather than OR for those entries, in violation of its own man page. So for this code:cron-descriptor actually evaluates the code the same way the buggy cron does:
(more details on the asterisk bug in cron is here: https://crontab.guru/cron-bug.html The consensus seems to be that this bug should not be fixed due to its having been around for decades now.)
So, could the incorrect evaluation of cron entries like "30 4 1,5 FRI" be fixed, while still keeping consistency with the buggy versions of cron for entries like "30 4 /2 * FRI"?
Thanks for looking into it, and for your work on this tool.