https://bugs.kde.org/show_bug.cgi?id=491898

[email protected] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #8 from [email protected] ---
I am having this issue also, Included if any of this config info helps

# kwallet-query reports success but silently fails to persist writes

## Summary

`kwallet-query -w`/`--write-password` returns exit code 0 with no error
output, but the write is never persisted to the target wallet file on
disk. Calling the same operation directly via the `org.kde.kwalletd6`
D-Bus interface (`writePassword`) succeeds and persists correctly under
identical conditions (same wallet, same folder, same running daemon,
same user session). This makes `kwallet-query` silently data-lossy for
any scripted/bulk import workflow that trusts its exit code.

## Environment

- **OS:** Oracle Linux 10 (OL10), FIPS 140-3 mode enabled
- **Desktop:** KDE Plasma 6 (plasma-workspace-6.4.5-1.el10_1)
- **Affected package:** `kf6-kwallet-6.18.0-1.el10_1.x86_64` (provides
`/usr/bin/kwallet-query`)
- **Daemon:** `/usr/bin/kwalletd6` (single instance confirmed running, PID
verified via `ps aux`)
- **GUI:** `kwalletmanager5-25.08.1-1.el10_1.x86_64` (KDE Gear 25.08, KF6-based
despite legacy "5" package name)
- **Wallet backend file:** `~/.local/share/kwalletd/kdewallet.kwl`

## Reproduction Steps

1. Ensure exactly one `kwalletd6` process is running:
   ```bash
   ps aux | grep kwalletd6
   ```

2. Note the current size/mtime of the target wallet file:
   ```bash
   ls -la ~/.local/share/kwalletd/kdewallet.kwl
   ```

3. Write a test entry using `kwallet-query`:
   ```bash
   kwallet-query -f login -w test_entry -v kdewallet <<< "test_value_123"
   ```
   Output: no error, no warning, exits 0.

4. Check the wallet file again:
   ```bash
   ls -la ~/.local/share/kwalletd/kdewallet.kwl
   ```
   **Observed:** file size/mtime is unchanged from step 2 — the write was not
persisted.

5. Confirm via listing:
   ```bash
   kwallet-query -f login -l kdewallet
   ```
   **Observed:** entry does not appear (or folder appears empty), despite the
"successful" write in step 3.

6. Repeat the identical operation via raw D-Bus against the same running
daemon:
   ```bash
   HANDLE=$(qdbus-qt6 org.kde.kwalletd6 /modules/kwalletd6 org.kde.KWallet.open
kdewallet 0 test-diag)
   qdbus-qt6 org.kde.kwalletd6 /modules/kwalletd6 org.kde.KWallet.isOpen
"$HANDLE"
   qdbus-qt6 org.kde.kwalletd6 /modules/kwalletd6 org.kde.KWallet.writePassword
"$HANDLE" login manual_test hello123 test-diag
   ```

7. Check the wallet file a third time:
   ```bash
   ls -la ~/.local/share/kwalletd/kdewallet.kwl
   ```
   **Observed:** file size increased immediately (2100 → 2208 bytes in our test
run).

8. Confirm persistence and correctness:
   ```bash
   qdbus-qt6 org.kde.kwalletd6 /modules/kwalletd6 org.kde.KWallet.entryList
"$HANDLE" login test-diag
   qdbus-qt6 org.kde.kwalletd6 /modules/kwalletd6 org.kde.KWallet.readPassword
"$HANDLE" login manual_test test-diag
   ```
   **Observed:** entry present, value reads back correctly (`hello123`).

## Expected Behavior

`kwallet-query -w` should either:
- Successfully persist the write (matching the behavior of a direct
`writePassword` D-Bus call against the same daemon/wallet/folder), or
- Return a non-zero exit code / print an error if the write could not be
completed, rather than silently succeeding.

## Actual Behavior

`kwallet-query` returns exit code 0 and prints no error for every write
attempt, but the underlying wallet file is never modified and the entry is not
retrievable afterward. This was confirmed across a batch of 50 sequential
writes (via a Python wrapper script shelling out to `kwallet-query`) — all 50
reported success, but the wallet file remained byte-for-byte identical (2100
bytes) before and after the batch.

## Suspected Root Cause (unconfirmed)

`kwallet-query` is a short-lived CLI process. It is suspected that the tool's
D-Bus `open()`/`writePassword()`/exit sequence completes (process exits 0)
before the write is actually flushed/acknowledged by the daemon — i.e., a race
between process teardown and the async D-Bus reply, or the CLI not waiting
for/checking the return value of `writePassword()` at all. This is speculative;
we did not step through `kwallet-query`'s source to confirm. Notably:

- `ldd $(which kwallet-query)` shows it linking `libKF6Wallet.so.6`,
`libKF6CoreAddons.so.6`, etc. — genuinely KF6, not a stale KF5 binary talking
to a nonexistent `org.kde.kwalletd5` service (this was our initial, incorrect
hypothesis and was ruled out).
- `org.kde.kwalletd6.users(kdewallet)` did show `kwallet-query` as a connected
application after the failed write attempts, indicating the D-Bus
session/connection itself was established successfully.

## Workaround

Bypass `kwallet-query` and call `org.kde.kwalletd6` directly via D-Bus (e.g.
`dbus-python` or `qdbus-qt6`), explicitly checking `isOpen()` after `open()`
and reading back each write immediately via `readPassword()` to confirm
persistence before treating the operation as successful. This was necessary to
complete a 50-item migration from a gnome-keyring export into KWallet on this
system.

## Additional Notes

- `qdbus-qt6 ... org.kde.KWallet.sync` does not exist as a method on this
daemon (`org.freedesktop.DBus.Error.UnknownMethod`); the introspected method
list includes `sync(int handle, QString appid)` (not the no-arg form
attempted), for reference.
- Not yet tested: whether this reproduces on non-FIPS-mode OL10, on other
RHEL10-family distros (Rocky, AlmaLinux), or on non-Oracle KDE Plasma 6
installs. If filing upstream, worth asking whether this is FIPS-mode-specific
or a general KF6 regression, since our testing environment has FIPS 140-3
enforced throughout.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to