Edgewall Software

Opened 3 years ago

Closed 3 years ago

#13354 closed defect (fixed)

RegressionTestTicket7821var failing — at Version 3

Reported by: Jun Omae Owned by: Jun Omae
Priority: normal Milestone: 1.4.3
Component: wiki system Version: 1.5.2
Severity: normal Keywords: intertrac
Cc: Branch:
Release Notes:

Fix incorrect redirection via intertrac dispatcher with & characters.

API Changes:
Internal Changes:

Description (last modified by Jun Omae)

======================================================================
ERROR: runTest (trac.ticket.tests.functional.main.RegressionTestTicket7821var)
Test for regression of https://trac.edgewall.org/ticket/7821 var
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jun66j5/src/tracdev/git/trac/ticket/tests/functional/main.py", line 1530, in runTest
    tc.find('<input type="text" name="1_cc"[ \n]+value="admin"'
  File "/home/jun66j5/src/tracdev/git/trac/tests/functional/better_twill.py", line 191, in find
    raise AssertionError("Regex didn't match: {!r} not found in {}"
AssertionError: Regex didn't match: '<input type="text" name="1_cc"[ \n]+value="admin" size="[0-9]+"/>' not found in file:///home/jun66j5/src/tracdev/git/testenv/trac/log/RegressionTestTicket7821var.html

----------------------------------------------------------------------

Change History (3)

comment:1 by Jun Omae, 3 years ago

Component: query systemwiki system
Description: modified (diff)
Keywords: intertrac added
Milestone: 1.5.31.4.3

It seems InterTracDispatcher with & characters is broken since 1.4.

$ curl -sv 'http://127.0.0.1:3000/1.5-sqlite/intertrac/query:owner=$USER&or&cc~=$USER' 2>&1 | grep -i 'Location:'
< Location: http://127.0.0.1:3000/1.5-sqlite/query?owner=%24USER&amp;or&amp;cc=~%24USER&amp;order=priority

$ curl -sv 'http://127.0.0.1:3000/1.4-sqlite/intertrac/query:owner=$USER&or&cc~=$USER' 2>&1 | grep -i 'Location:'
< Location: http://127.0.0.1:3000/1.4-sqlite/query?owner=%24USER&amp;or&amp;cc=~%24USER&amp;order=priority

$ curl -sv 'http://127.0.0.1:3000/1.2-sqlite/intertrac/query:owner=$USER&or&cc~=$USER' 2>&1 | grep -i 'Location:'
< Location: http://127.0.0.1:3000/1.2-sqlite/query?owner=%24USER&or&cc=~%24USER&order=priority

$ curl -sv 'http://127.0.0.1:3000/1.0-sqlite/intertrac/query:owner=$USER&or&cc~=$USER' 2>&1 | grep -i 'Location:'
< Location: http://127.0.0.1:3000/1.0-sqlite/query?owner=%24USER&or&cc=~%24USER&order=priority

Investigating with the following script:

import trac
print(trac.__version__)

from trac.test import EnvironmentStub, MockRequest
from trac.loader import load_components
from trac.web.api import RequestDone
from trac.web.chrome import web_context
from trac.wiki.formatter import extract_link
from trac.wiki.intertrac import InterTracDispatcher

def listener(*args):
    print(repr(args[1]))

env = EnvironmentStub()
load_components(env)
req = MockRequest(env, path_info='/intertrac/query:owner=$USER&or&cc~=$USER')
req.add_redirect_listener(listener)
context = web_context(req)
dispatcher = InterTracDispatcher(env)
dispatcher.match_request(req)
try:
    dispatcher.process_request(req)
except RequestDone:
    pass

Since 1.4, the component passes a Markup instance to req.redirect().

$ for i in ~/venv/trac/{1.0.20,1.2.6,1.4.2,1.5.2}/bin/python; do $i ./t13354.py; done
1.0.20
u'/trac.cgi/query?owner=%24USER&or&cc=~%24USER&order=priority'
1.2.6
u'/trac.cgi/query?owner=%24USER&or&cc=~%24USER&order=priority'
1.4.2
Markup(u'/trac.cgi/query?owner=%24USER&amp;or&amp;cc=~%24USER&amp;order=priority')
1.5.2
Markup('/trac.cgi/query?owner=%24USER&amp;or&amp;cc=~%24USER&amp;order=priority')

comment:2 by Jun Omae, 3 years ago

Owner: set to Jun Omae
Status: newassigned

Proposed changes for the following branches:

comment:3 by Jun Omae, 3 years ago

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

Committed in [17501] and merged in [17502].

Note: See TracTickets for help on using tickets.