Default locale for non osmc users in base-files-osmc

Hello,

a very recent update to base-files-osmc, more specifically to /etc/profile.d/103-generate-locale.sh, sets by default the locale “C” for all users except osmc. This overrides anything that may be set in /etc/profile or /etc/environment, and has become a bit of a pain for me. I have fixed it by tinkering with that file to revert the change. I know I could override this in each user’s personal ~/.profile file, but it is not practical if several users are on the system, plus I have several osmc systems in the house (yes I do like and appreciate your work!).

I would like to suggest to revert the change and delete the first three lines.

However, if this latest change is important for reasons that I simply don’t understand, another suggestion would be to check if LC_ALL or LANG are already set before changing them.

Suggested code to replace line 2:

if [ "$user" != "osmc" ] && [ -z "$LC_ALL" ] && [ -z "$LANG" ] ; then 
   export LANG=C
   export LC_ALL=C
   return 0
fi

Cheers

Assume related

Somewhat but not quite. I now understand why the change was introduced, thanks for pointing me in that direction.

I wasn’t having any problem in invocation of the sudo command. So the fix for the issue raised by aldehoff has the unintended consequence of overriding locales already set for non osmc users.
I think my suggested code could make everyone happy?

Yes — we can override the locales if and only if they are not set.

You must have been on the staging repository to receive this update so quickly. In that case, you should get another update addressing this shortly.

Sam

If staging repository is

deb http://apt.osmc.tv stretch-devel main

then yes, although I didn’t realise it. I do tend to update the systems manually and not via kodi.
In any event, thanks for addressing this!

Cheers, congrats for the good work.

Hi

Hopefully the issue is now addressed with the following commit:

I’d appreciate it if you could test this and provide feedback before we potentially release this as an update to other users. To test this update:

  1. Login via the command line
  2. Edit the file /etc/apt/sources.list
  3. Add the following line: deb http://apt.osmc.tv stretch-devel main
  4. Run the following commands to update: sudo apt-get update && sudo apt-get dist-upgrade && reboot
  5. Your system should have have received the update.

Please see if the issue is resolved.

I also recommend you edit /etc/apt/sources.list again and remove the line that you added after updating. This will return you to the normal update channel.

Hi Sam,
I tested it and it works for me, thanks!
Minor suggestion, it would seem (so very slightly) more efficient: can you collapse the two export statements into one, i.e. change

export LANG=C && export LC_ALL=C

to

export LANG=C LC_ALL=C

I tested this as well and it works.

Cheers