Edgewall Software

Opened 15 years ago

Closed 15 years ago

Last modified 8 years ago

#4794 closed defect (fixed)

Error if ticket reference is bigger than sys.maxint

Reported by: anonymous Owned by: Christian Boos
Priority: high Milestone: 0.10.4
Component: wiki system Version: 0.10.3
Severity: normal Keywords: traclinks
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Christian Boos)

If you have "#12222222 22222222" (I put the space in there only so trac's trac doesn't crash due to this same bug) on a Wiki page or in a subversion commit log, trac tries to look up that ticket number. If the number is larger than maxint, there is an error. This makes the revision log and the timeline unusable. I'm not sure if it is strictly a postfix problem or not. I fixed it by adding

if long(target) < maxint

to api.py, just before:

                cursor = formatter.db.cursor()
                cursor.execute("SELECT summary,status FROM ticket WHERE id=%s",
                row = cursor.fetchone()
                if row:
                    return html.A(label, class_='%s ticket' % row[1],
                                  title=shorten_line(row[0]) + ' (%s)' % row[1],

and indenting those lines (at about line 215). Of course, I added "from sys import maxint" at the top.

I think that will fix the same problem for report numbers as well.

Attachments (0)

Change History (7)

comment:1 by eli.carter@…, 15 years ago

Looks like #4792 and #4793 are nice demos of the same problem in the ticket system…

comment:2 by Christian Boos, 15 years ago

Description: modified (diff)

Seems this is PostgreSQL specific (works fine with SQLite and MySQL).

With PostgreSQL, #2147483647 works but #2147483647+1 doesn't ;-) So yes, checking against sys.maxint seems the right thing to do (would be worth a check on a 64-bits machine, though).

comment:3 by Christian Boos, 15 years ago

Component: generalwiki
Milestone: 0.10.4
Owner: changed from Jonas Borgström to Christian Boos
Priority: normalhigh

comment:4 by Christian Boos, 15 years ago

Keywords: traclinks added
Status: newassigned

Should be fixed in r4806 (trunk) and r4807 (0.10-stable).

Need to verify if the fix works on 64-bits machines as well..

comment:5 by Christian Boos, 15 years ago

Resolution: fixed
Status: assignedclosed

Ok, this needed a follow-up in order to work on 64-bits machines: r4808 (trunk) and r4809 (0.10-stable).

comment:6 by Ryan J Ollos, 8 years ago

Keywords: traclink added; traclinks removed

comment:7 by Ryan J Ollos, 8 years ago

Keywords: traclinks added; traclink removed

Modify Ticket

Change Properties
Set your email in Preferences
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.