On Thu, Oct 23, 2003 at 11:10:55AM +0900, GOTO Masanori wrote: > At Wed, 22 Oct 2003 11:24:19 -0400, > Daniel Jacobowitz wrote: > > Currently, the default locale setting for the system can be accessed > > only through /etc/environment, which is a configuration file for PAM. > > Setting the locale for a daemon currently requires to parse this file, > > but it is just not the way to go. > > > > If, additionnaly to the /etc/environment stuff, the debconf-selected > > locale was put into /etc/default_locale (a file just containing the > > locale, nothing else), as suggested Ryan Murray, it would make it much > > easier for daemons to set their locale to the system default, without > > relying on an error-prone environment setting. > > Such a file would be necessary to get a correctly localized gdm for > > sarge. > > > > I think it is fairly easy to achieve, and it could even be used later > > (after the sarge release) to set the locale using a specific PAM module, > > instead of using pam_env. > > This wishlist needs a bit consideration. > > (1) We store locale setting for 2 files - /etc/environment, > /etc/default_locale. Is it good idea? > > (2) Why do you need to read /etc/default_locale instead of > /etc/environment? Is it hard to parse /etc/environment so hard?
The locales package already gets it wrong, as it happens. :-) It assumes that quoting is supported when it isn't. I expect that others would make the same mistake. > (3) I guess gdm issue is the locale dialog in the login screen. Why > can't gdm read /etc/environment file? If you mean it's easier to > read /etc/default_locale than to parse /etc/environment, yes it > may become one of the reason. But does this change fix the gdm > issue? /etc/environment is a configuration file owned by PAM and parsed by the pam_env module at login time. As such, it's a good place to set the default locale for PAM sessions. However, all the world is not a PAM session. gdm before login is one example; init scripts are another; perhaps the "login:" banner is a third. I don't think it's right for these programs to be parsing a PAM configuration file when they aren't dealing with PAM sessions; they're a completely separate case. In fact, I can certainly imagine cases where I'd want the outside-a-session locale and the default PAM session locale to be different. Say I speak French, but most of my users are German, so for their benefit I decide that the default session locale should be German, but I want to see init scripts localized in French so that I can work out what's going on more easily. Or maybe I want to use LANG=C for init scripts but default to a Unicode locale for sessions where I expect terminal support to be better. It seems to me that having separate configuration for locales outside and inside a session could be useful in the same way as having different locales for different sessions. I'd suggest, though, that /etc/default_locale is a poor name for this; it sounds like it's the file you want to edit for the default locale throughout the system, when in fact it just applies to programs running before login. How about something like /etc/boot-locale or /etc/default/boot-locale, with a comment at the top when generated by locales explaining its purpose? Or maybe /etc/environment-prelogin or similar would be a better name, and it wouldn't have to be limited to locale configuration. Either way, the format should be simple and clearly specified somewhere that's easy to find so that people don't make the mistakes they do when trying to parse /etc/environment. I've cc'ed the PAM maintainer in case I've made any grievous errors in the above. Is there support for comments in /etc/environment? If so, we could also add a comment there directing people to /etc/default/boot-locale or whatever for things that are to affect programs that run before login. Cheers, -- Colin Watson [EMAIL PROTECTED]