Opened 4 years ago

Closed 4 years ago

#16444 closed bug (fixed)

ValueError: invalid literal for int() with base 10: 'r 1alpha4-44699'

Reported by: mmlr Owned by: nielx
Priority: normal Milestone:
Component: Website/Trac Version:
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

While going through old audio tickets I came across 9132 which cannot be viewed. It looks like the old revision links mechanism trips over the specific pattern. I've modified references to the original string in this ticket by adding a space after the 'r' to avoid it possibly running into the same issue, not sure if that was really necessary.

How to Reproduce

While doing a GET operation on /ticket/9132, Trac issued an internal error.

Request parameters:

{'id': u'9132'}

Python Traceback

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/trac/web/main.py", line 639, in dispatch_request
    dispatcher.dispatch(req)
  File "/usr/local/lib/python2.7/site-packages/trac/web/main.py", line 271, in dispatch
    method=method)
  File "/usr/local/lib/python2.7/site-packages/trac/web/chrome.py", line 1441, in render_template
    fragment, iterable, method)
  File "/usr/local/lib/python2.7/site-packages/trac/web/chrome.py", line 1516, in _render_jinja_template
    page = self.render_template_string(template, data, text)
  File "/usr/local/lib/python2.7/site-packages/trac/web/chrome.py", line 1675, in render_template_string
    string = template.render(data)
  File "/usr/local/lib/python2.7/site-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/local/lib/python2.7/site-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/site-packages/trac/ticket/templates/ticket.html", line 12, in top-level template code
    # extends 'layout.html'
  File "/usr/local/lib/python2.7/site-packages/trac/templates/layout.html", line 12, in top-level template code
    # import "macros.html" as jmacros with context
  File "/usr/local/lib/python2.7/site-packages/trac/templates/theme.html", line 22, in top-level template code
    # block body
  File "/usr/local/lib/python2.7/site-packages/trac/templates/theme.html", line 128, in block "body"
    # block content
  File "/usr/local/lib/python2.7/site-packages/trac/ticket/templates/ticket.html", line 160, in block "content"
    #     include 'ticket_box.html'
  File "/usr/local/lib/python2.7/site-packages/trac/ticket/templates/ticket_box.html", line 212, in top-level template code
    ${wiki_to_html(context, ticket.description,
  File "/usr/local/lib/python2.7/site-packages/trac/wiki/formatter.py", line 1631, in format_to_html
    return HtmlFormatter(env, context, wikidom).generate(escape_newlines)
  File "/usr/local/lib/python2.7/site-packages/trac/wiki/formatter.py", line 1586, in generate
    escape_newlines)
  File "/usr/local/lib/python2.7/site-packages/trac/wiki/formatter.py", line 1366, in format
    result = re.sub(self.wikiparser.rules, self.replace, line)
  File "/usr/local/lib/python2.7/re.py", line 155, in sub
    return _compile(pattern, flags).sub(repl, string, count)
  File "/usr/local/lib/python2.7/site-packages/trac/wiki/formatter.py", line 1279, in replace
    replacement = self.handle_match(fullmatch)
  File "/usr/local/lib/python2.7/site-packages/trac/wiki/formatter.py", line 1272, in handle_match
    return external_handler(self, match, fullmatch)
  File "/var/trac/dev.haiku-os.org/plugins/link-haiku-cgit.py", line 45, in _format_revision_link
    revision = int(text[4:])
ValueError: invalid literal for int() with base 10: 'r 1alpha4-44699'

Change History (2)

comment:1 by nielx, 4 years ago

Status: newin-progress

The string that is causing problems is this one:

haiku-hrevr1alpha4-44699

Looking at the regexp of the hrevr it is different.

                ( r"(?:\b|!)hrev\d+\b(?!:\d)", self._format_revision_link),
                ( r"(?:\b|!)hrevr[\d\w]+\-\d+\b(?!:\d)", self._format_revision_link),

I am just unsure what hrevr is supposed to signify here.

comment:2 by nielx, 4 years ago

Milestone: Unscheduled
Resolution: fixed
Status: in-progressclosed

Removed the support for hrevr links.

Note: See TracTickets for help on using tickets.