Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix infinite loop on expressions resolving only inside a DST forward jump #938

Merged
merged 2 commits into from
Dec 30, 2024

Conversation

sheerlox
Copy link
Collaborator

@sheerlox sheerlox commented Dec 29, 2024

Description

Removes a superfluous + 1 modifying the behavior unexpectedly. Using the debugger I've located the bug to this instruction, and it can easily be confirmed that this + 1 is the issue, since date.month & this.month are both indexed starting from 1 (and not 0).

Not sure how long this bug has been around, but it was already present when we aligned with the UNIX standard.

Related Issue

Fixes #919.

Motivation and Context

Fixes an infinite loop when a cron expression only resolves to inside a DST jump. See #919 for more.

How Has This Been Tested?

Added two new test cases, and made sure they triggered the infinite loop before writing the fix.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • If my change introduces a breaking change, I have added a ! after the type/scope in the title (see the Conventional Commits standard).

@sheerlox sheerlox added the type:bug Bug reports and bug fixes label Dec 29, 2024
@sheerlox sheerlox changed the title fix: fix infinite loop on expressions falling only inside a DST jump fix: fix infinite loop on expressions resolving only inside a DST forward jump Dec 29, 2024
@sheerlox sheerlox marked this pull request as ready for review December 29, 2024 22:35
@sheerlox sheerlox requested a review from intcreator December 29, 2024 22:37
@intcreator intcreator force-pushed the fix/919/portugal-daylight-savings branch from 8401517 to 54f94d9 Compare December 30, 2024 15:56
@intcreator intcreator merged commit efb8df5 into kelektiv:main Dec 30, 2024
18 checks passed
@ncb000gt
Copy link
Member

🎉 This PR is included in version 3.3.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

intcreator pushed a commit to sheerlox/node-cron that referenced this pull request Dec 30, 2024
## [3.3.2](kelektiv/node-cron@v3.3.1...v3.3.2) (2024-12-30)

### 🐛 Bug Fixes

* fix infinite loop on expressions resolving only inside a DST forward jump ([kelektiv#938](kelektiv#938)) ([efb8df5](kelektiv@efb8df5)), closes [/github.com/kelektiv/pull/667/files#diff-c14c2dca8456f15417b39cfbd9758009f8eb4f3a190a415768d6e4ae6ae9dceeL473-L477](https://github.com/kelektiv//github.com/kelektiv/node-cron/pull/667/files/issues/diff-c14c2dca8456f15417b39cfbd9758009f8eb4f3a190a415768d6e4ae6ae9dceeL473-L477) [kelektiv#919](kelektiv#919) [kelektiv#919](kelektiv#919)

### ⚙️ Continuous Integrations

* **action:** update marocchino/sticky-pull-request-comment action to v2.9.0 ([kelektiv#930](kelektiv#930)) ([1e7bce9](kelektiv@1e7bce9))
* **renovate:** pin GitHub action digests to semver ([kelektiv#926](kelektiv#926)) ([6541167](kelektiv@6541167))

### ♻️ Chores

* **deps:** lock file maintenance ([70c3339](kelektiv@70c3339))
* **deps:** lock file maintenance ([afad454](kelektiv@afad454))
* **deps:** lock file maintenance ([b1dbf69](kelektiv@b1dbf69))
* **deps:** pin dependencies ([kelektiv#915](kelektiv#915)) ([dfcbd3c](kelektiv@dfcbd3c))
* **deps:** update dependency [@commitlint](https://github.com/commitlint)/cli to v19.6.1 ([7999427](kelektiv@7999427))
* **deps:** update dependency [@semantic-release](https://github.com/semantic-release)/release-notes-generator to v14.0.2 ([93c9373](kelektiv@93c9373))
* **deps:** update dependency [@types](https://github.com/types)/node to v20.17.10 ([9313ffd](kelektiv@9313ffd))
* **deps:** update dependency lint-staged to v15.2.11 ([100c9ff](kelektiv@100c9ff))
@sheerlox sheerlox deleted the fix/919/portugal-daylight-savings branch December 30, 2024 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released type:bug Bug reports and bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"0 1 30 3 *" creates infinite loop
3 participants