Hey again,

On macOS, opening a SQL-backed book logs this to the .trace on every open:

```
WARN <gnc.gui> [gnc_keyring_set_password()] OS X keychain error: (null)
WARN <gnc.gui> [gnc_keyring_set_password()] The user will be prompted for a
password again next time.
```

No prompt ever appears and nothing breaks, so it's misleading. (The
`(null)` is a separate display bug corrected in PR #2322. The real status
is `errSecDuplicateItem`.)

Root cause of the Warnings: `gnc_post_file_open()` re-stores the connection
password in the keyring on every open, even when it hasn't changed; macOS's
add-only `SecKeychainAddInternetPassword` then fails with
`errSecDuplicateItem`. (On libsecret/gnome-keyring the same re-store
silently succeeds — redundant but harmless.)

Two ways to fix it:

1. **Minimal, macOS-only** — have the macOS store look up and update an
existing item instead of a blind add, so it stops erroring.
2. **Comprehensive** — do the check once in `gnc_keyring_set_password` for
all backends: look up the stored value and write only when it's missing or
actually changed. No platform re-writes needlessly, macOS updates-or-adds,
and the function reads more clearly. Draft of this approach:
https://github.com/Noerr/gnucash/commit/20094e52c8

Was the unconditional re-store on every open intentional? If not, I lean
toward (2) and will open a PR based on my drafted commit.

Thanks,
Noah
_______________________________________________
gnucash-devel mailing list
[email protected]
https://lists.gnucash.org/mailman/listinfo/gnucash-devel

Reply via email to