Opened 14 years ago
Closed 14 years ago
#10355 closed defect (worksforme)
deploy_trac.wsgi contains syntax errors
| Reported by: | Owned by: | ||
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | general | Version: | 0.12.2 |
| Severity: | normal | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description
After upgrading Trac to 0.12.2, the new deploy_trac.wsgi file has syntax errors and cannot be executed by the web server. Applying these changes allows it to work:
--- /tmp/deploy_trac.wsgi 2011-09-15 15:44:55.000000000 -0700
+++ /usr/lib64/python2.6/site-packages/trac/admin/templates/deploy_trac.wsgi 2011-07-19 19:23:21.000000000 -0700
@@ -18,14 +18,14 @@
def application(environ, start_request):
if not 'trac.env_parent_dir' in environ:
- environ.setdefault('trac.env_path', ${repr(env.path)})
+ environ.setdefault('trac.env_path', '${repr(env.path)}')
if 'PYTHON_EGG_CACHE' in environ:
os.environ['PYTHON_EGG_CACHE'] = environ['PYTHON_EGG_CACHE']
elif 'trac.env_path' in environ:
- os.environ['PYTHON_EGG_CACHE'] = \\
+ os.environ['PYTHON_EGG_CACHE'] = \
os.path.join(environ['trac.env_path'], '.egg-cache')
elif 'trac.env_parent_dir' in environ:
- os.environ['PYTHON_EGG_CACHE'] = \\
+ os.environ['PYTHON_EGG_CACHE'] = \
os.path.join(environ['trac.env_parent_dir'], '.egg-cache')
from trac.web.main import dispatch_request
return dispatch_request(environ, start_request)
However, given the changes here, it makes me suspect the script expects to be interpolated when it is not (the shebang line is "#!${executable}", which is where this suspicion came from). With this in mind, this is probably not the proper fix but a symptom of some other issue and it just happens to work in its current state.
For completeness, this was built in gentoo, package www-apps/trac-0.12.2. However, building it from the package without any gentoo special sauce yields the same broken deploy_trac.wsgi.



The
deploy_trac.*scripts are indeed intended to be passed through Genshi, which is done when you executetrac-admin $ENV deploy(see TracAdmin). I have just checked that the interpolation works correctly on 0.12-stable.