Edgewall Software
Modify

Opened 13 years ago

Closed 13 years ago

#9841 closed defect (worksforme)

SQLite database connector doesn't work on existing directories

Reported by: Sebastian Krysmanski <sebastian@…> Owned by: Remy Blank
Priority: normal Milestone:
Component: database backend Version: 0.12.1
Severity: major Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

The SQLite database connector doesn't work on existing directories. This can easily verified by creating a new Trac env and using this database URI:

sqlite:/path/that/exists/tractest.db

where the directory /path/that/exists already exists but tractest.db doesn't (obviously).

In this case you get the following error:

Database connection string [sqlite:db/trac.db]> sqlite:/mnt/hgfs/Linux-Share/tractest.db

Creating and Initializing Project
Initenv for '/srv/tracsandbox/testenv2' failed.
Failed to create environment.
[Errno 17] File exists: '/mnt/hgfs/Linux-Share'
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/admin/console.py", line 422, in do_initenv
    options=options)
  File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/env.py", line 213, in __init__
    self.create(options)
  File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/env.py", line 401, in create
    DatabaseManager(self).init_db()
  File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/db/api.py", line 146, in init_db
    connector.init_db(**args)
  File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/db/sqlite_backend.py", line 187, in init_db
    os.makedirs(os.path.split(path)[0])
  File "/usr/lib/python2.6/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 17] File exists: '/mnt/hgfs/Linux-Share'

I've attached a patch that fixes this problem.

Attachments (1)

sqlite_mkdirs.patch (748 bytes ) - added by Sebastian Krysmanski <sebastian@…> 13 years ago.
Patch against Trac 0.12.1

Download all attachments as: .zip

Change History (3)

by Sebastian Krysmanski <sebastian@…>, 13 years ago

Attachment: sqlite_mkdirs.patch added

Patch against Trac 0.12.1

comment:1 by Remy Blank, 13 years ago

Milestone: 0.12.2
Owner: set to Remy Blank

Thanks for the patch.

comment:2 by Remy Blank, 13 years ago

Milestone: 0.12.2
Resolution: worksforme
Status: newclosed

Heh, I seem to have fixed that already in [10231].

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.