Edgewall Software
Modify

Opened 13 years ago

Closed 9 years ago

#10597 closed defect (fixed)

GitPlugin: UnicodeDecodeError

Reported by: Peter Suter Owned by: Jun Omae
Priority: lowest Milestone: 1.0.7
Component: plugin/git Version:
Severity: normal Keywords: unicode windows
Cc: Branch:
Release Notes:

Fix UnicodeDecodeErrors for unicode file path in git repository on Windows.

API Changes:
Internal Changes:

Description

Created as part of the move of GitPlugin. Tickets originally reported for th:GitPlugin: th:#8087, th:#8944

Quoting Charger:

After commit in GIT repositiories file with cyrillic characters in filename and cached_repository = true, Trac fails sync. When cached_repository = false trac show error only on page, when he must show cyrillic filename.

This might be a configuration issue of git_fs_encoding.

Attachments (0)

Change History (5)

comment:1 by Christian Boos, 12 years ago

Keywords: unicode added
Milestone: next-stable-1.0.x
Priority: normallowest

Link to a git repos demonstrating the issue welcome.

comment:2 by anonymous, 12 years ago

The problem exists only on win32

comment:3 by Jun Omae, 10 years ago

Keywords: windows added

comment:4 by Jun Omae, 10 years ago

Milestone: next-stable-1.0.x1.0.7
Owner: set to Jun Omae
Status: newassigned

On Windows, viewing a file with unicode path using repository browser leads a UnicodeDecodeError.

2015-06-04 02:11:27,171 Trac[main] ERROR: Internal Server Error: 
Traceback (most recent call last):
  File "C:\usr\src\trac\trac.git\trac\web\main.py", line 534, in _dispatch_request
    dispatcher.dispatch(req)
  File "C:\usr\src\trac\trac.git\trac\web\main.py", line 227, in dispatch
    resp = chosen_handler.process_request(req)
  File "C:\usr\src\trac\trac.git\trac\versioncontrol\web_ui\browser.py", line 376, in process_request
    node = get_existing_node(req, repos, path, rev_or_latest)
  File "C:\usr\src\trac\trac.git\trac\versioncontrol\web_ui\util.py", line 74, in get_existing_node
    return repos.get_node(path, rev)
  File "C:\usr\src\trac\trac.git\tracopt\versioncontrol\git\git_fs.py", line 542, in get_node
    return GitNode(self, path, rev, self.log, None, historian)
  File "C:\usr\src\trac\trac.git\tracopt\versioncontrol\git\git_fs.py", line 655, in __init__
    ls_tree_info = repos.git.ls_tree(rev, p) or None
  File "C:\usr\src\trac\trac.git\tracopt\versioncontrol\git\PyGIT.py", line 770, in ls_tree
    tree = self.repo.ls_tree('-z', '-l', rev, '--', path).split('\0')
  File "C:\usr\src\trac\trac.git\tracopt\versioncontrol\git\PyGIT.py", line 121, in __execute
    p = self.__pipe(git_cmd, stdout=PIPE, stderr=PIPE, *cmd_args)
  File "C:\usr\src\trac\trac.git\tracopt\versioncontrol\git\PyGIT.py", line 114, in __pipe
    close_fds=close_fds, **kw)
  File "C:\usr\apps\python27\lib\subprocess.py", line 710, in __init__
    errread, errwrite)
  File "C:\usr\apps\python27\lib\subprocess.py", line 913, in _execute_child
    args = list2cmdline(args)
  File "C:\usr\apps\python27\lib\subprocess.py", line 644, in list2cmdline
    return ''.join(result)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe3 in position 0: ordinal not in range(128)

Because Popen() accepts only ANSI encoding on Windows. We should encode arguments of Popen() with mbcs encoding.

Proposed changes in [6803b460d/jomae.git] (jomae.git@t10597).

comment:5 by Jun Omae, 9 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Fixed in [14149] and merged to trunk in [14150].

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.