Bug 242248

Summary: AssertionError: Import cycle in /usr/lib/python2.5/site-packages/viewvc/bin/mod_python/viewvc.py.
Product: [Fedora] Fedora Reporter: WebMasters, Inc. Support <support>
Component: viewvcAssignee: Bojan Smojver <bojan>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: 7CC: bjohnson, denis.arnaud_rhbug
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
URL: http://viewvc.tigris.org/issues/show_bug.cgi?id=300
Whiteboard:
Fixed In Version: 1.0.4-2.fc7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-06-05 21:33:25 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description WebMasters, Inc. Support 2007-06-02 17:02:28 UTC
Description of problem:

The latest Python 2.5 and mod_python in Fedora 7 surfaced an import cycle error
in ViewVC 1.0.4.

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

Fedora 7
ViewVC 1.0.4
Python 2.5
mod_python 3.3.1

How reproducible:

Every time.

Steps to Reproduce:

1. On Fedora 7 system, enable viewvc with default configuration in
/etc/httpd/conf.d/viewvc.conf and /etc/viewvc/viewvc.conf
2. Webpage at http://yourhost/viewvc  will show Internal Server Error

Actual results:

In error_log, with debug enabled, you will receive following:

Sat Jun 02 12:32:05 2007] [error] [client 69.134.94.157]   File
"/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1128, in
_execute_target\n    result = object(arg)
[Sat Jun 02 12:32:05 2007] [error] [client 69.134.94.157]   File
"/usr/lib/python2.5/site-packages/viewvc/bin/mod_python/handler.py", line 24, in
handler\n    module = apache.import_module(module_name, path=[path])
[Sat Jun 02 12:32:05 2007] [error] [client 69.134.94.157]   File
"/usr/lib/python2.5/site-packages/mod_python/importer.py", line 296, in
import_module\n    log, import_path)
[Sat Jun 02 12:32:05 2007] [error] [client 69.134.94.157]   File
"/usr/lib/python2.5/site-packages/mod_python/importer.py", line 680, in
import_module\n    execfile(file, module.__dict__)
[Sat Jun 02 12:32:05 2007] [error] [client 69.134.94.157]   File
"/usr/lib/python2.5/site-packages/viewvc/bin/mod_python/viewvc.py", line 45, in
<module>\n    import viewvc
[Sat Jun 02 12:32:05 2007] [error] [client 69.134.94.157]   File
"/usr/lib/python2.5/site-packages/mod_python/importer.py", line 991, in
load_module\n    return _global_modules_cache.import_module(self.__file)
[Sat Jun 02 12:32:05 2007] [error] [client 69.134.94.157]   File
"/usr/lib/python2.5/site-packages/mod_python/importer.py", line 488, in
import_module\n    assert(file != parent_info.file), "Import cycle in %s." % file
[Sat Jun 02 12:32:05 2007] [error] [client 69.134.94.157] AssertionError: Import
cycle in /usr/lib/python2.5/site-packages/viewvc/bin/mod_python/viewvc.py.

Expected results:

ViewVC should work. ;)

Additional info:

It can be worked around by enabling CGI mode.  

I switched us to using the CGI.  I commented out the mod_python lines in
/etc/httpd/conf.d/viewvc.conf and that file has now the following:

#Alias /viewvc /usr/lib/python2.5/site-packages/viewvc/bin/mod_python/viewvc.py
Alias /viewvc /usr/lib/python2.5/site-packages/viewvc/bin/cgi/viewvc.cgi
Alias /viewvc-static /usr/share/viewvc/templates/docroot

<Directory /usr/lib/python2.5/site-packages/viewvc/bin/mod_python>
#    AddHandler python-program .py
    AddHandler cgi-script .py
    PythonHandler handler
    PythonPath
"sys.path+['/usr/lib/python2.5/site-packages/viewvc/bin/mod_python']"
    Order allow,deny
    Allow from all

     AuthType Basic
     AuthName "Authorization Realm"
     AuthUserFile /home/svn-repositories/.htpasswd
     Require valid-user

</Directory>

In addition, I had to put a .htaccess file with "Options +ExecCGI" in
"/usr/lib/python2.5/site-packages/viewvc/bin/cgi/" and also put "AllowOverride
None +ExecCGI" for the "Directory /" stanza in /etc/httpd/conf/httpd.conf

Comment 1 Bojan Smojver 2007-06-02 23:05:57 UTC
I can replicate this. Working on it...

Comment 2 Bojan Smojver 2007-06-03 05:40:35 UTC
Please try -2, now available in Koji:

http://koji.fedoraproject.org/koji/buildinfo?buildID=7852

Comment 3 Denis Arnaud 2007-06-03 20:26:14 UTC
There is another work around with mod_python:
In the directory /usr/lib/python2.5/site-packages/viewvc/bin/mod_python, the
viewvc.py file has to be renamed into viewvc_cgi.py (or something like that).

As I understand it, the viewvc.py, normally restricted to the CGI usage, is in
the way of the mod_python access.

When Apache is restarted, it works.

Denis

Comment 4 WebMasters, Inc. Support 2007-06-03 23:27:18 UTC
That RPM worked.  Took me a minute to realize there's a little migration step as
viewvc.conf got created as viewvc.conf.rpmnew and the file was renamed to -mp,
but other than that, works.

Comment 5 Bojan Smojver 2007-06-03 23:43:06 UTC
Very well. Thank you for testing!

Once this gets fixed upstream, we'll roll a new version for a more permanent fix.

Comment 6 Bojan Smojver 2007-06-05 00:13:35 UTC
Now available from updates-testing. If nobody complains, I'll push to updates
tomorrow.

Comment 7 Denis Arnaud 2007-06-05 10:09:12 UTC
It seems to work for me.
Thanks!

Denis

Comment 8 Bojan Smojver 2007-06-05 21:33:25 UTC
Requested push to updates. Thanks everyone for testing!