-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Keepassx fails to compile on FreeBSD due to libusb implementation differences #10736
Keepassx fails to compile on FreeBSD due to libusb implementation differences #10736
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding all the ifdefs, you should cast libusb_hotplug_callback_handle to qintptr instead. This should already be an opaque pointer type that needs no additional logic.
@phoerious Thanks for the feedback! So, if I understand correctly, there is an existing bug in the code that uses I'll do some testing hoping I can make sense of all this. Thanks again for your suggestions. |
On a normal 64 bit system it shouldn't make a difference, but with smaller word lengths it may. |
@phoerious Problem is, the code as is fails to compile on FreeBSD. FreeBSD is using recent clang by default, which tends to be less permissive about this kind of casts. Putting the correct types in the correct place should be enough to make it compile and work then. |
On FreeBSD the libusb_hotplug_register_callback() function uses a pointer to a struct as an handle. I'm changing the methods to use this as expected by the system library. This now compiles fine but fails at runtime.
Hi again, I experimented a little but made little progress. I uploaded what I have now, following suggestion to use This fails to compile. If I use classic C style casts in place of static_cast it does compile but fails at runtime. I'm asking for help on how to fix this. My limited C++ knowledge has already reached its limit. Thanks in advance. |
@phoerious what do you want to do here? |
For completeness, these bugs have been created regarding FreeBSD: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277799 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=279556 But they apply to base system and resolution cannot be fast, most probably nothing can get released before the next major release at the earliest. |
I've pushed a commit that should make it work on both Linux and FreeBSD, though I cannot test the latter. If it works, we should rebase and squash the commits. Do you know whether any other *BSD will be affected as well? I checked OpenBSD, but they don't seem to have a custom libusb in their tree. |
Looks reasonable to me |
@phoerious Thanks a lot for your patch! I've compiled and am running keepassxc with it locally, it works fine, but I am unable to test the USB functionality. I've posted a patch against the ports tree including your patch so others can test on FreeBSD, I hope to have feedback in a few days at most. |
You should be able to test it to some degree even without a YubiKey. Open two tabs and switch between them. You should see a green progress bar appear for a short time below the password field. If that's the case and the app doesn't crash, it most likely works. |
I performed a quick test you suggest by creating a new DB. Unluckily changing tabs causes a lockup of the program, I am unable to do anything else. I need to kill it with |
That is strange, though probably not related to this change. It may, however, be a problem with that libusb implementation. |
Change type of Handle on FreeBSD. On FreeBSD the libusb_hotplug_register_callback() function uses a pointer to a struct as a handle. --------- Co-authored-by: Janek Bevendorff <[email protected]>
Release 2.7.9 * Passkeys: Ability to easily remove a passkey from an entry [keepassxreboot#10777] * Snap: Use new desktop portal for native messaging integration [keepassxreboot#10906] * Improve entry placeholder/reference feature [keepassxreboot#10846] * Improve CSV importing when title field isn't specified [keepassxreboot#10843] * Improve encrypted Bitwarden importing [keepassxreboot#10800] * Improve database settings UX [keepassxreboot#10821] * Improve handling of clipboard actions from entry preview [keepassxreboot#10810] * Improve group/entry view resize behavior and set sensible defaults [keepassxreboot#10641] * Passkeys: Fix incorrect username fill [keepassxreboot#10874] * Passkeys: Return additional data to the extension [keepassxreboot#10857] * Fix password clear timer inconsistency on unlock view [keepassxreboot#10708] * Fix portability check [keepassxreboot#10760] * Fix page overflow on HTML exports [keepassxreboot#10735] * Fix broken builds when using system provided zxcvbn [keepassxreboot#10717] * Fix copy password button when text is selected [keepassxreboot#10853] * Fix tab ordering on application settings pages [keepassxreboot#10907] * SSH Agent: Fix broken decrypt button [keepassxreboot#10638] * Windows: Fix ALT Auto-Type modifier [keepassxreboot#10795] * Windows: Fix wrong DACL memory size allocation [keepassxreboot#10712] * macOS: Fix monospace font sizing [keepassxreboot#10739] * Flatpak: Fix configuration settings off-by-one error [keepassxreboot#10688] * BSD: Fix compiling with libusb implementation [keepassxreboot#10736] # -----BEGIN PGP SIGNATURE----- # # iQEzBAABCAAdFiEENIkEDB8MPuq41ValRA/GXy4MbgEFAmZzTogACgkQRA/GXy4M # bgHahggAg+hzMTiM0uDaw5yfxhv6GEfQQBPHMhX3JDyHEC+i7Pq6OjlxQkdUrRdu # f4w74od5jSul0Al/ehu9L2eZwNPMnU87FWDn16o1btYHsG9n24v5S0DuQoLXUjde # Y9nJNKeRNoWAlVKWbUG2YGvy9hF9YbtrFaiBksaQ+g3w8Xz82PzLY0VaUu4Xa/LO # RXAhryJC+8T3T479dXpHxJcUmEWkoY4bqj1i6R8tEK5Kz9y1c0kqzqwWysKMj+rD # WxTb2V4y9s57pO35zt9yxMLg66xx9bdcQHbSULa2vZNMFd9qdqk8WJmWFle112yG # UCBXv2ZIjd3lghPt0IrD+WKcuL85Aw== # =rbfs # -----END PGP SIGNATURE----- # gpg: directory '/home/runner/.gnupg' created # gpg: keybox '/home/runner/.gnupg/pubring.kbx' created # gpg: Signature made Wed Jun 19 21:32:56 2024 UTC # gpg: using RSA key 3489040C1F0C3EEAB8D556A5440FC65F2E0C6E01 # gpg: Can't check signature: No public key
Change type of Handle on FreeBSD. On FreeBSD the libusb_hotplug_register_callback() function uses a pointer to a struct as a handle. --------- Co-authored-by: Janek Bevendorff <[email protected]>
Release 2.7.9 * Passkeys: Ability to easily remove a passkey from an entry [keepassxreboot#10777] * Snap: Use new desktop portal for native messaging integration [keepassxreboot#10906] * Improve entry placeholder/reference feature [keepassxreboot#10846] * Improve CSV importing when title field isn't specified [keepassxreboot#10843] * Improve encrypted Bitwarden importing [keepassxreboot#10800] * Improve database settings UX [keepassxreboot#10821] * Improve handling of clipboard actions from entry preview [keepassxreboot#10810] * Improve group/entry view resize behavior and set sensible defaults [keepassxreboot#10641] * Passkeys: Fix incorrect username fill [keepassxreboot#10874] * Passkeys: Return additional data to the extension [keepassxreboot#10857] * Fix password clear timer inconsistency on unlock view [keepassxreboot#10708] * Fix portability check [keepassxreboot#10760] * Fix page overflow on HTML exports [keepassxreboot#10735] * Fix broken builds when using system provided zxcvbn [keepassxreboot#10717] * Fix copy password button when text is selected [keepassxreboot#10853] * Fix tab ordering on application settings pages [keepassxreboot#10907] * SSH Agent: Fix broken decrypt button [keepassxreboot#10638] * Windows: Fix ALT Auto-Type modifier [keepassxreboot#10795] * Windows: Fix wrong DACL memory size allocation [keepassxreboot#10712] * macOS: Fix monospace font sizing [keepassxreboot#10739] * Flatpak: Fix configuration settings off-by-one error [keepassxreboot#10688] * BSD: Fix compiling with libusb implementation [keepassxreboot#10736]
* upstream/develop: (57 commits) Fix typos in tooltips from EditEntryWidgetBrowser.ui Refactor: separate GUI sources from core sources Database key settings: fix UI bug tests: gui: Fix NULL dereference in GUI tests Docs: explain how to generate passwords with the browser extension (keepassxreboot#9242) Fix a couple more Qt 5.15 deprecation warnings (keepassxreboot#10953) Update URLs to Chrome Web Store page for `KeePassXC-Browser` extension Update browser extension icon states in documentation (keepassxreboot#10875) Fix сentering icon and text on buttons Fix backup file path substitution Verify USB listener callback handle Refactor Database Settings (keepassxreboot#9485) Fix all Qt 5.15 deprecation warnings (keepassxreboot#7783) Passkey importer: fix file picker parent Require Qt >= 5.12 Passkeys: Fix showing correct username in the reports Show character count in password generator dialog (keepassxreboot#10940) Increase the time interval for window show workaround Snap: Remove $HOME access from keepassxc-proxy Correct libusb usage on FreeBSD (keepassxreboot#10736) ... # Conflicts: # src/CMakeLists.txt # src/core/Database.cpp # src/core/Database.h
On FreeBSD the libusb_hotplug_register_callback() function uses a pointer to a struct as an handle.
I'm changing the methods to use this as expected by the system library.
This now compiles fine but fails at runtime.
Not sure why this patch is not working and I must admit I do not understand what is being done using
qintptr
inkeepassxc/src/gui/osutils/DeviceListener.h
Line 41 in f093291
This has been noticed here: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277652
The failures with my patch are described here: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277652#c10
I do not have a yubikey so I cannot do testing myself.
Thanks in advance for any help!
Testing strategy
As said, with this changes the source compiles on FreeBSD, and the resulting binary works, except when exercising the modified code.
Type of change