Edgewall Software
Modify

Opened 14 years ago

Closed 14 years ago

#9556 closed defect (fixed)

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

Reported by: benjamin@… Owned by: Remy Blank
Priority: high Milestone: 0.12.1
Component: database backend Version: 0.12-stable
Severity: blocker Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal 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 (0)

Change History (4)

comment:1 by Remy Blank, 14 years ago

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 by anonymous, 14 years ago

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 by Remy Blank, 14 years ago

Component: admin/consoledatabase backend
Owner: set to Remy Blank

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 by Remy Blank, 14 years ago

Resolution: fixed
Status: newclosed

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

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.