Edgewall Software
Modify

Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#11613 closed defect (fixed)

DataError: invalid input syntax for integer: "x"LINE 2: ... SELECT title, description, query from report WHERE id='x' ^

Reported by: ldubox-coding101@… Owned by: Jun Omae
Priority: normal Milestone: 1.0.2
Component: report system Version: 1.0-stable
Severity: normal Keywords: postgresql
Cc: Branch:
Release Notes:

Fix report: link with non-digit characters leading DataError on PostgreSQL.

API Changes:
Internal Changes:

Description

How to reproduce

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

Just try and browse to the ticket. An excerpt for it appears in the search results, but trying to actually view the ticket fails.

Request parameters:

{'id': u'6728'}

User agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:30.0) Gecko/20100101 Firefox/30.0

Python Traceback

Traceback (most recent call last):
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/Trac-1.1.2dev_r12592-py2.7.egg/trac/web/main.py", line 517, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/Trac-1.1.2dev_r12592-py2.7.egg/trac/web/main.py", line 221, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/Trac-1.1.2dev_r12592-py2.7.egg/trac/ticket/web_ui.py", line 188, in process_request
    return self._process_ticket_request(req)
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/Trac-1.1.2dev_r12592-py2.7.egg/trac/ticket/web_ui.py", line 658, in _process_ticket_request
    get_reporter_id(req, 'author'), field_changes)
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/Trac-1.1.2dev_r12592-py2.7.egg/trac/ticket/web_ui.py", line 1628, in _insert_ticket_data
    fields = self._prepare_fields(req, ticket, field_changes)
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/Trac-1.1.2dev_r12592-py2.7.egg/trac/ticket/web_ui.py", line 1589, in _prepare_fields
    escape_newlines=self.must_preserve_newlines)
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/Trac-1.1.2dev_r12592-py2.7.egg/trac/wiki/formatter.py", line 1589, in format_to_html
    return HtmlFormatter(env, context, wikidom).generate(escape_newlines)
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/Trac-1.1.2dev_r12592-py2.7.egg/trac/wiki/formatter.py", line 1544, in generate
    escape_newlines)
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/Trac-1.1.2dev_r12592-py2.7.egg/trac/wiki/formatter.py", line 1326, in format
    result = re.sub(self.wikiparser.rules, self.replace, line)
  File "/usr/lib/python2.7/re.py", line 151, in sub
    return _compile(pattern, flags).sub(repl, string, count)
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/Trac-1.1.2dev_r12592-py2.7.egg/trac/wiki/formatter.py", line 1244, in replace
    replacement = self.handle_match(fullmatch)
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/Trac-1.1.2dev_r12592-py2.7.egg/trac/wiki/formatter.py", line 1240, in handle_match
    return internal_handler(match, fullmatch)
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/Trac-1.1.2dev_r12592-py2.7.egg/trac/wiki/formatter.py", line 623, in _shref_formatter
    return self._make_link(ns, target, match, match, fullmatch)
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/Trac-1.1.2dev_r12592-py2.7.egg/trac/wiki/formatter.py", line 674, in _make_link
    fullmatch)
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/Trac-1.1.2dev_r12592-py2.7.egg/trac/ticket/report.py", line 913, in _format_link
    self.get_report(id)
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/Trac-1.1.2dev_r12592-py2.7.egg/trac/ticket/report.py", line 762, in get_report
    """, (id,)):
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/Trac-1.1.2dev_r12592-py2.7.egg/trac/db/api.py", line 122, in execute
    return db.execute(query, params)
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/Trac-1.1.2dev_r12592-py2.7.egg/trac/db/util.py", line 121, in execute
    cursor.execute(query, params)
  File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/Trac-1.1.2dev_r12592-py2.7.egg/trac/db/util.py", line 65, in execute
    return self.cursor.execute(sql_escape_percent(sql), args)
DataError: invalid input syntax for integer: "x"
LINE 2: ...   SELECT title, description, query from report WHERE id='x'
                                                                    ^

Attachments (0)

Change History (5)

comment:1 by Jun Omae, 11 years ago

Component: generalreport system
Keywords: postgres added
Milestone: 1.0.2
Version: 1.0-stable

Thanks for the reporting.

Reproduced with report:x on PostgreSQL. It seems that the issue has been introduced in [11986] (#11166).

comment:2 by Jun Omae, 11 years ago

Owner: set to Jun Omae
Status: newassigned

Proposed changes in [09139671/jomae.git]. I'll push it later.

comment:3 by Jun Omae, 11 years ago

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

Fixed in [12786] and merged to trunk in [12787].

comment:4 by ldubox-coding101@…, 11 years ago

Brilliant, thanks for the quick fix! Out of curiosity, when will the fix become live on your server?

Luke

comment:5 by Ryan J Ollos, 10 years ago

Keywords: postgresql added; postgres removed

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.