Bug 491938

Summary: The kwallet-query CLI command does not work when executed within a script.
Product: [Frameworks and Libraries] frameworks-kwallet Reporter: Andrey <kdebugs>
Component: generalAssignee: Valentin Rusu <valir>
Status: REPORTED ---    
Severity: normal CC: DianaNites, kdelibs-bugs-null
Priority: NOR    
Version First Reported In: 5.115.0   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Andrey 2024-08-20 12:45:55 UTC
SUMMARY

Running the kwallet-query CLI command in a script (e.g., an Ansible playbook) results in an error message, causing the command to abort.


STEPS TO REPRODUCE
1. Run kwallet-query --help inside a script (e.g., an Ansible playbook) without any display environment available.

OBSERVED RESULT
The script fails with the following error message:

qt.qpa.xcb: could not connect to display 
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

Aborted

EXPECTED RESULT
The command should run successfully without needing to set the QT_QPA_PLATFORM variable and without producing any errors or warnings.

SOFTWARE/OS VERSIONS
OS Debian 13 trixie
KDE Plasma Version: 5.27.11 
KDE Frameworks Version: 5.115.0
Qt Version: 5.15.13

ADDITIONAL INFORMATION
Workaround:
Setting the environment variable QT_QPA_PLATFORM=offscreen allows the command to run, albeit with a warning message about missing platform plugins:
"kf.windowsystem: Could not find any platform plugin"