Edgewall Software
Modify

Ticket #9556 (closed defect: fixed)

Opened 22 months ago

Last modified 22 months ago

IndexError: string index out of range in trac-admin upgrade

Reported by: benjamin@… Owned by: rblank
Priority: high Milestone: 0.12.1
Component: database backend Version: 0.12-stable
Severity: blocker Keywords:
Cc:
Release Notes:
API Changes:

Description

When I try to upgrade from 0.11.7 to 0.12 I get the following output. I really have no clue at all where I should start looking.

Trac was installed using Gentoo's emerge trac, python version is 2.6.5-r3, sqlite 3.6.23.1 and pysqlite 2.6.0

trac-admin .
Willkommen bei trac-admin 0.12
Interaktive Administrations-Konsole von Trac
Copyright (c) 2003-2010 Edgewall Software

Geben Sie '?' oder 'help' für Hilfe zu den Kommandos ein.
        
Trac [trac]> upgrade
IndexError: string index out of range

Attachments

Change History

comment:1 Changed 22 months ago by rblank

That's not a useful error message, granted. But you should have a full traceback in the log. Could you please post it here?

comment:2 Changed 22 months ago by anonymous

Sorry I didn't have a look in the log/trac.log since I exspected the trace to show up in the console. But here it is

2010-08-07 19:32:06,531 Trac[console] ERROR: Exception in trac-admin command: 
Traceback (most recent call last):
  File "/usr/lib64/python2.6/site-packages/trac/admin/console.py", line 107, in onecmd
    rv = cmd.Cmd.onecmd(self, line) or 0
  File "/usr/lib64/python2.6/cmd.py", line 218, in onecmd
    return self.default(line)
  File "/usr/lib64/python2.6/site-packages/trac/admin/console.py", line 257, in default
    return cmd_mgr.execute_command(*args)
  File "/usr/lib64/python2.6/site-packages/trac/admin/api.py", line 123, in execute_command
    return f(*fargs)
  File "/usr/lib64/python2.6/site-packages/trac/env.py", line 790, in _do_upgrade
    self.env.upgrade(backup=no_backup is None)
  File "/usr/lib64/python2.6/site-packages/trac/env.py", line 528, in upgrade
    self.backup(backup_dest)
  File "/usr/lib64/python2.6/site-packages/trac/env.py", line 500, in backup
    return DatabaseManager(self).backup(dest)
  File "/usr/lib64/python2.6/site-packages/trac/db/api.py", line 169, in backup
    if backup_dir[0] != "/":
IndexError: string index out of range

comment:3 Changed 22 months ago by rblank

  • Component changed from admin/console to database backend
  • Owner set to rblank

It seems that Trac is choking on your [trac] backup_dir option being empty. Could you please try the following patch:

  • trac/db/api.py

    diff --git a/trac/db/api.py b/trac/db/api.py
    a b  
    166166        connector, args = self.get_connector() 
    167167        if not dest: 
    168168            backup_dir = self.backup_dir 
    169             if backup_dir[0] != "/": 
     169            if not os.path.isabs(backup_dir): 
    170170                backup_dir = os.path.join(self.env.path, backup_dir) 
    171171            db_str = self.config.get('trac', 'database') 
    172172            db_name, db_path = db_str.split(":", 1) 

Note that an empty value for the option above means that database backups will be stored in the root of your Trac environment. That's not necessarily a good idea.

comment:4 Changed 22 months ago by rblank

  • Resolution set to fixed
  • Status changed from new to closed

Patch confirmed on IRC, and applied in [9989].

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from rblank. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.