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

plugin-loader: refuse loading plugins with no metadata #2562

Closed
wants to merge 1 commit into from

Conversation

dkondor
Copy link
Contributor

@dkondor dkondor commented Jan 12, 2025

Fixes #2561

This is taking the second approach mentioned there, by not loading plugins that have no metadata (I assume that all plugins have an XML and it is loaded by wf-config, even if they have no options there).

This can happen e.g. if a plugin was installed after Wayfire was started (and thus wf-config did not update its metadata), or if a metadata file is not installed correctly.

This avoids a crash later when the plugin tries to load its configuration.
@dkondor
Copy link
Contributor Author

dkondor commented Jan 12, 2025

I did a bit more testing and realized that this only works if the plugin is completely "unknown".

However, if there is leftover configuration in wafire.ini, the crash from #2561 can still happen as apparently wf-config will create a section. Still, this fixes at least the case of completely newly installed plugins.

@soreau
Copy link
Member

soreau commented Jan 12, 2025

This is a NAK because plugins without metadata are valid to load. If metadata is installed or changes, wayfire must be restarted. If dynamic reloading of metadata is implemented, it would start in wf-config, as far as I understand. But then you would have to plumb it through the relevant wf-config consumers and it might be easier to just restart wayfire.

@dkondor
Copy link
Contributor Author

dkondor commented Jan 12, 2025

Oh, I see, that does complicate things. I also feel that reloading metadata will have its own complications.
Another way to fix my original issue would be to dlopen() everything on startup in the plugin lib folder and later refuse to load plugins that are not already opened. Although this feels as a hack as well and could bring it's own problems. I might experiment with it if I have a bit more time.

@dkondor dkondor closed this Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash when loading a newly installed plugin
2 participants