#1116560 kwalletcli: incorrect locale use

Package:
kwalletcli
Source:
kwalletcli
Description:
command line interface to the KDE Wallet
Submitter:
Juha Jäykkä
Date:
2025-12-14 19:35:03 UTC
Severity:
normal
Tags:
#1116560#5
Date:
2025-09-28 15:37:59 UTC
From:
To:
Dear Maintainer,

kwalletcli provides /usr/bin/ssh-askpass alternative called /usr/bin/kwalletaskpass.
This shell-script is executed using mksh and in order to enforce a UTF-8 locale for
Qt, on line 24 the script does

export LANG=C LC_CTYPE=en_US.UTF-8

which is a problem for two reasons. First, is en_US.UTF-8 is not available, it will
output a confusing error message

W: /usr/bin/kwalletaskpass[24]: setlocale: No such file or directory

and second, it should not hard-code a locale like that in the first place.

Right before line 24, the script reads

unset LC_ALL LANGUAGE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES \
    LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION

regardless of whether LC_ALL was an acceptable UTF-8 locale, which could have
been used instead of the hard-coded en_US.UTF-8.

A fix here should do two things:

1. Install the helper (or function, or whatever it is supposed to be) called
   "setlocale" or depend on a package which provides it (currently there is no
   package in Debian sid or trixie that provides such a program in PATH)
2. Inspect the existing environment for an acceptable UTF-8 locale already set
   and use that instead (presumably any UTF-8 locale would suffice, so if one
   is currenly in use, it should be used).

Best,
Juha

*** Reporter, please consider answering these questions, where appropriate ***

   * What led up to the situation?
   * What exactly did you do (or not do) that was effective (or
     ineffective)?
   * What was the outcome of this action?
   * What outcome did you expect instead?

*** End of the template - remove these template lines ***

#1116560#10
Date:
2025-09-28 16:09:05 UTC
From:
To:
tags 1116560 + upstream confirmed
thanks

Good point, it probably should be changed to C.UTF-8; the script
was written before my C.UTF-8 proposal was accepted for eglibc.

On Debian systems, this may also be a good idea. In theory, it
should not actually matter but things like button labels in pinentry
could be affected. As long as the actual responses and for ssh-askpass
queries are correct…

I’ll take this upstream.

bye,
//mirabilos

#1116560#17
Date:
2025-12-14 09:55:14 UTC
From:
To:
Oooookay, here we have a pretty large update.

For Robert, I have added an “emergency make-it-work” option: if
PINENTRY_KWALLET_OVERRIDE is exported, it will override PINENTRY (I’d
still like to find out what sets it, but this should help you out
meanwhile).

For Maarten and Vasilis, I applied an extended version of Vasilis’
suggestion. This should hopefully be fixed now.

