-
Notifications
You must be signed in to change notification settings - Fork 82
Invalid match #35
Comments
I can confirm this behaviour. Compiled the current |
I think i found the cause and probably can provide a way to fix the issue. Given check that asserts: I realized, that when See https://linux.die.net/man/3/mktime for reference. It turns out that changing the order of incermenting month and resetting the calendar does resolve the observed issue:
I am not sure if there are implications that cause other issues with the proposed change, though. The supplied tests succeed (at least on my platform). What do you think? |
@ghseb I have tested with your fix with the following test cases and all seems to work OK
|
@slavslavov thanks for the feedback! |
I didn't notice the issue yet, thank you for finding and fixing it! Tried it with the following test cases as well, everything works ok. check_next("0 0 0 ? 2-3 *", "2022-01-31_00:00:00", "2022-02-01_00:00:00");
check_next("0 0 0 ? 4-5 *", "2022-03-31_00:00:00", "2022-04-01_00:00:00"); |
Porting tests from staticlibs#35. As described in staticlibs#35 , ccronexpr will "skip" a month if started on the 31st and looking for a match in the following month because mktime will "fix" e.g. 31st of November by changing it to 1st of December.
Applying patch suggested here: staticlibs/ccronexpr#35
This project is no longer maintained, see its updated and extended fork in exander77/supertinycron repo, closing the issue to archive the repo. |
Hello,
i've found a potential bug in the cron implementation. The following test demonstrates the issue:
Can anybody reproduce the issue?
What could be the reason for the invalid next match?
The text was updated successfully, but these errors were encountered: