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

Struct name files are case sensitive (WSAData -> WSADATA) #304

Open
alexrp opened this issue Jun 5, 2023 · 2 comments
Open

Struct name files are case sensitive (WSAData -> WSADATA) #304

alexrp opened this issue Jun 5, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@alexrp
Copy link

alexrp commented Jun 5, 2023

Description

At some point, I defined a WSAData struct in my BNDB. I then realized the actual official spelling is WSADATA, so I renamed it accordingly.

Now there's an issue: My branch now has structs/WSAData.toml and structs/WSADATA.toml.

I actually discovered this by accident while manually checking out my branch on Windows. Turns out, Git doesn't take that well:

$ git status
On branch binsync/alexrp
Your branch is up to date with 'origin/binsync/alexrp'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   structs/WSAData.toml

no changes added to commit (use "git add" and/or "git commit -a")
$ git diff
diff --git a/structs/WSAData.toml b/structs/WSAData.toml
index 61e32ea..325a057 100644
--- a/structs/WSAData.toml
+++ b/structs/WSAData.toml
@@ -1,7 +1,7 @@
 [metadata]
-name = "WSAData"
+name = "WSADATA"
 size = 0x198
-last_change = 2023-06-03T18:25:10.334537Z
+last_change = 2023-06-03T18:25:23.292992Z

 [members.0x0]
 name = "wVersion"

(Git confuses the two files because Windows is case-insensitive.)

Steps to reproduce the bug

  1. Add a struct with one casing.
  2. Rename it to a different casing.

Environment

Binary Ninja 3.5.4315-dev Personal (8ff26e7e)

Additional context

No response

@alexrp alexrp added the bug Something isn't working label Jun 5, 2023
@alexrp
Copy link
Author

alexrp commented Jun 5, 2023

It seems like BinSync should (if possible?) detect and handle renames such as this.

Additionally, rename aside, it's of course perfectly legitimate to actually have two structs called WSAData and WSADATA at the same time. To prevent issues on Windows, might it make sense for BinSync to save structs as structs/<sha1 of name>.toml or something?

@mahaloz
Copy link
Collaborator

mahaloz commented Jun 5, 2023

Lol, so that's why you don't rely on the filesystem... This will be rough to fix. We could possibly name everything in lowercase, and if you make something with a different case name we could append some info to it... yikes. If we so the sha256 method, than it becomes hard to find which file you need to edit to fix your struct.

As you know though, just for fixing your case now, you can always edit the Git repo, delete the other struct, commit, and push.

@mahaloz mahaloz changed the title Leftover struct after rename with case change (WSAData -> WSADATA) Struct name files are case sensitive (WSAData -> WSADATA) Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants