Martin Husemann | 16 Sep 2008 12:02
Picon

Switching to the right locale for sysinst

I would like to suggest the attached patch against sysinst.

It is a bit strange, since the net effect, right now, is void. However,
I think it (a) helps debugging and (b) is a step in the right direction.

What it does:

 - each translation identifies the output locale it assumes
 - the necessary setlocale() calls are done when a translation
   is loaded

In the dynamically linked version (i.e. for debugging) this works just fine.
In the crunched version linked against libhack, of course, setlocale()
basically is a no-op, so this change does nothing in the end (for now).
The bloat is minimal - just one additional string per translation.

What do you think?

Martin
P.S.: we should be -><- this close to a usable wide char version of sysinst,
now that wcurses is integrated. Any volunteers for a japanese translation?

Martin Husemann | 16 Sep 2008 12:04
Picon

Re: Switching to the right locale for sysinst

Argh, and here is the patch...

Martin
Index: main.c
===================================================================
RCS file: /cvsroot/src/distrib/utils/sysinst/main.c,v
retrieving revision 1.52
diff -u -r1.52 main.c
--- main.c	23 Oct 2006 19:45:56 -0000	1.52
+++ main.c	31 Aug 2008 21:41:37 -0000
 <at>  <at>  -47,6 +47,7  <at>  <at> 
 #include <unistd.h>
 #include <fcntl.h>
 #include <dirent.h>
+#include <locale.h>

 #include "defs.h"
 #include "md.h"
 <at>  <at>  -307,6 +308,13  <at>  <at> 
 	}
 	free(lang_msg);
 	free(fnames);
+
+	/* set locale according to selected language */
+	cp = msg_string(MSG_sysinst_message_locale);
+	if (cp) {
+		setlocale(LC_CTYPE, cp);
+		setenv("LC_CTYPE", cp, 1);
(Continue reading)

Hubert Feyrer | 16 Sep 2008 13:54
Picon
Favicon

Re: Switching to the right locale for sysinst

On Tue, 16 Sep 2008, Martin Husemann wrote:
> What do you think?

Are there plans to fix setlocale() to give this a real effect in the 
crunchgen'd environment? Or why do this at all?

  - Hubert

Julian Coleman | 16 Sep 2008 14:36
Picon

Re: Switching to the right locale for sysinst

Hi,

> Are there plans to fix setlocale() to give this a real effect in the 
> crunchgen'd environment? Or why do this at all?

If we had a version that wasn't space constrained, e.g."real" CD or network
boot, this would be nice.

Thanks,

J

--

-- 
  My other computer also runs NetBSD    /        Sailing at Newbiggin
        http://www.netbsd.org/        /   http://www.newbigginsailingclub.org/

Martin Husemann | 16 Sep 2008 14:56
Picon

Re: Switching to the right locale for sysinst

On Tue, Sep 16, 2008 at 01:54:02PM +0200, Hubert Feyrer wrote:
> Are there plans to fix setlocale() to give this a real effect in the 
> crunchgen'd environment? Or why do this at all?

I initially did it to help sysinst debugging - if you run the german
translation in a debug build of sysinst not seeing umlauts is confusing.

Martin

Hubert Feyrer | 16 Sep 2008 15:05
Picon
Favicon

Re: Switching to the right locale for sysinst

On Tue, 16 Sep 2008, Martin Husemann wrote:
>> Are there plans to fix setlocale() to give this a real effect in the
>> crunchgen'd environment? Or why do this at all?
>
> I initially did it to help sysinst debugging - if you run the german
> translation in a debug build of sysinst not seeing umlauts is confusing.

I understand, but what good is having a "working" debugging environment, 
if we know that the final/target environment be different (and "not 
working", at least not as in debugging)? Won't it lead to confusion?

-  Hubert

Martin Husemann | 16 Sep 2008 15:11
Picon

Re: Switching to the right locale for sysinst

On Tue, Sep 16, 2008 at 03:05:18PM +0200, Hubert Feyrer wrote:
> I understand, but what good is having a "working" debugging environment, 
> if we know that the final/target environment be different (and "not 
> working", at least not as in debugging)? Won't it lead to confusion?

No, you misunderstood: the crunched version works too, but by blindly ignoring
the locale settings - while currently the debug version does not work.

This change fixes the debug version, and is the right thing to do in the
future, and it is a no-op for the currently crunched version (which does not
have a real problem, because it is cheating).

Martin

Jeremy C. Reed | 16 Sep 2008 16:17

what pre-creates log files?

What creates log files during installation time?

I tried searching through base sets, sysinst source, mtree specs, but 
haven't found yet.

For example, my system complains about missing /var/log/xferlog which is 
in syslogd.conf but not on my system. I am trying to track down source to 
see if this is a problem with installation or not.

Hubert Feyrer | 16 Sep 2008 16:26
Picon
Favicon

Re: what pre-creates log files?

On Tue, 16 Sep 2008, Jeremy C. Reed wrote:
> What creates log files during installation time?
>
> I tried searching through base sets, sysinst source, mtree specs, but
> haven't found yet.
>
> For example, my system complains about missing /var/log/xferlog which is
> in syslogd.conf but not on my system. I am trying to track down source to
> see if this is a problem with installation or not.

check the install-etc-files target in src/etc/Makefile

  - Hubert


Gmane