KWallet password retrieval broken by incorrect get_result() return type#2328
Merged
KWallet password retrieval broken by incorrect get_result() return type#2328
Conversation
…rn type Commit 68e0452 introduced a bug in `get_result()` that caused all KWallet password lookups to fail. The method was changed to return `KWalletResult` enums, but the implementation had two critical flaws: 1. `KWalletResult.from_variant(result.arguments())` passed the entire arguments list instead of `result.arguments()[0]`. Since `KWalletResult` can only be constructed from integers 0, 1, or 2, passing a list always raised ValueError and returned `KWalletResult.INVALID`. 2. The abstraction was fundamentally wrong - DBus methods return different types (bool for `isEnabled`/`hasEntry`, str for `readPassword`/`networkWallet`, int for `open`), but everything was being converted to a 3-value enum. This caused: - `get_password()` to always return None (hasEntry check always failed) - `try_unlock()` to always prompt for a new wallet name - Wallet handles to be lost (output.value gave enum value, not actual handle) Fix: Restore `get_result()` to return raw DBus values (`arguments[0]`) while keeping the improved error handling. Update all call sites to check for `None`/truthy values instead of enum comparisons. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Commit 68e0452 introduced a bug in
get_result()that caused all KWallet password lookups to fail. The method was changed to returnKWalletResultenums, but the implementation had two critical flaws:KWalletResult.from_variant(result.arguments())passed the entire arguments list instead ofresult.arguments()[0]. SinceKWalletResultcan only be constructed from integers 0, 1, or 2, passing a list always raised ValueError and returnedKWalletResult.INVALID.The abstraction was fundamentally wrong - DBus methods return different types (bool for
isEnabled/hasEntry, str forreadPassword/networkWallet, int foropen), but everything was being converted to a 3-value enum.This caused:
get_password()to always return None (hasEntry check always failed)try_unlock()to always prompt for a new wallet nameFix: Restore
get_result()to return raw DBus values (arguments[0]) while keeping the improved error handling. Update all call sites to check forNone/truthy values instead of enum comparisons.Fixes #2327