Opened 4 years ago

Closed 4 years ago

Exception while rendering a diff file

Reported by: Owned by: rjollos ejucovy normal PermRedirectPlugin normal 1.0

I was investigating Bloodhound issue #308, and trying to determine why .patch files rendered with syntax highlighting, but .diff files did not. The issue I'm reporting here appears to be unrelated. During the rendering of .diff files I saw the following traceback:

Traceback (most recent call last):
File "/home/user/Workspace/bloodhound/trac/trac/web/main.py", line 497, in _dispatch_request
dispatcher.dispatch(req)
File "/home/user/Workspace/bloodhound/trac/trac/web/main.py", line 236, in dispatch
self._post_process_request(req)
File "/home/user/Workspace/bloodhound/trac/trac/web/main.py", line 340, in _post_process_request
f.post_process_request(req, *(None,)*extra_arg_count)
File "/home/user/Workspace/trac-hacks/permredirectplugin/trunk/permredirect/filter.py", line 59, in post_process_request
if issubclass(exctype, PermissionError):
TypeError: issubclass() arg 1 must be a class


Full traceback is attached. To reproduce, attach a file ending in .diff to a ticket and then view the file. You may be able to reproduce under other circumstances as well ... I haven't investigated thoroughly.

I'm not sure what the correct fix is, but the following patch makes the exception go away:

• permredirectplugin/trunk/permredirect/filter.py

 ref_url = ref_url + "?" + req.query_string login_url = req.href.login(referer=ref_url) if issubclass(exctype, PermissionError): if exctype and issubclass(exctype, PermissionError): req.redirect(login_url) try:

comment:1 Changed 4 years ago by rjollos

The issue was confirmed with the latest version of the trunk code.

comment:2 Changed 4 years ago by ejucovy

• Resolution set to fixed
• Status changed from new to closed

(In [12446]) fixes #10709 -- don't explode with a system error if sys.exc_info()[0] is None. also, add some logging code in that situation, because i don't understand when it happens.

comment:3 Changed 4 years ago by ejucovy

I can't reproduce this on a fresh Trac environment (trunk@11483 with no custom components other than permredirect) so let me know if this doesn't fix the issue for you.

comment:4 Changed 4 years ago by rjollos

Thanks for the fix. I'll do some testing soon and get back to you.

comment:5 Changed 3 years ago by rjollos

• Description modified (diff)

comment:6 Changed 3 years ago by rjollos

• Summary changed from Exception while rendering a patch file to Exception while rendering a diff file

comment:7 Changed 3 years ago by rjollos

The issue seems to be fixed now. Sorry I don't have more info on what the cause might have been. I'll let you know if I come across a case where the debug info you added gets logged.