Bug 594011 - Python exception when trying to show svn log of a deleted item
Summary: Python exception when trying to show svn log of a deleted item
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: viewvc
Version: 12
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Bojan Smojver
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-05-20 10:43 UTC by Patrick Monnerat
Modified: 2010-05-31 18:29 UTC (History)
3 users (show)

Fixed In Version: viewvc-1.1.5-2.fc12
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-05-31 18:29:30 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Patch fixing the described exception/crash (623 bytes, patch)
2010-05-20 10:43 UTC, Patrick Monnerat
no flags Details | Diff

Description Patrick Monnerat 2010-05-20 10:43:19 UTC
Created attachment 415383 [details]
Patch fixing the described exception/crash

Description of problem:
When clicking on the "deleted" link of an SVN item (i.e.: from a revision view), The result is:
An Exception Has Occurred
Python Traceback

Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/viewvc/lib/viewvc.py", line 4318, in main
    request.run_viewvc()
  File "/usr/lib/python2.6/site-packages/viewvc/lib/viewvc.py", line 397, in run_viewvc
    self.view_func(self)
  File "/usr/lib/python2.6/site-packages/viewvc/lib/viewvc.py", line 2513, in view_log
    lastrev = pathrev_form(request, data)
  File "/usr/lib/python2.6/site-packages/viewvc/lib/viewvc.py", line 2225, in pathrev_form
    action, hidden_values = request.get_form(params={'pathrev': lastrev})
  File "/usr/lib/python2.6/site-packages/viewvc/lib/viewvc.py", line 435, in get_form
    value=self.server.escape(value)))
  File "/usr/lib/python2.6/site-packages/viewvc/lib/sapi.py", line 51, in escape
    return escape(s)
  File "/usr/lib/python2.6/site-packages/viewvc/lib/sapi.py", line 36, in escape
    s = string.replace(s, '&', '&')
  File "/usr/lib64/python2.6/string.py", line 517, in replace
    return s.replace(old, new, maxsplit)
AttributeError: 'int' object has no attribute 'replace'



Version-Release number of selected component (if applicable):
viewvc-1.1.5-1

How reproducible:
Always

Steps to Reproduce:
1. Configure viewvc to an SVN repository containing a deleted item.
2. Enter revision view mentioning a deleted item
3. Click on the "deleted" link
  
Actual results:
See above

Expected results:
Log view of the deleted item

Additional info:
This bug occurs because the SVN-specific last_rev() method may return an integer (not a string). Later, this value is expected to be a string.
  Please find attached a patch of my own (I'm still not a python/viewvc guru !) fixing this problem. The real problem might be more general, but the patch fixes the current case.

Comment 1 Bojan Smojver 2010-05-20 13:29:57 UTC
To your knowledge, has this issue been reported by someone upstream?

Comment 2 Patrick Monnerat 2010-05-20 13:33:34 UTC
Don't know. I only checked the code in CVS visually and it does not seem fixed... at least around the instructions I acted on. I did not report it myself.

Comment 3 Bojan Smojver 2010-05-20 13:39:24 UTC
OK, thanks.

Comment 4 Bojan Smojver 2010-05-21 00:14:38 UTC
Reported upstream: http://viewvc.tigris.org/issues/show_bug.cgi?id=458

Comment 5 C. Michael Pilato 2010-05-21 16:08:55 UTC
This was previously reported upstream, too.

   http://viewvc.tigris.org/issues/show_bug.cgi?id=454

The fix wasn't obvious in the codebase because I opted to force the escape() function to stringify its input, rather than patch this one instance of its use.

Comment 6 Bojan Smojver 2010-05-22 00:44:11 UTC
Patrick,

Could you try the official patch from issue 454?

Index: lib/sapi.py
===================================================================
--- lib/sapi.py	(revision 2369)
+++ lib/sapi.py	(revision 2370)
@@ -33,6 +33,7 @@
 # that character as-is, and sometimes needs to embed escaped values
 # into HTML attributes.
 def escape(s):
+  s = str(s)
   s = string.replace(s, '&', '&')
   s = string.replace(s, '>', '>')
   s = string.replace(s, '<', '&lt;')

Comment 7 Patrick Monnerat 2010-05-25 07:54:36 UTC
Tested: it fixes the current problem successfully.

Comment 8 Bojan Smojver 2010-05-25 07:57:49 UTC
Thank you. I'll patch, build and push to testing.

Comment 9 Patrick Monnerat 2010-05-25 08:02:36 UTC
Thanks for your action and interest Bojan.

Comment 10 Fedora Update System 2010-05-25 09:06:48 UTC
viewvc-1.1.5-2.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/viewvc-1.1.5-2.fc12

Comment 11 Fedora Update System 2010-05-25 18:34:49 UTC
viewvc-1.1.5-2.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update viewvc'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/viewvc-1.1.5-2.fc12

Comment 12 Fedora Update System 2010-05-31 18:29:26 UTC
viewvc-1.1.5-2.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.