For Juha, I invested several hours to rewrite and recheck the locale
code. It should now run in the user’s chosen locale if it’s a UTF-8
locale, and otherwise switch to C.UTF-8 (the by-now standardised one) in
the least intrusive way possible (i.e. on Debian/*buntu, where locale(1)
exists, for LC_CTYPE only).

However. I got fired early this year, and I no longer run a KDE desktop
anywhere, nor do I use kwallet at the moment. I cannot easily test this,
even though I’m relatively confident in the changes. So I haven’t put
this out as new upstream release yet, I only committed things to CVS and
prepared an updated Debian package, which I’ve uploaded to the PPA
https://launchpad.net/~mirabilos/+archive/ubuntu/exp and uploaded to
Debian experimental.

Please test the “3.04beta” packages.

If you don’t have a package for your favourite
OS/distro/release/architecture available: The actual /usr/bin/kwalletcli
binary should not be changed in relevant ways, so you could just take
that from your existing package (and ignore dpkg dependency issues);
everything else in the package is architecture-independent (manpages and
shell scripts).

Ideally, you’d test all three scripts somehow, and have a look at the
manpages that they look okay as well. (On newer releases, the line
wrapping may be suboptimal because the GNU groff maintainers decided to
increase the indent from the value it had been for several decades.
Cannot be helped. But if something looks absolute shit, do tell.)

If things go well, I expect to make a release mid-January, to give this
time to settle (and me time to work on something else, which may even
replace the charconv.c included actually). If not, I can make more test
packages.

Sorry this took so long, and thanks for helping out and testing,
//mirabilos

#1116560#22
Date:
2025-12-14 10:04:30 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
kwalletcli, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1116560@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Thorsten Glaser <tg@mirbsd.de> (supplier of updated kwalletcli package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Sun, 14 Dec 2025 10:29:13 +0100
Source: kwalletcli
Architecture: source
Version: 3.04beta-1
Distribution: experimental
Urgency: medium
Maintainer: Thorsten Glaser <tg@mirbsd.de>
Changed-By: Thorsten Glaser <tg@mirbsd.de>
Closes: 1064113 1116560
Changes:
 kwalletcli (3.04beta-1) experimental; urgency=medium
 .
   * Upload to experimental
   * New upstream snapshot for pre-release testing
     - shrink PNGs
     - UTF-8 is a 4-octet encoding, not a 6-octet one, these days
     - Forward compatibility to mksh R60
     - [b-tsiligiannis] Ignore SIGPIPE during teardown (LP#2120443)
     - Introduce PINENTRY_KWALLET_OVERRIDE variable (LP#2120443)
     - Run scripts in the user locale if it uses UTF-8, switch to the
       standardised-by-now C.UTF-8 if not (Closes: #1116560)
     - Update list of known query strings in kwalletaskpass
     - Update manpages to latest portmdoc; point to Launchpad as bugtracker
   * Update packaging (pkgconf, UMEGAYA, bump S-V, disable LTO)
   * Move to gpg-agent, from gnupg-agent (Closes: #1064113)
   * Update lintian churn
Checksums-Sha1:
 b467d4316423023576351912eed509ba1162fa16 2028 kwalletcli_3.04beta-1.dsc
 df5b649ab72a6815e1859c57767093520cbc6479 67859 kwalletcli_3.04beta.orig.tar.gz
 a40d03527cc929514f8931d272f4a9c4842c461c 9380 kwalletcli_3.04beta-1.debian.tar.xz
Checksums-Sha256:
 bfe205985ae467f60be78a093fc5f52cc2949248a2da821d350afb27b77fcc0b 2028 kwalletcli_3.04beta-1.dsc
 bdd9b4cfd56fd0f16116eded7605c4066b88d564333f7e6349e87be1b329feb8 67859 kwalletcli_3.04beta.orig.tar.gz
 367b56870386ad1429e9679e7934d22ea8d8b988ef32bd41aec147eea41860ff 9380 kwalletcli_3.04beta-1.debian.tar.xz
Files:
 8cc3a5897ec28ea6833598188d93e384 2028 kde optional kwalletcli_3.04beta-1.dsc
 dc507677d8c490046f0114bdd716a5c1 67859 kde optional kwalletcli_3.04beta.orig.tar.gz
 ab7093b60e29de582767fa8a257b6a1c 9380 kde optional kwalletcli_3.04beta-1.debian.tar.xz
-----BEGIN PGP SIGNATURE-----

iQIcBAEBCQAGBQJpPoRiAAoJEHa1NLLpkAfgeZ8QAKXzpeBpk0Bzc9i0FtSeE5fl
MVnOt7Z7Yi/9wU+DyFuPlvnL/LSEI9/Ory8spXO4MQocJQC6g6UyQT5IkwtSI7DT
VZvGWsR1U7dr9h7EvSf8nhxF5V1EapCu/+vjQpsnuJI23obIEG/wSkTGi+VDfwgk
sy409UVmyF/Fn0HbCUpOrXhWPBo/63xPZz/Al2+psC28O6eYXqnpamCCKy0dNDKl
I936r+2nYs0MVw6P2+kjfglEEa91Bo/E2hqwULibCea8xC7Jtl4l1Yj1HorN0uav
//W9l7SkTsoAs1PAsqOy5B6GUuqXYeJdw1dFWT97rLRGUoc6+wj9FSYHVwP+bUFH
utol2vVWoGv7VoGZwZXw96vkQKk8QGqvEuL8U/Lvv33mNPGmPagqC+FVtHhk90U8
Z5PVxtoxNLewOqeoW7HXEpRMA9CKBXi77YboRY8wSQfLUye0f4EajBJtNgQdMGMF
XvA/217klXxPmaLb2vNpKQsYQppCMMMwfb8FwBC9RkEuI8ZGMhtUVE/Rj0MIMH7N
GBdR1c9ZBZNftzlsbYvnpWH7xYcpILy7jG7LOqpa8M2R95OhQTm+C3YZiTqP9YUn
jgeMC1lOB42TPU81PYh1BZPMBzc+FOn+XFmDIupQ8qbRmK7xD64FpZRG3au7jjyg
UTODW2g0m3z90/kfcU73
=BybD
-----END PGP SIGNATURE-----

#1116560#27
Date:
2025-12-14 19:33:22 UTC
From:
To:
Hi Thorsten,

Looks good to me, thanks!

Cheers,
Juha