Bug 594011 - Python exception when trying to show svn log of a deleted item
Python exception when trying to show svn log of a deleted item
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: viewvc (Show other bugs)
12
All Linux
low Severity medium
: ---
: ---
Assigned To: Bojan Smojver
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-05-20 06:43 EDT by Patrick Monnerat
Modified: 2010-05-31 14:29 EDT (History)
3 users (show)

See Also:
Fixed In Version: viewvc-1.1.5-2.fc12
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-05-31 14:29:30 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Patrick Monnerat 2010-05-20 06:43:19 EDT
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 09:29:57 EDT
To your knowledge, has this issue been reported by someone upstream?
Comment 2 Patrick Monnerat 2010-05-20 09:33:34 EDT
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 09:39:24 EDT
OK, thanks.
Comment 4 Bojan Smojver 2010-05-20 20:14:38 EDT
Reported upstream: http://viewvc.tigris.org/issues/show_bug.cgi?id=458
Comment 5 C. Michael Pilato 2010-05-21 12:08:55 EDT
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-21 20:44:11 EDT
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 03:54:36 EDT
Tested: it fixes the current problem successfully.
Comment 8 Bojan Smojver 2010-05-25 03:57:49 EDT
Thank you. I'll patch, build and push to testing.
Comment 9 Patrick Monnerat 2010-05-25 04:02:36 EDT
Thanks for your action and interest Bojan.
Comment 10 Fedora Update System 2010-05-25 05:06:48 EDT
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 14:34:49 EDT
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 14:29:26 EDT
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.