A Debian user complains  that subversion refuses to run when his
locale is broken. (In the present instance it is apparently the fault
of something else in Debian, not his own fault.) Now, I know why
Subversion insists on getting a valid locale - it is handling user
data, including filenames, and wants to be sure it is converting to and
from the correct character set.
But that did get me thinking: if that reasoning is correct, it only
applies to LC_CTYPE; if other locale variables (LC_MESSAGES, for
localised output messages, LC_COLLATE, for sort order) are unusable,
those should be mere warnings rather than errors.
Thus the subversion clients would be a little more robust against
problems with the user's environment. Does anyone else think that this
would be a Good Thing?
NOTE: This patch is untested - I guess it's more for illustration than
to apply directly. I'll test it Real Soon Now.
Make locale setting in the client a bit more forgiving.
* subversion/libsvn_subr/cmdline.c (svn_cmdline_init): Set LC_CTYPE
separately from LC_ALL, and if LC_ALL fails, do not consider it to be
a fatal error.
--- subversion/libsvn_subr/cmdline.c (revisione 19429)
+++ subversion/libsvn_subr/cmdline.c (copia locale)
@@ -55,6 +55,7 @@
+ svn_boolean_t lc_ctype_ok = FALSE;
@@ -104,6 +105,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
+ if (setlocale(LC_CTYPE, ""))
+ lc_ctype_ok = TRUE;
if (!setlocale(LC_ALL, ""))
@@ -130,8 +133,13 @@
"%s: error: environment variable %s is %s\n"
"%s: error: please check that your locale name is correct\n",
progname, progname, *env_var, env_val, progname);
+ if (lc_ctype_ok)
+ "%s: LC_CTYPE was set successfully, continuing\n",
- return EXIT_FAILURE;
+ if (!lc_ctype_ok)
+ return EXIT_FAILURE;
/* Initialize the APR subsystem, and register an atexit() function
Received on Fri Apr 21 06:23:02 2006