Edgewall Software
Modify

Opened 6 years ago

Last modified 3 months ago

#11205 new defect

"repository sync" fails for Subversion repository with unicode path

Reported by: Jun Omae Owned by:
Priority: normal Milestone: next-stable-1.2.x
Component: version control Version: 1.0-stable
Severity: minor Keywords: svn
Cc: Branch:
Release Notes:
API Changes:

Description

In Linux, "repository sync" command fails for Subversion repository with unicode path.

$ svnadmin create /tmp/svn-tété
$ ~/venv/trac/1.0.1/bin/trac-admin /tmp/trac-1.0 initenv title sqlite:db/trac.db >/dev/null
$ ~/venv/trac/1.0.1/bin/trac-admin /tmp/trac-1.0 config set components 'tracopt.versioncontrol.*' enabled
$ ~/venv/trac/1.0.1/bin/trac-admin /tmp/trac-1.0
Welcome to trac-admin 1.0.1
Interactive Trac administration console.
Copyright (C) 2003-2013 Edgewall Software

Type:  '?' or 'help' for help on commands.

Trac [/tmp/trac-1.0]> repository add blah /tmp/svn-tété svn
Trac [/tmp/trac-1.0]> repository list

Name  Type  Alias  Directory
--------------------------------
blah  svn          /tmp/svn-tété

Trac [/tmp/trac-1.0]> repository sync blah
TracError: /tmp/svn-tété does not appear to be a Subversion repository.

The apr library on Linux, it needs to initialize with setlocale() for the encoding of file system. If no setlocale(), uses C locale and 8-bits bytes for the paths.

  • trac/admin/console.py

    diff --git a/trac/admin/console.py b/trac/admin/console.py
    index 74c2388..3091255 100755
    a b def run(args=None):  
    596596
    597597if __name__ == '__main__':
    598598    pkg_resources.require('Trac==%s' % VERSION)
     599    locale.setlocale(locale.LC_ALL, '')
    599600    sys.exit(run())

After the patch, the command correctly works.

$ PYTHONPATH=$PWD ~/venv/py25/bin/python trac/admin/console.py /tmp/trac-1.0
Welcome to trac-admin 1.0.2dev
Interactive Trac administration console.
Copyright (C) 2003-2013 Edgewall Software

Type:  '?' or 'help' for help on commands.

Trac [/tmp/trac-1.0]> repository sync blah
Resyncing repository history for blah...
0 revisions cached.
Done.

Attachments (0)

Change History (2)

comment:1 by Jun Omae, 3 years ago

Patch for [14719].

  • trac/admin/console.py

    diff --git a/trac/admin/console.py b/trac/admin/console.py
    index 27214da02..e428af609 100755
    a b  
    1515from __future__ import with_statement
    1616
    1717import cmd
     18import locale
    1819import os.path
    1920import pkg_resources
    2021from shlex import shlex
    def _run(args):  
    601602
    602603def run(args=None):
    603604    """Main entry point."""
     605    locale.setlocale(locale.LC_ALL, '')
    604606    translation.activate(get_console_locale())
    605607    try:
    606608        return _run(args)

comment:2 by Ryan J Ollos, 3 years ago

Milestone: next-stable-1.0.xnext-stable-1.2.x

Moved ticket assigned to next-stable-1.0.x since maintenance of 1.0.x is coming to a close. Please move the ticket back if it's critical to fix on 1.0.x.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
The ticket will be disowned. Next status will be 'new'.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment


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