Edgewall Software
Modify

Opened 16 years ago

Closed 16 years ago

#7798 closed defect (fixed)

trac-admin hotcopy dies on unreadable files

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

Description

Background: I'm using a nightly cron script to backup my trac environment by calling trac-admin hotcopy. When I changed from tracd to apache2 as web front-end I created a copy of the trac.ini file which was owned by root:www-data and wasn't readable from the user ID used for the backup script. As an result the next backup failed because trac-admin died with the error message below, leaving a partial backup copy behind (not including trac.db).

IMHO, the hotcopy command should catch an couldn't-read-file exception and skip the particular file while producing a non-fatal error message. It is important that so many data/files are backuped as possible.

Traceback (most recent call last):
  File "/usr/bin/trac-admin", line 8, in <module>
    load_entry_point('Trac==0.11.1', 'console_scripts', 'trac-admin')()
  File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/admin/console.py", line 1295, in run
    return admin.onecmd(command)
  File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/admin/console.py", line 123, in onecmd
    rv = cmd.Cmd.onecmd(self, line) or 0
  File "/usr/lib/python2.5/cmd.py", line 219, in onecmd
    return func(arg)
  File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/admin/console.py", line 1185, in do_hotcopy
    copytree(self.__env.path, dest, symlinks=1, skip=skip)
  File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/admin/console.py", line 87, in copytree
    copytree_rec(str_path(src), str_path(dst))
  File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/admin/console.py", line 79, in copytree_rec
    copytree_rec(srcname, dstname)
  File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/admin/console.py", line 86, in copytree_rec
    raise shutil.Error, errors
shutil.Error: [('/home/martin/trac/conf/trac.ini.standalone', '/tmp/tracbackup_FJX7973/trac/conf/trac.ini.standalone', IOError(13, 'Permission denied'))]

Attachments (0)

Change History (4)

comment:1 by Remy Blank, 16 years ago

Milestone: 0.12
Owner: set to Remy Blank

That makes sense. I'm working on trac-admin at the moment, so I'll look at this shortly.

comment:2 by martin@…, 16 years ago

Component: generaladmin/console

comment:3 by Remy Blank, 16 years ago

Milestone: 0.120.11.3
Status: newassigned

Fixed in trunk in [7678]. I'll backport the fix to 0.11.3 once 0.11.2.1 is out.

The fix is mostly the same as how shutil.copytree() is implemented (of which copytree() was most probably an adapted copy already). There's a bug in the 2.5.2 version of shutil.copytree() though (errors.extenderrors.append).

comment:4 by Remy Blank, 16 years ago

Resolution: fixed
Status: assignedclosed

Backported to 0.11-stable in [7693].

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.