Support filepaths with accents
AbandonedPublic

Authored by davidedmundson on Sep 6 2017, 11:20 PM.

Details

Reviewers
None
Group Reviewers
Plasma
Summary

Our helper runs as root and doesn't have the user's environment
(including $LANG). This defaults to one without UTF-8.

Without a locale with UTF-8
QFileInfo::exists("/home/david/wallpapers/crepé.png") returns false and
we fail to set a wallpaper.

By forcing the locale we fix that. It doesn't matter that we're using C,
as we don't have any UI related code in the helper.

BUG: 384294
Fixed-in: 5.11.0

Test Plan

Created a folder
Changed wallpaper

Diff Detail

Repository
R123 SDDM Configuration Panel (KCM)
Branch
Plasma/5.10
Lint
No Linters Available
Unit
No Unit Test Coverage
davidedmundson created this revision.Sep 6 2017, 11:20 PM
Restricted Application added a project: Plasma. · View Herald TranscriptSep 6 2017, 11:20 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
apol added a subscriber: apol.Sep 7 2017, 1:32 PM
apol added inline comments.
sddmauthhelper.cpp
228

I just realized we have something similar in samba-mounter for the exact same reason:
https://cgit.kde.org/samba-mounter.git/tree/src/helper/sambahelper.cpp#n49

In this case we're forwarding the LANG from the user: in the end it's what the user requested not something specific to UTF-8. Nobody is enforcing paths to be utf8 AFAIK.

I wonder if we could come up with a generic solution...

davidedmundson added inline comments.Sep 7 2017, 3:01 PM
sddmauthhelper.cpp
228

in my case I need to change the locale of my helper, not just subprocesses, which means I need to set it before I extract args from the user.

apol added inline comments.Sep 8 2017, 1:34 AM
sddmauthhelper.cpp
228

Maybe it could still be done by KAuth::HelperSupport::helperMain and fix it for everyone everywhere?

davidedmundson abandoned this revision.Nov 13 2017, 12:17 PM

See thread on D7732, it's not reliable to do this.