Subject: pkg/25873: setlocale returns NULL when using Subversion/Chora
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <jl+netbsd@lists.wasmer.ca>
List: pkgsrc-bugs
Date: 06/08/2004 14:06:27
>Number:         25873
>Category:       pkg
>Synopsis:       setlocale returns NULL when using Subversion/Chora
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 08 14:07:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Jean-Luc Wasmer
>Release:        CVS as of Feb. ??
>Organization:
>Environment:
1.6ZJ
>Description:
When using Chora to browse a Subversion repository, the environment variable "LANG" is set to whatever the language setting of your Horde portal is set to.

This makes the following call in in cmdline.c:
   if (!setlocale(LC_CTYPE, ""))
return NULL and Subversion returns with an error message.
>How-To-Repeat:
Get Horde/Chora from CVS
Get Subversion from pkgsrc
Configure Chora with a valid SVN repo
Try to access this repository
>Fix:
Clean fix: fix setlocale() in NetBSD (no idea how to do this)

Dirty patch: comment out the code that calls setlocale() in Subversion

--- work/subversion-1.0.4/subversion/libsvn_subr/cmdline.orig      2004-01-09 17:07:57.000000000 -0500
+++ work/subversion-1.0.4/subversion/libsvn_subr/cmdline.c   2004-06-07 17:39:08.000000000 -0400
@@ -63,34 +63,34 @@
   /* 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_CTYPE, ""))
-    {
-      if (error_stream)
-        {
-          const char *env_vars[] = { "LC_ALL", "LC_CTYPE", "LANG", NULL };
-          const char **env_var = &env_vars[0], *env_val = NULL;
-          while (*env_var)
-            {
-              env_val = getenv(*env_var);
-              if (env_val && env_val[0])
-                break;
-              ++env_var;
-            }
-
-          if (!*env_var)
-            {
-              /* Unlikely. Can setlocale fail if no env vars are set? */
-              --env_var;
-              env_val = "not set";
-            }
-
-          fprintf(error_stream,
-                  "%s: error: cannot set LC_CTYPE locale\n"
-                  "%s: error: environment variable %s is %s\n",
-                  progname, progname, *env_var, env_val);
-        }
-      return EXIT_FAILURE;
-    }
+//  if (!setlocale(LC_CTYPE, ""))
+//    {
+//      if (error_stream)
+//        {
+//          const char *env_vars[] = { "LC_ALL", "LC_CTYPE", "LANG", NULL };
+//          const char **env_var = &env_vars[0], *env_val = NULL;
+//          while (*env_var)
+//            {
+//              env_val = getenv(*env_var);
+//              if (env_val && env_val[0])
+//                break;
+//              ++env_var;
+//            }
+//
+//          if (!*env_var)
+//            {
+//              /* Unlikely. Can setlocale fail if no env vars are set? */
+//              --env_var;
+//              env_val = "not set";
+//            }
+//
+//          fprintf(error_stream,
+//                  "%s: error: cannot set LC_CTYPE locale\n"
+//                  "%s: error: environment variable %s is %s\n",
+//                  progname, progname, *env_var, env_val);
+//        }
+//      return EXIT_FAILURE;
+//    }
 
   /* Initialize the APR subsystem, and register an atexit() function
      to Uninitialize that subsystem at program exit. */
>Release-Note:
>Audit-Trail:
>Unformatted: