Migrating attachment files

165 views
Skip to first unread message

Emmanuel Blot

unread,
Jul 16, 2012, 5:27:41 AM7/16/12
to trac-...@googlegroups.com
Hi,

I'm trying to upgrade a Trac test server to the latest version from
the trunk, and I got the following error:

Trac [/Users/eblot/Trac/sdk]> upgrade

11:20:54 Trac[env] WARNING: Component <trac.attachment.AttachmentSetup
object at 0x102430a90> requires environment upgrade

Traceback (most recent call last):
File "trac/admin/console.py", line 107, in onecmd
rv = cmd.Cmd.onecmd(self, line) or 0
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/cmd.py",
line 218, in onecmd
return self.default(line)
File "trac/admin/console.py", line 275, in default
return cmd_mgr.execute_command(*args)
File "/Users/eblot/Sources/Git/neotion.int/trac/trac/admin/api.py",
line 123, in execute_command
return f(*fargs)
File "/Users/eblot/Sources/Git/neotion.int/trac/trac/env.py", line
952, in _do_upgrade
self.env.upgrade(backup=no_backup is None)
File "/Users/eblot/Sources/Git/neotion.int/trac/trac/env.py", line
683, in upgrade
participant.upgrade_environment(db)
File "/Users/eblot/Sources/Git/neotion.int/trac/trac/attachment.py",
line 461, in upgrade_environment
os.rmdir(dir)
OSError: [Errno 66] Directory not empty:
'/Users/eblot/Trac/sdk/attachments/wiki/SandBox'

Surely, the directory contains an PNG file, with R/W permissions for
the current user running the upgrade.

Any idea on how to solve this issue?

Cheers,
Manu

Remy Blank

unread,
Jul 16, 2012, 1:48:50 PM7/16/12
to trac-...@googlegroups.com
Emmanuel Blot wrote:
> OSError: [Errno 66] Directory not empty:
> '/Users/eblot/Trac/sdk/attachments/wiki/SandBox'
>
> Surely, the directory contains an PNG file, with R/W permissions for
> the current user running the upgrade.
>
> Any idea on how to solve this issue?

This file is not referenced in the attachment table, and is therefore
not migrated to the new directory structure. It's up to you to decide
what you want to do about it, but you'll have to remove it from the
attachments/ directory before Trac will continue.

We should probably better document this before 1.0, and possibly also
improve the error message. That is, instead of showing an ugly traceback
and only the first file that makes the upgrade fail, we could collect
the paths of all the stale files, show them all to the admin and explain
what they are about and what she's expected to do.

We could also simply migrate the stale files to the new directory
structure, and re-insert them in the attachment table, but this might be
unexpected. Or rename the attachments/ folder to stale-attachments/
after the migration (only if it can't be deleted).

Anything, really, would be better than the traceback, I guess. I like
the last option, with a clear notice after the upgrade. Thoughts?

-- Remy

signature.asc

Emmanuel Blot

unread,
Jul 16, 2012, 2:28:05 PM7/16/12
to trac-...@googlegroups.com
Hi Remi,

> This file is not referenced in the attachment table, and is therefore
> not migrated to the new directory structure. It's up to you to decide
> what you want to do about it, but you'll have to remove it from the
> attachments/ directory before Trac will continue.

Ok, this is what I did (moved the file away) as I did not know whether
the actual error was, and I suspected it was not referenced within the DB.

> We should probably better document this before 1.0

Definitely :P

> Anything, really, would be better than the traceback, I guess. I like
> the last option, with a clear notice after the upgrade. Thoughts?

At least, there should be an error message with something like
"file <> exists in <attachment> directory and is not referenced as a
valid attachment.
Please remove it and resume upgrade"

BTW, this is slightly off-topic, but while migrating, I noticed the
following issues.
I'm not sure whether there are specific to my installation or more generic
(I have not read the new documentation yet, if there is one, me bad):

* SVN is now a tracopt, but Trac upgrade did not automatically update
the trac.ini file
so that existing SVN repository can be accessed without an error,
as the tracopt
component is not enabled
* Trac component names in the web admin panel slightly overwrite
their description.
It looks weird on both Safari and Firefox on my machine
* I read #10712, but is not that "weird" that a feature that really
look optional is part
of the Trac core rather than the Trac optional package? #10712's
rationale for keeping
SVN authz file is that it does not depend on Subversion, which is
very true. On the
other hand, a very optional feature (parsing authz file) is left in
Trac core. Sounds
weird to me: isn't it unlikely to use a SVN config file without
using SVN at all?

Cheers,
Manu
Reply all
Reply to author
Forward
0 new messages