Edgewall Software

Ticket #7204 (new defect)

Opened 7 months ago

Last modified 7 months ago

Config loader should die on error

Reported by: nkantrowitz Owned by: jonas
Priority: normal Milestone: 0.13
Component: general Version: 0.12dev
Severity: normal Keywords:
Cc: nkantrowitz

Description

Configuration.parse_if_needed should die if self.parser.read(self.filename) returns [] as this indicates it wasn't able to read the file. This generally happens either if a permission error prevents trac.ini from being read, or if the path to a parent config is invalid. A more helpful error message is desirable in either case.

Attachments

Change History

Changed 7 months ago by Kamil Kisiel <kamil@…>

We discovered this as a result of me attempting to configure Trac under FastCGI. Instead of an error related to being unable to read the trac.ini I got this:

{{{Traceback (most recent call last):

File "/usr/lib64/python2.5/site-packages/trac/web/api.py", line 339, in send_error

'text/html')

File "/usr/lib64/python2.5/site-packages/trac/web/chrome.py", line 684, in render_template

data = self.populate_data(req, data)

File "/usr/lib64/python2.5/site-packages/trac/web/chrome.py", line 592, in populate_data

dchrome?.update(req.chrome)

File "/usr/lib64/python2.5/site-packages/trac/web/api.py", line 168, in getattr

value = self.callbacks[name](self)

File "/usr/lib64/python2.5/site-packages/trac/web/chrome.py", line 460, in prepare_request

for category, name, text in contributor.get_navigation_items(req):

File "/usr/lib64/python2.5/site-packages/trac/ticket/web_ui.py", line 134, in get_navigation_items

if 'TICKET_CREATE' in req.perm:

File "/usr/lib64/python2.5/site-packages/trac/perm.py", line 521, in has_permission

return self._has_permission(action, resource)

File "/usr/lib64/python2.5/site-packages/trac/perm.py", line 535, in _has_permission

check_permission(action, perm.username, resource, perm)

File "/usr/lib64/python2.5/site-packages/trac/perm.py", line 424, in check_permission

perm)

File "/usr/lib64/python2.5/site-packages/trac/perm.py", line 282, in check_permission

get_user_permissions(username)

File "/usr/lib64/python2.5/site-packages/trac/perm.py", line 357, in get_user_permissions

for perm in self.store.get_user_permissions(username):

File "/usr/lib64/python2.5/site-packages/trac/perm.py", line 173, in get_user_permissions

db = self.env.get_db_cnx()

File "/usr/lib64/python2.5/site-packages/trac/env.py", line 251, in get_db_cnx

return DatabaseManager?(self).get_connection()

File "/usr/lib64/python2.5/site-packages/trac/db/api.py", line 76, in get_connection

return self._cnx_pool.get_cnx(self.timeout or None)

File "/usr/lib64/python2.5/site-packages/trac/db/pool.py", line 101, in get_cnx

cnx = self._connector.get_connection(**self._kwargs)

File "/usr/lib64/python2.5/site-packages/trac/db/sqlite_backend.py", line 125, in get_connection

return SQLiteConnection(path, params)

File "/usr/lib64/python2.5/site-packages/trac/db/sqlite_backend.py", line 167, in init

% (getuser(), path))

TracError: The user apache requires read _and_ write permission to the database file /var/lib/trac/db/trac.db and the directory it is located in. }}}

The confusing part about it was that it was attempting to use an sqlite database, whereas my DB is PostgreSQL. Trac should have died earlier in the process when it could not read the config file, instead of continuing and attempting to load the defaults.

Add/Change #7204 (Config loader should die on error)

Author



Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change from jonas. Next status will be 'new'
The owner will change from jonas to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.