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

Circular dependency - infinite loop in dependency check #111

Closed
Tracked by #181
KANAjetzt opened this issue Feb 14, 2023 · 3 comments
Closed
Tracked by #181

Circular dependency - infinite loop in dependency check #111

KANAjetzt opened this issue Feb 14, 2023 · 3 comments
Assignees
Labels
bug Something isn't working validation Feature to make things safe and predictable
Milestone

Comments

@KANAjetzt
Copy link
Collaborator

If 2 mods depend on each other the dependency check will run into infinity.

@KANAjetzt KANAjetzt added the bug Something isn't working label Feb 14, 2023
@KANAjetzt
Copy link
Collaborator Author

KANAjetzt commented Feb 14, 2023

One mod can also add itself as a dependency

*Edit
Created a new issue for this #113

@KANAjetzt KANAjetzt added the validation Feature to make things safe and predictable label Feb 14, 2023
@KANAjetzt KANAjetzt added this to the v4.3.0 milestone Feb 15, 2023
@KANAjetzt
Copy link
Collaborator Author

Ste — Today at 11:59
func _check_dependencies(mod_id:String, deps:Array, dependency_chain_start := ""):
dependency_chain_start is empty by default. if it is empty, it is set to mod_id afterwards. pass it to every recursive call. if dependency_chain_start == mod_id -> circular dependency

@KANAjetzt KANAjetzt self-assigned this Feb 27, 2023
@KANAjetzt KANAjetzt mentioned this issue Mar 23, 2023
37 tasks
KANAjetzt added a commit to KANAjetzt/godot-mod-loader that referenced this issue Mar 24, 2023
Before this fix, it was possible to trigger an infinite loop in the dependency check if two mods declared each other as dependencies. Now, the dependency chain is tracked inside the dependency_chain array. If the same mod ID is detected, the loop will break.

closes GodotModding#111
KANAjetzt added a commit that referenced this issue Mar 24, 2023
* fix: 🐛 Added circular dependency check

Before this fix, it was possible to trigger an infinite loop in the dependency check if two mods declared each other as dependencies. Now, the dependency chain is tracked inside the dependency_chain array. If the same mod ID is detected, the loop will break.

closes #111

* refactor: 🎨 use the `in` syntax
@KANAjetzt
Copy link
Collaborator Author

closed by #183

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working validation Feature to make things safe and predictable
Projects
None yet
Development

No branches or pull requests

1 participant