Vector35 / binaryninja-api

Public API, examples, documentation and issues for Binary Ninja
https://binary.ninja/
MIT License
921 stars 208 forks source link

Globals and Database Save Issues #6033

Closed utkonos closed 4 days ago

utkonos commented 4 days ago

Version and Platform (required):

Bug Description: If I write a global to the database, the indicator dot on the tab for that database does not show that there are unsaved changes. Additionally, even if the database has not been saved by the user, the global is written to the DB.

Steps To Reproduce:

  1. Click "New File" from the main screen.
  2. Save the database as anything.
  3. In the python console: bv.file.database.write_global('test', 'test')
  4. Look at the database tab and notice the circle that indicates unsaved changes is not there.
  5. Close Binary Ninja
  6. Open Binary Ninja
  7. Open the test DB
  8. In the python console: bv.file.database.globals.get(b'test')
  9. Notice that the global was saved to the database without user saving the database.

Expected Behavior: The indicaor that unsaved changes appears when the global has been written to the database. And the global is not permanently saved to the database until the user has saved thus committing the change/s.

Screenshots/Video Recording:

image
CouleeApps commented 4 days ago

Due to the way these APIs work, Database is actually interacting directly with the DB on disk. Globals are not a part of any snapshot and don't affect the saved/unsaved status. This is intended behavior. Only action item I can think to have for this is a bigger warning about the low-level nature of the Database APIs and how directly they operate.