[arch-projects] [initscripts] [PATCH 11/12] Simplify LC_* unsetting

Kurt J. Bosch kjb-temp-2009 at alpenjodel.de
Sat Jun 25 19:40:49 EDT 2011


Tom Gundersen, 2011-06-25 23:57:
> On Sat, Jun 25, 2011 at 11:40 PM, Kurt J. Bosch
> <kjb-temp-2009 at alpenjodel.de>  wrote:
>> Dave Reisner, 2011-06-25 20:00:
>>>
>>> On Sat, Jun 25, 2011 at 12:16:03PM +0200, Kurt J. Bosch wrote:
>>>>
>>>> ---
>>>>   functions |    4 +---
>>>>   1 files changed, 1 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/functions b/functions
>>>> index 86b9602..2e4ba42 100644
>>>> --- a/functions
>>>> +++ b/functions
>>>> @@ -62,9 +62,7 @@ unset TERM_COLORS
>>>>   unset TZ
>>>>
>>>>   # sanitize the locale settins
>>>> -unset LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY \
>>>> -      LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE \
>>>> -      LC_MEASUREMENT LC_IDENTIFICATION LC_ALL
>>>> +unset "${!LC_@}"
>>>>   if [[ $DAEMON_LOCALE = [yY][eE][sS]&&    $LOCALE ]]; then
>>>>         export LANG="${LOCALE}"
>>>>   else
>>>> --
>>>> 1.7.1
>>>>
>>>
>>> I'm all for simplifying things, but this will unset _anything_ starting
>>> with LC_ which could conceivably be something a calling script cares
>>> about.
>>>
>>> dave
>>
>> NACK
>> We talk about rc scripts and daemons here don't we?
>> At the point where functions are sourced they should not care about anything
>> else than what is normally exported by init or supported in rc.conf. Ideally
>> we should unset _everything_ other to avoid unexpected daemon restart
>> behavior. Things special to a daemon script should go into
>> /etc/conf.d/$daemon which is sourced after functions.
>
> I think it would be best if we were able to unset all variables except
> for the ones we explicitly want.
>
> I have been meaning to look into using /etc/initscript to set/unset
> system-wide variables, but I haven't had the time to check if this
> really works the way I want.
>
> If I understand correctly, the variables exported in /etc/initscript
> will be inherited by all processes on the system, (unless a child
> unsets them of course). This would allow us to put the LC_* and PATH
> in there (rather than in /etc/profile and /etc/profile.d/locale.sh),
> and things should JustWork(TM).

AFAIKS you can only unset things coming from init (or initrd) in 
/etc/initscript. That wouldn't solve possible problems caused by a 
different environment when restarting a daemon manually or from a 
pm-utils hook.
>
> At the moment it looks like agetty is clearing some (if not all) the
> env var's it is passed, but I have not yet found out exactly how it
> works.

I think it should just keep the locale settings intact for the login 
prompt and the rest should be set up afterwards, not?
>
> -t

-- 
Kurt


More information about the arch-projects mailing list