You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Peter Samuelson <pe...@p12n.org> on 2006/04/21 07:46:20 UTC
[PATCH.1] be more tolerant of locale errors
[Peter N. Lundblad]
> And in fact I'm wondering if this whole error out on locale error is
> a false protection. Nothing stops the user from running the client
> with the wrong locale, which should be as likely (or more likely?) as
> using a broken ditto.
That's a good point.
> - Set LC_ALL category.
> - If that fails:
> - Set LC_CTYPE category
> - If that fails, print a warning and continue.
That sounds sensible too.
[[[
Make locale handling more forgiving in the clients.
* subversion/libsvn_subr/cmdline.c (svn_cmdline_init): Try setting both
LC_ALL and LC_CTYPE locale variables, warning only if both fail.
Do not consider this a fatal error.
]]]
Index: subversion/libsvn_subr/cmdline.c
===================================================================
--- subversion/libsvn_subr/cmdline.c (revisione 19429)
+++ subversion/libsvn_subr/cmdline.c (copia locale)
@@ -104,7 +104,8 @@
/* C programs default to the "C" locale. But because svn is supposed
to be i18n-aware, it should inherit the default locale of its
environment. */
- if (!setlocale(LC_ALL, ""))
+ if (!setlocale(LC_ALL, "") &&
+ !setlocale(LC_CTYPE, ""))
{
if (error_stream)
{
@@ -126,12 +127,11 @@
}
fprintf(error_stream,
- "%s: error: cannot set LC_ALL locale\n"
- "%s: error: environment variable %s is %s\n"
- "%s: error: please check that your locale name is correct\n",
+ "%s: warning: cannot set LC_CTYPE locale\n"
+ "%s: warning: environment variable %s is %s\n"
+ "%s: warning: please check that your locale name is correct\n",
progname, progname, *env_var, env_val, progname);
}
- return EXIT_FAILURE;
}
/* Initialize the APR subsystem, and register an atexit() function
Re: [PATCH.1] be more tolerant of locale errors
Posted by "Peter N. Lundblad" <pe...@famlundblad.se>.
Peter Samuelson writes:
>
> [Peter N. Lundblad]
> > And in fact I'm wondering if this whole error out on locale error is
> > a false protection. Nothing stops the user from running the client
> > with the wrong locale, which should be as likely (or more likely?) as
> > using a broken ditto.
>
> That's a good point.
>
> > - Set LC_ALL category.
> > - If that fails:
> > - Set LC_CTYPE category
> > - If that fails, print a warning and continue.
>
> That sounds sensible too.
>
Committed in r19445.
Thanks,
//Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH.1] be more tolerant of locale errors
Posted by Peter Samuelson <pe...@p12n.org>.
[Branko Cibej]
> Only if you write up a FAQ entry that we can refer those users to who
> complain that they've set the locale but Subversion doesn't print
> messages in their chosen language.
Subversion isn't the only Unix tool that will behave this way - all the
tools I know of except perl (perl warns you) will do exactly the same
thing - print unlocalised messages. I don't see why it's specifically
subversion's responsibility to debug this.
I'll offer now, though: if this turns out to be a frequently asked
question, I'll write up an entry for it. It won't be at all specific
to subversion, though.
Re: [PATCH.1] be more tolerant of locale errors
Posted by Branko Čibej <br...@xbc.nu>.
Peter Samuelson wrote:
> [Peter N. Lundblad]
>
>> And in fact I'm wondering if this whole error out on locale error is
>> a false protection. Nothing stops the user from running the client
>> with the wrong locale, which should be as likely (or more likely?) as
>> using a broken ditto.
>>
>
> That's a good point.
>
>
>> - Set LC_ALL category.
>> - If that fails:
>> - Set LC_CTYPE category
>> - If that fails, print a warning and continue.
>>
>
> That sounds sensible too.
>
> [[[
> Make locale handling more forgiving in the clients.
>
> * subversion/libsvn_subr/cmdline.c (svn_cmdline_init): Try setting both
> LC_ALL and LC_CTYPE locale variables, warning only if both fail.
> Do not consider this a fatal error.
> ]]]
>
> Index: subversion/libsvn_subr/cmdline.c
> ===================================================================
> --- subversion/libsvn_subr/cmdline.c (revisione 19429)
> +++ subversion/libsvn_subr/cmdline.c (copia locale)
> @@ -104,7 +104,8 @@
> /* C programs default to the "C" locale. But because svn is supposed
> to be i18n-aware, it should inherit the default locale of its
> environment. */
> - if (!setlocale(LC_ALL, ""))
> + if (!setlocale(LC_ALL, "") &&
> + !setlocale(LC_CTYPE, ""))
>
Only if you write up a FAQ entry that we can refer those users to who
complain that they've set the locale but Subversion doesn't print
messages in their chosen language.
-- Brane
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org