#748245 Do not pass LANG and LC_* to init script

#748245#5
Date:
2014-05-15 14:05:56 UTC
From:
To:
Hi!

Currently, service(8) is passing LANG (and LC_* for the version in
experimental) to the init script. However, this makes starting the
init script into a variable environment. When a user using
LANG=de_DE.UTF-8 will restart a service, the service will switch to
German. When someone with LANG=fr_FR.UTF-8, the service will switch to
French.

Another possible consequence is a service that will expect different
inputs. For example, when using fscanf(3) with LC_NUMERIC set to
fr_FR, floating-point numbers will expect a comma instead of a
dot. This may trigger difficult to diagnose bugs in some software. I
remember getting that with snmpd.

Therefore, I think this is better to use a fixed value from
/etc/default/locale.

- -- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (101, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.14-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages sysvinit-utils depends on:
ii  libc6        2.18-6
ii  libselinux1  2.3-1
ii  startpar     0.59-3

sysvinit-utils recommends no packages.

Versions of packages sysvinit-utils suggests:
pn  bootlogd  <none>
pn  sash      <none>

- -- Configuration Files:
/etc/init/startpar-bridge.conf changed [not included]

- -- no debconf information
iQIcBAEBCAAGBQJTdMnAAAoJEJWkL+g1NSX5RWkP/jeISiUsSWSV2SrL5AXJcLBL
gcl+VZXiCLAOsqpOh4HySRn99E+CRUMmXNJpMvdM+Q3JfUOJwA85iMbcL7NAYWIY
NcoqV2y7kgjMOU2G6DW6JUXC4BsQ61DSpyi4jVWG1683LUHxy9YN11Xc+c5DkqT2
PPSfnZvOsyo0o4NoZzgcypylcdx/0Bf1EAErGhwvH1fiX/wrPuwdJk5u9QJ3zY7N
IOxy2tK+1QyMwMItzYd9QY0R+vJknMAtHj8YWXJMLsa2YNdYTSXfFxTEO/L1/f2Z
HeodOgvXhGIMG1Law9H2c9uDqiBNLPX1QlLBZApGBK6rijKCXKK1cMHw6cEOJhGv
AMVkOMQ1l+AyVRpQXwDC4EoaZl01uUujUqu5FDBR/jrrBF5xiCO9auszrM+1nKlT
i81LKBAAuVZ0aCL7uIHEHfZl56+W5/8/1anMC2U3GjwUGH0zrf5/c2R3XxmqwX/U
b1ZwUXfXQmdiG/MiuxMDpEkjK93TeJwYxyNl42wdjhqn2wwK1ZJBgXLKkY0o1G2N
4QL4UocOb5+1ohQ7ec5hUAyJw/n+4xQtRPgZneGqBkBE8F4phAS34Aau+WB3+DGW
vEddVPB+6nx/z4yOuFY2Odev/B3GZz/LVFe1k/afXqsywqnLhSyJIAV6VGWbTXba
cXShy3LvseVx4iKRVv7j
=Q6UY
-----END PGP SIGNATURE-----

#748245#10
Date:
2014-05-15 14:17:01 UTC
From:
To:
[Vincent Bernat]

Hi.

This was introduced with bug #534300 when service was introduced in
2009 with LANG passed to init.d scripts, and #606875 which is a
request to also pass the rest of LC_* when LANG is passed on.

I believe either we pass LANG and LC_*, or we do not.  Do not have
strong opinions either way, but only passing LANG without passing the
rest of LC_* seem like an obvious bug to me.

Personally, I believe the init.d script should fix the locale settings
(for example using LC_ALL=C) if the service change behaviour based on
locale settings.

Is it possible to come up with a setup that pleases everyone?  Or are
the truly conflicting needs here?

#748245#15
Date:
2014-05-15 14:19:40 UTC
From:
To:
 ❦ 15 mai 2014 16:17 +0200, Petter Reinholdtsen <pere@hungry.com> :

It is something difficult to know before hand.

Let's see if we can get input from people needing to keep LANG and LC_*.

#748245#20
Date:
2014-05-15 14:43:15 UTC
From:
To:
Hi,

FTR, SLES is setting LANG to POSIX and CentOS/Fedora is not (re)setting
it at all in the environment before calling the initscript.

#748245#25
Date:
2014-05-15 14:57:18 UTC
From:
To:
You must either pass neither, or pass them all.

The requirements are in conflict.  "service" is an user-level interface, it is
supposed to be subject to i18n and l10n.

OTOH, any initscript that requires, e.g. LC_COLLATE=C or LC_ALL=C ought to
set it.  Really.

#748245#30
Date:
2018-12-23 14:59:12 UTC
From:
To:
control: reassign -1 init-system-helpers

service(8) now belongs to init-system-helpers

[2014-05-15 11:57] Henrique de Moraes Holschuh <hmh@debian.org>