Bug 242248 - AssertionError: Import cycle in /usr/lib/python2.5/site-packages/viewvc/bin/mod_python/viewvc.py.
AssertionError: Import cycle in /usr/lib/python2.5/site-packages/viewvc/bin/m...
Product: Fedora
Classification: Fedora
Component: viewvc (Show other bugs)
All Linux
low Severity low
: ---
: ---
Assigned To: Bojan Smojver
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2007-06-02 13:02 EDT by WebMasters, Inc. Support
Modified: 2007-11-30 17:12 EST (History)
2 users (show)

See Also:
Fixed In Version: 1.0.4-2.fc7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-06-05 17:33:25 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description WebMasters, Inc. Support 2007-06-02 13:02:28 EDT
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]   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]   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]   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]   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]   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]   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]   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] 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
    Order allow,deny
    Allow from all

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


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 19:05:57 EDT
I can replicate this. Working on it...
Comment 2 Bojan Smojver 2007-06-03 01:40:35 EDT
Please try -2, now available in Koji:

Comment 3 Denis Arnaud 2007-06-03 16:26:14 EDT
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.

Comment 4 WebMasters, Inc. Support 2007-06-03 19:27:18 EDT
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 19:43:06 EDT
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-04 20:13:35 EDT
Now available from updates-testing. If nobody complains, I'll push to updates
Comment 7 Denis Arnaud 2007-06-05 06:09:12 EDT
It seems to work for me.

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

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