Repository navigation
Fix: prevent KWallet from triggering creation UI on read queries (#496) - #764
Open
newchannelid432-code wants to merge 1 commit into
Open
newchannelid432-code wants to merge 1 commit into
newchannelid432-code wants to merge 1 commit into
Conversation
…aco#496) When using the ChainerBackend on a Gnome environment with kwallet installed but never initialized, querying for a password triggers the KDE Wallet creation UI. This happens because connected() unconditionally calls iface.open(), which implicitly creates the wallet if it doesn't exist. This patch implements the solution requested in jaraco#496: 1. Adds a `create=True` flag to connected(). 2. get_password() and get_credential() now pass `create=False`. 3. If `create=False`, connected() queries iface.wallets() to check if the target wallet exists. If it does not, it returns False immediately without calling open(), completely preventing the UI from triggering. 4. get_password/get_credential now return None instead of raising KeyringLocked when the wallet doesn't exist, allowing the Chainer to gracefully move to the next backend without crashing. Closes jaraco#496
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.
Fixes #496.
Problem
As discussed in #496, when a user is on a Gnome desktop environment but has `kwallet` installed (often pulled as a dependency by unrelated software), the `ChainerBackend` queries `SecretService` first. Since the password hasn't been set yet, it registers as a 'miss'. The `Chainer` then falls back to `kwallet`.
Because KWallet has never been initialized in this Gnome environment, querying it via DBus unconditionally calls `self.iface.open()`. This triggers the KDE Wallet creation UI, which is extremely annoying and surprising to the user who never intended to use KDE.
Solution
This PR implements the exact solution requested by @jaraco in #496:
This ensures that KWallet only presents its initialization UI when a user is explicitly setting a password, perfectly resolving the first-time usage flaw on mixed desktop environments.