Bug 244341 - x11/sddm: sddm_lang variable in rc.d script does not affect anything
Summary: x11/sddm: sddm_lang variable in rc.d script does not affect anything
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-kde (Team)
Depends on:
Reported: 2020-02-23 17:32 UTC by Serge Volkov
Modified: 2020-03-05 13:38 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (kde)

patch to use setclassenvironment() without mangling SDDM's environment (1.73 KB, patch)
2020-02-27 18:28 UTC, Martin Birgmeier
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Serge Volkov 2020-02-23 17:32:31 UTC
After upgrading to the version 0.18.1, I got a problem.

In the file /etc/rc.conf I have a variable sddm_lang="ru_RU". This variable is described in the file /usr/local/etc/rc.d/sddm. Previously, the SDDM interface was in Russian. Now the value of this variable does not affect anything. SDDM interface is now always in English.

Working solution:

pw usermod sddm -L russian

Thus, I changed the SDDM interface language to Russian.

It may be necessary to remove the use of the sddm_lang variable in the /usr/local/etc/rc.d/sddm file.

It may be necessary to add help information on how to change the SDDM interface language.
Comment 1 Martin Birgmeier 2020-02-27 17:19:27 UTC
Solving this would be really tough... basically, the process model differs very much between Unix and QT5.

The patch in issue 241519 basically mis-uses the SDDM process environment to prepare the future child process environment because setclassenvironment() only allows to modify the current process environment - which normally would already be the child's environment.

To really correct this, a variant of setclassenvironment() would have to be written which allows to specify an independent environment to modify.

Maybe it would instead be possible to just save the current environment, create an empty one, do the setclassenvironment() stuff, then call env.insert() on it, and finally restore SDDM's correct environment.

Maybe this would then also address the issue of starting with a clean environment for the user, as described in https://github.com/sddm/sddm/pull/1234.

And don't ask me when I might find the time to look into this. :-)

-- Martin
Comment 2 Martin Birgmeier 2020-02-27 18:28:03 UTC
Created attachment 211999 [details]
patch to use setclassenvironment() without mangling SDDM's environment

Can you try the attached patch? - It should replace the one from issue #241519.

-- Martin
Comment 3 Serge Volkov 2020-02-27 21:44:33 UTC
(In reply to Martin Birgmeier from comment #2)

I tried this patch. Works as expected. The interface language is taken from the 'sddm_lang' variable, and the user environment is taken from login.conf. Probably this patch is more correct.
Comment 4 Martin Birgmeier 2020-02-28 18:31:39 UTC
There is still a problem - we are leaking the temporary environment on each login.

Probably a problem only after hundreds of logins.

-- Martin
Comment 5 Gleb Popov freebsd_committer 2020-02-28 18:50:04 UTC
Maybe this can be done on Qt level?

Like, first save whole QProcessEnvironemnt::systemEnvironment(), do login_* magic, then restore?
Comment 6 commit-hook freebsd_committer 2020-03-05 13:38:17 UTC
A commit references this bug:

Author: arrowd
Date: Thu Mar  5 13:38:01 UTC 2020
New revision: 527832
URL: https://svnweb.freebsd.org/changeset/ports/527832

  lang/sddm: Make SDDM honour sddm_lang rc variable again.

  PR:		244341
  Submitted by:	Martin Birgmeier <d8zNeCFG@aon.at> (initial patch)

Comment 7 Gleb Popov freebsd_committer 2020-03-05 13:38:54 UTC
Done this right way (tm).

Thanks Martin for initial patch and Serge for the report.