Edgewall Software
Modify

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#12521 closed defect (fixed)

ValueError: too many values to unpack

Reported by: Ryan J Ollos Owned by: Jun Omae
Priority: normal Milestone: 1.0.12
Component: version control/browser Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Log context when exception in HTML preview.

API Changes:
Internal Changes:

Description

Found in the logs:

2016-06-28 18:57:22,772 Trac[api] WARNING: HTML preview using PygmentsRenderer failed: 
Traceback (most recent call last):
  File "/usr/local/virtualenv/1.1+testing/lib/python2.7/site-packages/trac/mimeview/api.py", line 832, in render
    return self._render_source(context, result, annotations)
  File "/usr/local/virtualenv/1.1+testing/lib/python2.7/site-packages/trac/mimeview/api.py", line 873, in _render_source
    data = (annotator, annotator.get_annotation_data(context))
  File "/usr/local/virtualenv/1.1+testing/lib/python2.7/site-packages/trac/versioncontrol/web_ui/browser.py", line 874, in get_annotation_data
    return BlameAnnotator(self.env, context)
  File "/usr/local/virtualenv/1.1+testing/lib/python2.7/site-packages/trac/versioncontrol/web_ui/browser.py", line 981, in __init__
    self.reset()
  File "/usr/local/virtualenv/1.1+testing/lib/python2.7/site-packages/trac/versioncontrol/web_ui/browser.py", line 988, in reset
    self.annotations = node.get_annotations()
  File "/usr/local/virtualenv/1.1+testing/lib/python2.7/site-packages/tracopt/versioncontrol/git/git_fs.py", line 714, in get_annotations
    self.repos.git.blame(self.rev,self.__git_path())]
  File "/usr/local/virtualenv/1.1+testing/lib/python2.7/site-packages/tracopt/versioncontrol/git/PyGIT.py", line 996, in blame
    (sha, orig_lineno, lineno) = split_line
ValueError: too many values to unpack
2016-06-28 18:57:22,804 Trac[api] WARNING: HTML preview using PlainTextRenderer failed: 
Traceback (most recent call last):
  File "/usr/local/virtualenv/1.1+testing/lib/python2.7/site-packages/trac/mimeview/api.py", line 832, in render
    return self._render_source(context, result, annotations)
  File "/usr/local/virtualenv/1.1+testing/lib/python2.7/site-packages/trac/mimeview/api.py", line 873, in _render_source
    data = (annotator, annotator.get_annotation_data(context))
  File "/usr/local/virtualenv/1.1+testing/lib/python2.7/site-packages/trac/versioncontrol/web_ui/browser.py", line 874, in get_annotation_data
    return BlameAnnotator(self.env, context)
  File "/usr/local/virtualenv/1.1+testing/lib/python2.7/site-packages/trac/versioncontrol/web_ui/browser.py", line 981, in __init__
    self.reset()
  File "/usr/local/virtualenv/1.1+testing/lib/python2.7/site-packages/trac/versioncontrol/web_ui/browser.py", line 988, in reset
    self.annotations = node.get_annotations()
  File "/usr/local/virtualenv/1.1+testing/lib/python2.7/site-packages/tracopt/versioncontrol/git/git_fs.py", line 714, in get_annotations
    self.repos.git.blame(self.rev,self.__git_path())]
  File "/usr/local/virtualenv/1.1+testing/lib/python2.7/site-packages/tracopt/versioncontrol/git/PyGIT.py", line 996, in blame
    (sha, orig_lineno, lineno) = split_line
ValueError: too many values to unpack

Attachments (0)

Change History (8)

comment:1 by Jun Omae, 4 years ago

What version of git are you using? 2.1.4-2.1+deb8u2?

Hmm, no unit tests for blame/annotation in tracopt.versioncontrol.git.tests. We should add unit tests.

comment:2 by Ryan J Ollos, 4 years ago

The traceback is from demo-1.1, which is running:

$ dpkg -s git | grep Version:
Version: 1:2.1.4-2.1+deb8u2

comment:3 by Jun Omae, 4 years ago

I added unit tests in [59b68963/jomae.git] but this issue is not reproduced with git between 1.5.6.5 and 2.9.0.

comment:4 by Jun Omae, 4 years ago

I think logging context would be helpful to investigate troubles like this issue:

  • trac/mimeview/api.py

    diff --git a/trac/mimeview/api.py b/trac/mimeview/api.py
    index 95beb76e1..2aec941e0 100644
    a b class Mimeview(Component):  
    826826                    return tag.div(class_='code')(tag.pre(result)).generate()
    827827
    828828            except Exception, e:
    829                 self.log.warning('HTML preview using %s failed: %s',
    830                                  renderer.__class__.__name__,
     829                self.log.warning('HTML preview using %s with %r failed: %s',
     830                                 renderer.__class__.__name__, context,
    831831                                 exception_to_unicode(e, traceback=True))
    832832                if context.req and not context.get_hint('disable_warnings'):
    833833                    from trac.web.chrome import add_warning

After the patch, the following would be logged:

04:41:39 PM Trac[api] WARNING: HTML preview using PygmentsRenderer with <RenderingContext <Resource u'repository:trac.git, source:setup.py@12fea0c4642e5d645798f22185ae481d47cf39b1'>> failed:

comment:5 by Ryan J Ollos, 4 years ago

That looks good. I can just create a new ticket if the issue is seen in Trac 1.0.13 or later.

comment:6 by Jun Omae, 4 years ago

Added unit tests in comment:3 and applied changes in comment:4 in [14875] and merged to trunk in [14876].

comment:7 by Ryan J Ollos, 4 years ago

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

comment:8 by Ryan J Ollos, 4 years ago

Owner: set to Jun Omae

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.