Edgewall Software
Modify

Opened 16 years ago

Closed 15 years ago

#8103 closed defect (fixed)

Paths in trac.* files generated by trac-admin's deploy don't handle backslashes

Reported by: ejona86@… Owned by: Remy Blank
Priority: normal Milestone: 0.12
Component: admin/console Version: none
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

I used the deploy command in trac-admin which produced trac.cgi, trac.fcgi, and trac.wsgi in the cgi-bin folder. On Windows, because of backslashes, these files had incorrect TRAC_ENV strings:

os.environ['TRAC_ENV'] = 'C:\Documents and Settings\eanderso\trac\pd'

A simple solution is to make them raw strings:

os.environ['TRAC_ENV'] = r'C:\Documents and Settings\eanderso\trac\pd'

When using mod_wsgi, it produced this error output:

[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x] mod_wsgi (pid=5144): Exception occurred processing WSGI script 'C:/Documents and Settings/eanderso/trac/pd/apache/cgi-bin/trac.wsgi'.
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x] Traceback (most recent call last):
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x]   File "C:/Documents and Settings/eanderso/trac/pd/apache/cgi-bin/trac.wsgi", line 30, in application
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x]     from trac.web.main import dispatch_request
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x]   File "c:\\program files\\python\\python25\\lib\\site-packages\\Trac-0.11.3-py2.5-win32.egg\\trac\\web\\__init__.py", line 12, in <module>
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x]     from trac.web.api import *
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x]   File "c:\\program files\\python\\python25\\lib\\site-packages\\Trac-0.11.3-py2.5-win32.egg\\trac\\web\\api.py", line 29, in <module>
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x]     from trac.util import get_last_traceback, md5, unquote
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x]   File "c:\\program files\\python\\python25\\lib\\site-packages\\Trac-0.11.3-py2.5-win32.egg\\trac\\util\\__init__.py", line 33, in <module>
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x]     from trac.util.html import escape, unescape, Markup, Deuglifier
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x]   File "c:\\program files\\python\\python25\\lib\\site-packages\\Trac-0.11.3-py2.5-win32.egg\\trac\\util\\html.py", line 16, in <module>
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x]     from genshi import Markup, escape, unescape
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x]   File "C:\\Program Files\\Python\\Python25\\lib\\site-packages\\genshi-0.5.1-py2.5-win32.egg\\genshi\\__init__.py", line 32, in <module>
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x]   File "C:\\Program Files\\Python\\Python25\\lib\\site-packages\\genshi-0.5.1-py2.5-win32.egg\\genshi\\core.py", line 544, in <module>
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x]   File "C:\\Program Files\\Python\\Python25\\lib\\site-packages\\genshi-0.5.1-py2.5-win32.egg\\genshi\\_speedups.py", line 7, in <module>
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x]   File "C:\\Program Files\\Python\\Python25\\lib\\site-packages\\genshi-0.5.1-py2.5-win32.egg\\genshi\\_speedups.py", line 4, in __bootstrap__
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x]   File "C:\\Program Files\\Python\\Python25\\Lib\\site-packages\\pkg_resources.py", line 841, in resource_filename
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x]     self, resource_name
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x]   File "C:\\Program Files\\Python\\Python25\\Lib\\site-packages\\pkg_resources.py", line 1310, in get_resource_filename
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x]     self._extract_resource(manager, self._eager_to_zip(name))
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x]   File "C:\\Program Files\\Python\\Python25\\Lib\\site-packages\\pkg_resources.py", line 1332, in _extract_resource
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x]     self.egg_name, self._parts(zip_path)
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x]   File "C:\\Program Files\\Python\\Python25\\Lib\\site-packages\\pkg_resources.py", line 921, in get_cache_path
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x]     self.extraction_error()
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x]   File "C:\\Program Files\\Python\\Python25\\Lib\\site-packages\\pkg_resources.py", line 887, in extraction_error
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x]     raise err
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x] ExtractionError: Can't extract file(s) to egg cache
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x] 
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x] The following error occurred while trying to extract file(s) to the Python egg
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x] cache:
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x] 
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x]   [Error 123] The filename, directory name, or volume label syntax is incorrect: 'C:\\\\Documents and Settings\\\\eanderso\\trac'
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x] 
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x] The Python egg cache directory is currently set to:
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x] 
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x]   C:\\Documents and Settings\\eanderso\trac\\pd\\.egg-cache
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x] 
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x] Perhaps your account does not have write access to this directory?  You can
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x] change the cache directory by setting the PYTHON_EGG_CACHE environment
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x] variable to point to an accessible directory.
[Tue Mar 03 13:25:01 2009] [error] [client x.x.x.x] 

It looks like the fact that \t is a valid escape is important.

Attachments (3)

0.11 raw strings.patch (1.9 KB ) - added by ejona86@… 15 years ago.
Patch for 0.11 from SVN. Tested with wsgi
0.12 raw strings.patch (1.9 KB ) - added by ejona86@… 15 years ago.
Patch for 0.12 from SVN
8103-deployment-r9050.patch (1.8 KB ) - added by Remy Blank 15 years ago.
Fix using repr().

Download all attachments as: .zip

Change History (9)

comment:1 by Christian Boos, 16 years ago

Milestone: 0.11.4

comment:2 by anonymous, 15 years ago

Сonfirm. Trac 0.11.6

by ejona86@…, 15 years ago

Attachment: 0.11 raw strings.patch added

Patch for 0.11 from SVN. Tested with wsgi

by ejona86@…, 15 years ago

Attachment: 0.12 raw strings.patch added

Patch for 0.12 from SVN

comment:3 by Remy Blank, 15 years ago

Thanks for the patches. However, using raw strings doesn't solve the issue completely. Could you please test the following patch (for current trunk)?

by Remy Blank, 15 years ago

Attachment: 8103-deployment-r9050.patch added

Fix using repr().

comment:4 by Remy Blank, 15 years ago

Owner: set to Remy Blank

comment:5 by ejona86@…, 15 years ago

I just tested the WSGI version and verified the repr() version fixed the problem. Thanks!

comment:6 by Remy Blank, 15 years ago

Milestone: next-minor-0.12.x0.12
Resolution: fixed
Status: newclosed

Thanks for the feedback. Patch applied in [9060].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Remy Blank.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Remy Blank to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.