#9215 closed defect (fixed)
svn repository control doesn't work with path in multibyte characters
| Reported by: | anonymous | Owned by: | Jun Omae | 
|---|---|---|---|
| Priority: | normal | Milestone: | 0.11.8 | 
| Component: | version control/browser | Version: | 0.11-stable | 
| Severity: | major | Keywords: | svnauthz, unicode, authzsourcepolicy | 
| Cc: | jun66j5@… | Branch: | |
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description
Subversion repository access control doesn't work with unicode path. The reason is svn_auth.py use ConfigParser but it does not consider multibyte characters.
When we Japanese manage document in Subversion repository, we use multibyte path in many case. We strongly hope fix this problem.
Following patch resolve it. Please fix it next release:
--- svn_authz.py.orig   2010-04-11 11:53:00.937500000 +0900
+++ svn_authz.py        2010-04-11 11:51:26.906250000 +0900
@@ -19,9 +19,10 @@
 import os.path
 from trac.config import Option
+from trac.config import Configuration
 from trac.core import *
 from trac.versioncontrol import Authorizer
-
+from trac.util.text import to_unicode
 class SvnAuthzOptions(Component):
@@ -79,14 +80,7 @@
         self.repos = repos
         self.auth_name = auth_name
         self.module_name = module_name
-
-        from ConfigParser import ConfigParser
-        self.conf_authz = ConfigParser()
-        if cfg_fp:
-            self.conf_authz.readfp(cfg_fp, cfg_file)
-        elif cfg_file:
-            self.conf_authz.read(cfg_file)
-
+        self.conf_authz = Configuration(cfg_file)
         self.groups = self._groups()
     def has_permission(self, path):
@@ -115,7 +109,7 @@
     # Internal API
     def _groups(self):
-        if not self.conf_authz.has_section('groups'):
+        if not u'groups' in self.conf_authz.sections():
             return []
         grp_parents = {}
@@ -145,7 +139,8 @@
         return expanded.keys()
     def _get_section(self, section):
-        if not self.conf_authz.has_section(section):
+        section = to_unicode(section)
+        if not (section in self.conf_authz.sections()):
             return
         yield self._get_permission(section, self.auth_name)
      Attachments (1)
Change History (7)
comment:1 by , 16 years ago
| Resolution: | → worksforme | 
|---|---|
| Status: | new → closed | 
by , 16 years ago
| Attachment: | svnauthz.diff added | 
|---|
comment:2 by , 16 years ago
| Component: | general → version control/browser | 
|---|---|
| Milestone: | → 0.11.7.1 | 
| Resolution: | worksforme | 
| Status: | closed → reopened | 
Trac 0.11.x has this problem.
When a unicode string is passed to RealSubversionAuthorizer.has_permission,
access control with svn_authz file doesn't work in repository browser.
Attached a patch including unit test. svnauthz.diff
comment:3 by , 16 years ago
| Cc: | added | 
|---|
comment:4 by , 16 years ago
| Keywords: | svnauthz unicode added | 
|---|---|
| Resolution: | → fixed | 
| Status: | reopened → closed | 
Patch looks good, and as it comes with a test, I think it's safe for inclusion in 0.11.7.1. Thanks!
Applied in [9646].
comment:5 by , 16 years ago
| Owner: | set to | 
|---|
comment:6 by , 12 years ago
| Keywords: | authzsourcepolicy added | 
|---|



  
svn_authz.pyhas been reworked on trunk, and doesn't useConfigParseranymore. AFAICT, it should handle multibyte characters correctly, as it usesto_unicode()on each line. Just make sure your authz file is UTF-8 encoded.Please reopen if this doesn't work for you in 0.12.