Edgewall Software
Modify

Opened 14 years ago

Closed 14 years ago

Last modified 10 years ago

#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)

svnauthz.diff (3.3 KB ) - added by Jun Omae 14 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 by Remy Blank, 14 years ago

Resolution: worksforme
Status: newclosed

svn_authz.py has been reworked on trunk, and doesn't use ConfigParser anymore. AFAICT, it should handle multibyte characters correctly, as it uses to_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.

by Jun Omae, 14 years ago

Attachment: svnauthz.diff added

comment:2 by Jun Omae, 14 years ago

Component: generalversion control/browser
Milestone: 0.11.7.1
Resolution: worksforme
Status: closedreopened

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 Jun Omae, 14 years ago

Cc: jun66j5@… added

comment:4 by Christian Boos, 14 years ago

Keywords: svnauthz unicode added
Resolution: fixed
Status: reopenedclosed

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 Christian Boos, 14 years ago

Owner: set to Jun Omae

comment:6 by Ryan J Ollos, 10 years ago

Keywords: authzsourcepolicy added

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.