Edgewall Software
Modify

Opened 15 years ago

Closed 14 years ago

#8927 closed defect (duplicate)

UnicodeDecodeError for non-existing changesets in marked up text

Reported by: menno@… Owned by: Christian Boos
Priority: normal Milestone:
Component: plugin/mercurial Version: 0.11.6
Severity: major Keywords: mercurial hg
Cc: menno@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

I am using the Mercurial plugin for the IMAPClient project (http://imapclient.freshfoo.com).

Someone recently added a ticket containing some sample IMAP protocol output that happened to contain a string that looks like a changeset hash. This changeset doesn't actually exist in the Mercurial repository, causing a UnicodeDecodeError from the Mercurial API for some reason.

This error isn't handled meaning that the ticket was no longer accessible using Trac. I had to edit the Trac DB manually and add literal markup to prevent the traceback so that the ticket could be accessed.

Through experimentation I found that any string in a ticket description that looked like a changeset hash but didn't refer to a changeset would trigger the problem and "break" the ticket (in my user's case it was "f2e30b5f0407").

I'm using the patch attached to avoid this issue. There's probably a better way of dealing with this. I suspect the real issue is with Mercurial itself. It appears to be doing something odd when queried about changesets that don't exist.

For your reference, the traceback I was seeing looked like this:

Traceback (most recent call last):
  File "build/bdist.linux-i686/egg/tracext/hg/backend.py", line 248, in _format_link
  File "build/bdist.linux-i686/egg/tracext/hg/backend.py", line 416, in get_changeset
  File "build/bdist.linux-i686/egg/tracext/hg/backend.py", line 334, in hg_node
  File "/usr/lib/python2.4/site-packages/mercurial-1.3.1-py2.4-linux-i686.egg/mercurial/localrepo.py", line 504, in lookup
    if key in self.dirstate.parents():
UnicodeDecodeError: 'ascii' codec can't decode byte 0x81 in position 4: ordinal not in range(128)

Version info:

  • Trac - 0.11.6
  • Mercurial - 1.3.1 (old, I know)
  • TracMercurial - latest as of 2010-01-03 (r9000)

Attachments (1)

hgext-unicode_error_catch.patch (498 bytes ) - added by menno@… 15 years ago.

Download all attachments as: .zip

Change History (2)

by menno@…, 15 years ago

comment:1 by Christian Boos, 14 years ago

Milestone: plugin - mercurial
Resolution: duplicate
Status: newclosed

This problem hints at on of the next big change for the TracMercurial plugin, better handling of the revision descriptors.

See #9724.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos 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.