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

Cannot save default import library locations anymore. #7344

Open
phibbs7 opened this issue Jan 2, 2025 · 4 comments
Open

Cannot save default import library locations anymore. #7344

phibbs7 opened this issue Jan 2, 2025 · 4 comments
Assignees
Labels

Comments

@phibbs7
Copy link

phibbs7 commented Jan 2, 2025

Describe the bug
In previous versions, the default import library search locations could be altered by modifying the library search paths array in the PLUGIN_STATE_CLASS config for ghidra.plugin.importer.ImporterPlugin in one of the tools config files under
ghidra/<GHIDRA VERSION>/tools/_<tool>.tcd. Doing so meant that the user did not have to manually fix them every time they imported a file into a project. (Which becomes cumbersome when there's multiple directories.)

In the current release the altered config is no longer honored. Forcing the end user to once again manually fix the import library locations during imports.

To Reproduce
Steps to reproduce the behavior:

  1. Open the desired tool config file.
  2. Add something like the following:
    <PLUGIN_STATE CLASS="ghidra.plugin.importer.ImporterPlugin"> <ARRAY NAME="library search paths" TYPE="string"> <A VALUE="/some/path/foo/bar" /> </ARRAY> </PLUGIN_STATE>
  3. Start a new project.
  4. Import a file.
  5. In the Import window click the options button.
  6. In the Options window click on the Edit paths button.

Expected behavior
The altered list of paths from the config file should be present in the Edit Paths window.

Screenshots
In version 11.1_PUBLIC:
Screenshot_2025-01-02_16-11-22

In version 11.2.1_PUBLIC:
Screenshot_2025-01-02_16-15-51

Environment (please complete the following information):

  • OS: Debian Linux 12
  • Java Version: OpenJDK Runtime Environment Microsoft-10376803 (build 21.0.5+11-LTS)
  • Ghidra Version: 11.2.1_PUBLIC
  • Ghidra Origin: official GitHub distro
@ryanmkurtz
Copy link
Collaborator

These have been moved from the tool settings to project settings. Try looking at /path/to/ghidra_projects/MyProject.rep/projectState. You can also now pass them into the headless analyzer too, if you wish.

@ryanmkurtz ryanmkurtz self-assigned this Jan 2, 2025
@phibbs7
Copy link
Author

phibbs7 commented Jan 2, 2025

Yes, I can see those entries showing up there. (Thanks for the pointer.)

But the bug is setting the defaults for new projects, not changing existing projects.

I.e. File->New Project should result in a new project that has the custom import search path list by default. No manual modification of the project-specific config required.

@phibbs7
Copy link
Author

phibbs7 commented Jan 2, 2025

Just found something else:

In 11.2.1_PUBLIC, creating a new project after altering the import library search path list in a previous project (but without closing ghidra in between) causes the new project to have the previous project's import library search path list by default.

This also occurs when opening a project if a previously opened project in the same ghidra session altered the import library search list, AND the opened project doesn't define a custom search list itself.

I guess the default list isn't being reloaded between projects.

@ryanmkurtz ryanmkurtz added Status: Triage Information is being gathered and removed Status: Waiting on customer Waiting for customer feedback labels Jan 2, 2025
@ryanmkurtz
Copy link
Collaborator

I feel like modifying these state files is a bit of a hack. I get that you gotta do what you gotta do but I'm thinking the solution to your problem will involve passing in your desired search paths in some other way that just overrides whatever ones we have saved. How the projectState is kind of a black box to me....tweaking it to work just for this one set of values is probably wrong.

What else would work for your use case? Maybe setting a JVM property with your desired paths? Then Ghidra could use that instead of the saved ones?

@ryanmkurtz ryanmkurtz added Status: Waiting on customer Waiting for customer feedback and removed Status: Triage Information is being gathered labels Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants