Edgewall Software
Modify

Opened 17 years ago

Closed 17 years ago

#5750 closed defect (worksforme)

trac-admin upgrade chokes on unicode in .ini file

Reported by: Dave Abrahams <dave@…> Owned by: Jonas Borgström
Priority: normal Milestone:
Component: general Version: devel
Severity: normal Keywords: needinfo
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

I set the project.name option in trac.ini to something containing LATIN SMALL LETTER U WITH DIAERESIS (ü) and got this upon trac-admin upgrade:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)

It went away when I changed the character to plain u.

My .ini file starts with

# -*- coding: utf-8 -*-

and is saved in utf-8 encoding.

Attachments (0)

Change History (9)

comment:1 by Emmanuel Blot, 17 years ago

Not sure to understand what you were expecting / expect:

trac.ini file should be encoded in utf-8, as documented in the first line of the file.

Can you elaborate?

comment:2 by Emmanuel Blot, 17 years ago

Ok, got it, I tought by "plain u" you were referring to unicode ;-)

comment:3 by Christian Boos, 17 years ago

Keywords: needinfo added

Simply putting an (ü) in the project.name option in trac.ini (encoded as utf-8 of course) works for me.

Since there's normally no need for an upgrade for doing that kind of change, I suspect you're using this setting in an EnvironmentSetupParticipant component? If so, how?

If this is something else, then I think we need to get a backtrace…

in reply to:  3 ; comment:4 by Dave Abrahams <dave@…>, 17 years ago

Replying to cboos:

Simply putting an (ü) in the project.name option in trac.ini (encoded as utf-8 of course) works for me.

Since there's normally no need for an upgrade for doing that kind of change, I suspect you're using this setting in an EnvironmentSetupParticipant component? If so, how?

The TimingAndEstimationPlugin I just installed does some EnvironmentSetupParticipant stuff. You might look at that. I don't know how "doing that kind of change" relates to me; I didn't change project.name; I just did a trac-admin upgrade for other reasons (well, Trac told me to ;-) ). And I don't think TimingAndEstimationPlugin actually uses this setting explicitly. You might look into the new Trac configuration code that only stores the differences from the default.

Also, if you want backtraces from trac-admin it might be a good idea to disable whatever try/except block is suppressing them ;-), because I don't get one.

in reply to:  4 ; comment:5 by Christian Boos, 17 years ago

Replying to Dave Abrahams <dave@boost-consulting.com>:

The TimingAndEstimationPlugin I just installed does some EnvironmentSetupParticipant stuff. You might look at that.

I had a quick look, nothing relevant there (afaict). Puzzling.

You might look into the new Trac configuration code that only stores the differences from the default.

You mean r3744?

Also, if you want backtraces from trac-admin it might be a good idea to disable whatever try/except block is suppressing them ;-), because I don't get one.

Can you please try to reproduce the upgrade failure with:

Index: trac/admin/console.py
===================================================================
--- trac/admin/console.py	(revision 5857)
+++ trac/admin/console.py	(working copy)
@@ -1098,6 +1098,9 @@
                                 "upgrade without doing a backup." % msg)
             else:
                 raise
+        except Exception:
+            traceback.print_exc()
+            raise
         print 'Upgrade done.'
 
     _help_hotcopy = [('hotcopy <backupdir>',

in reply to:  5 ; comment:6 by Dave Abrahams <dave@…>, 17 years ago

Replying to cboos:

Replying to Dave Abrahams <dave@boost-consulting.com>:

The TimingAndEstimationPlugin I just installed does some EnvironmentSetupParticipant stuff. You might look at that.

I had a quick look, nothing relevant there (afaict). Puzzling.

It does try to upgrade the config files. Note that I'm using the 0.11 code.

You might look into the new Trac configuration code that only stores the differences from the default.

You mean r3744?

No, I meant browser:trunk/trac/config.py:r3744#L144

Also, if you want backtraces from trac-admin it might be a good idea to disable whatever try/except block is suppressing them ;-), because I don't get one.

Can you please try to reproduce the upgrade failure

I'm almost 100% sure that won't show anything, since I managed to successfully upgrade after changing that character in project.name… it seems unlikely that it will try to do anything if I try again.

However; I'll confess to having commented out that except block in trac-admin (why do people eat exceptions like that? it just inhibits debugging) when I was trying to debug the problem myself. I'm pretty sure it was on the last line of timingandestimationplugin.api.do_ticket_field_upgrade, which does a .save() on the environment.

comment:8 by sid, 17 years ago

Is this still a problem?

comment:9 by Christian Boos, 17 years ago

Resolution: worksforme
Status: newclosed

Assuming this works now. If not, please reopen (with a summary of theremaining problem).

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jonas Borgström.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jonas Borgström 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.