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

Store plugin's by name rather than path #23386

Merged
merged 3 commits into from
Nov 28, 2024
Merged

Conversation

MewtR
Copy link
Contributor

@MewtR MewtR commented Sep 25, 2024

  • Mark this if you consider it ready to merge
  • I've added tests (optional)
  • I wrote some lines in the book (optional)

Description

So I was looking at #22445 and I figured it would be interesting to store plugins in the hash table by their names instead of their paths.
It makes it easier to detect duplicates and easier to get the path from which the plugin was loaded, but this is more of a proposition.
Code is a little awkward in some places, looking for feedback.

@trufae
Copy link
Collaborator

trufae commented Sep 25, 2024

This change breaks the abi. Can u use the R2_USE_NEW_ABI ?

@MewtR
Copy link
Contributor Author

MewtR commented Sep 25, 2024

Alright, wasn't aware of that define, I'll look into it in the coming days.

@trufae
Copy link
Collaborator

trufae commented Sep 26, 2024

As long as this is a rather large PR changing the abi of rparse i dont think it makes sense to use the new-abi define. so i think it's better to hold this PR until 5.9.9 is in dev. (we need to release 5.9.6 and 5.9.8 before reaching the abi breaking seasson).

Apart from that i think the change makes sense and seems reasonable.

I want to perform more changes in the rparse api, so i wanted to have some time before the 5.9.9 time arrives to do that. what do you think? as long as we are not gonna break abi, this pr shouldnt be affected by any change until the time arrives.

also, do u think the getname callback is necessary? because if all the plugins use the rpluginmeta now, we can just assume this struct on all of them and not depend on helper functions to do that.

@MewtR MewtR force-pushed the plugin_meta branch 2 times, most recently from 4eb2d14 to 283d4ab Compare September 27, 2024 07:47
@MewtR
Copy link
Contributor Author

MewtR commented Sep 27, 2024

You're right about the getname callback, I removed it.

I'll try to write some tests for this at some point.
Also, yeah we can wait until abi-breaking season I don't mind.

I'm afraid this change might break some plugins that are outside the r2 repo though. Are you aware of any bp/parse plugins "external" to r2 or how I can find them?

@trufae
Copy link
Collaborator

trufae commented Sep 27, 2024

Theres inly afen. An external parse plugin. Dont know any about bp

@trufae trufae added this to the 6.0.0 milestone Oct 9, 2024
@MewtR MewtR force-pushed the plugin_meta branch 3 times, most recently from 9556cb3 to e988777 Compare October 20, 2024 00:41
.name = "avr.pseudo",
.desc = "AVR pseudo syntax",
.author = "pancake",
.license = "LGPL3",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use SPDX namings. See the related commits in git log | grep SPDX for more info

@trufae
Copy link
Collaborator

trufae commented Nov 26, 2024

Now it’s the abi breaking moment! Feel free to help improve the state or other apis too! Glad to see this pr updated now btw

@MewtR MewtR force-pushed the plugin_meta branch 6 times, most recently from 0ba07a2 to 080c3a7 Compare November 28, 2024 02:53
@MewtR
Copy link
Contributor Author

MewtR commented Nov 28, 2024

I think the PR is ready. I wanted to write some tests but I need a "dummy" plugin and I'm not sure where to put them. I was initially thinking of putting it in radare2-testbins but it might get complicated to support all platforms. Do you have any suggestions?

@MewtR MewtR marked this pull request as ready for review November 28, 2024 03:03
@trufae
Copy link
Collaborator

trufae commented Nov 28, 2024

Looks good to merge for me too. No need for tests imho. We have many other important refactorings to do rn and we probably want to mess a little more with the plugins architecture before we release. Would u like to split this up into three commits for bp/parse meta and another for the speicific changes to make this logic work? Otherwise in fine to merge it as 1 commit too

@MewtR
Copy link
Contributor Author

MewtR commented Nov 28, 2024

Alright, I split it into three commits. That's what you meant right? 3 commits and not 3 PRs? I can also have 3 PRs if you like

@trufae
Copy link
Collaborator

trufae commented Nov 28, 2024

Maybe worth using "Fix #22445 - Store plugin's by name rather than path ##core"

this way the commit will be listed in the release notes, and the ticket will be closed when merged

@trufae
Copy link
Collaborator

trufae commented Nov 28, 2024

one 1 with 3 commits is fine, what i care mainly is about using the ## for the relevant commits to appear in the release notes :) so just update the last commit and ill merge

- Print plugin path with Lcj
- Use plugin name as opposed to the filename to detect if a plugin has already been loaded
- Refactor r_lib_close and allow L- (remove plugin) to work with the plugin's name in addition to file names
@MewtR
Copy link
Contributor Author

MewtR commented Nov 28, 2024

Ah yes ok, it's done!

@trufae trufae merged commit 4b2234e into radareorg:master Nov 28, 2024
43 checks passed
@MewtR MewtR deleted the plugin_meta branch November 30, 2024 16:23
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.

2 participants