Bugzilla のバージョンアップができない。。

社内のBugzilla を、バージョン2系から3系にアップグレードしようとしてみています。3系はUTF-8が基本なのですが、これまでのデータがEUC-JPのエンコーディングだったため、変換する必要があるようです。

Bugzilla のセットアップは、checksetup.pl を実行することで設定チェックや更新作業をひととおりやってくれます。最初のセットアップ部分はここでは割愛して、データベースの接続設定などが終わった後、実行すると以下のようなデータベース更新処理のログがコンソールに出ます。

We are about to rename old indexes.
The estimated time to complete renaming is 7 minutes.
You cannot interrupt this action once it has begun.
If you would like to cancel, press Ctrl-C now... (Waiting 45 seconds...)

Renaming indexes...
Renaming index bug_id to attachments_bug_id_idx...
Renaming index creation_ts to attachments_creation_ts_idx...
Renaming index priority to bugs_priority_idx...
Renaming index reporter to bugs_reporter_idx...
Renaming index creation_ts to bugs_creation_ts_idx...
Renaming index assigned_to to bugs_assigned_to_idx...
Renaming index qa_contact to bugs_qa_contact_idx...
Renaming index votes to bugs_votes_idx...
Renaming index bug_severity to bugs_bug_severity_idx...
Renaming index bug_status to bugs_bug_status_idx...
Renaming index delta_ts to bugs_delta_ts_idx...
Renaming index version to bugs_version_idx...
Renaming index component to bugs_component_idx...
Renaming index resolution to bugs_resolution_idx...
Renaming index target_milestone to bugs_target_milestone_idx...
Renaming index product to bugs_product_idx...
Renaming index op_sys to bugs_op_sys_idx...
Renaming index bug_id to bugs_activity_bug_id_idx...
Renaming index bug_when to bugs_activity_bug_when_idx...
Renaming index fieldid to bugs_activity_fieldid_idx...
Renaming index bug_id to cc_bug_id_idx...
Renaming index who to cc_who_idx...
Renaming index blocked to dependencies_blocked_idx...
Renaming index dependson to dependencies_dependson_idx...
Renaming index sortkey to fielddefs_sortkey_idx...
Renaming index name to fielddefs_name_idx...
Renaming index bit to groups_bit_idx...
Renaming index name to groups_name_idx...
Renaming index name to keyworddefs_name_idx...
Renaming index keywordid to keywords_keywordid_idx...
Renaming index bug_id to keywords_bug_id_idx...
Renaming index lastused to logincookies_lastused_idx...
Renaming index bug_id to longdescs_bug_id_idx...
Renaming index bug_when to longdescs_bug_when_idx...
Renaming index who to longdescs_who_idx...
Renaming index product to milestones_product_idx...
Renaming index userid to namedqueries_userid_idx...
Renaming index watchfordiffs to namedqueries_watchfordiffs_idx...
Renaming index login_name to profiles_login_name_idx...
Renaming index userid to profiles_activity_userid_idx...
Renaming index profiles_when to profiles_activity_profiles_when_idx...
Renaming index fieldid to profiles_activity_fieldid_idx...
Renaming index reflected to shadowlog_reflected_idx...
Renaming index userid to tokens_userid_idx...
Renaming index bug_id to votes_bug_id_idx...
Renaming index who to votes_who_idx...
Renaming index watcher to watch_watcher_idx...
Renaming index watched to watch_watched_idx...
Building Schema object from database...
Adding new table bz_schema ...
Initializing the new Schema storage...
Adding new table attach_data ...
Adding new table bug_group_map ...
Adding new table bug_severity ...
Adding new table bug_status ...
Adding new table category_group_map ...
Adding new table classifications ...
Adding new table component_cc ...
Adding new table email_setting ...
Adding new table flagexclusions ...
Adding new table flaginclusions ...
Adding new table flags ...
Adding new table flagtypes ...
Adding new table group_control_map ...
Adding new table group_group_map ...
Adding new table namedqueries_link_in_footer ...
Adding new table namedquery_group_map ...
Adding new table op_sys ...
Adding new table priority ...
Adding new table profile_setting ...
Adding new table quips ...
Adding new table rep_platform ...
Adding new table resolution ...
Adding new table series ...
Adding new table series_categories ...
Adding new table series_data ...
Adding new table setting ...
Adding new table setting_value ...
Adding new table user_group_map ...
Adding new table whine_events ...
Adding new table whine_queries ...
Adding new table whine_schedules ...
Fixing creation time on attachments...
Warning - could not determine correct creation time for attachment 62 on bug 9117
Done - converted 214 attachments
Updating column creation_ts in table attachments ...
Old: TIMESTAMP DEFAULT 'CURRENT_TIMESTAMP'
New: datetime NOT NULL
Updating column lastused in table logincookies ...
Old: TIMESTAMP DEFAULT 'CURRENT_TIMESTAMP'
New: datetime NOT NULL
Updating column delta_ts in table bugs ...
Old: TIMESTAMP DEFAULT 'CURRENT_TIMESTAMP'
New: datetime NOT NULL
Converting attach_data maximum size to 100G...

WARNING: We are about to convert your table storage format to UTF8. This
         allows Bugzilla to correctly store and sort international characters.
         However, if you have any non-UTF-8 data in your database,
         it ***WILL BE DELETED*** by this process. So, before
         you continue with checksetup.pl, if you have any non-UTF-8
         data (or even if you're not sure) you should press Ctrl-C now
         to interrupt checksetup.pl, and run contrib/recode.pl to make all 
         the data in your database into UTF-8. You should also back up your
         database before continuing. This will affect every single table
         in the database, even non-Bugzilla tables.

         If you ever used a version of Bugzilla before 2.22, we STRONGLY
         recommend that you stop checksetup.pl NOW and run contrib/recode.pl.

         Press Enter to continue or Ctrl-C to exit...

ここで、データベースがちゃんとしていないまま、リターンキーを押すと、以下のようなメッセージが出てコケます。

Converting components.name to be stored as UTF-8...
DBD::mysql::db do failed: Duplicate entry '9-' for key 2 at Bugzilla/DB/Mysql.pm line 638

なので、リターンキーを押す代わりに、いったん Ctrl-C で終了し、上のメッセージにしたがって、 contrib/recode.pl を実行します。

./contrib/recode.pl --guess --charset=euc-jp --show-failures

そして、checksetup.pl を再実行。今度は、さっき中断したとこでReturn押して続行。すると、以下のような出力が続きますが。。。

Converting table storage format to UTF-8. This may take a while.
Converting attachments.description to be stored as UTF-8...
Converting attachments.mimetype to be stored as UTF-8...
Converting attachments.filename to be stored as UTF-8...
Converting attachstatusdefs.name to be stored as UTF-8...
Converting attachstatusdefs.description to be stored as UTF-8...
Converting attachstatusdefs.product to be stored as UTF-8...
Converting bug_severity.value to be stored as UTF-8...
Converting bug_status.value to be stored as UTF-8...
Converting bugs.bug_file_loc to be stored as UTF-8...
Converting bugs.short_desc to be stored as UTF-8...
Converting bugs.product to be stored as UTF-8...
Converting bugs.version to be stored as UTF-8...
Converting bugs.component to be stored as UTF-8...
Converting bugs.target_milestone to be stored as UTF-8...
Converting bugs.status_whiteboard to be stored as UTF-8...
Converting bugs.keywords to be stored as UTF-8...
Converting bugs_activity.added to be stored as UTF-8...
Converting bugs_activity.removed to be stored as UTF-8...
Converting classifications.name to be stored as UTF-8...
Converting classifications.description to be stored as UTF-8...
Converting components.value to be stored as UTF-8...
Converting components.program to be stored as UTF-8...
Converting components.description to be stored as UTF-8...
Converting fielddefs.name to be stored as UTF-8...
Converting fielddefs.description to be stored as UTF-8...
Converting flags.status to be stored as UTF-8...
Converting flagtypes.name to be stored as UTF-8...
Converting flagtypes.description to be stored as UTF-8...
Converting flagtypes.cc_list to be stored as UTF-8...
Converting flagtypes.target_type to be stored as UTF-8...
Converting groups.name to be stored as UTF-8...
Converting groups.description to be stored as UTF-8...
Converting groups.userregexp to be stored as UTF-8...
Converting keyworddefs.name to be stored as UTF-8...
Converting keyworddefs.description to be stored as UTF-8...
Converting logincookies.ipaddr to be stored as UTF-8...
Converting longdescs.thetext to be stored as UTF-8...
Converting milestones.value to be stored as UTF-8...
Converting milestones.product to be stored as UTF-8...
Converting namedqueries.name to be stored as UTF-8...
Converting namedqueries.query to be stored as UTF-8...
Converting op_sys.value to be stored as UTF-8...
Converting priority.value to be stored as UTF-8...
Converting products.product to be stored as UTF-8...
Converting products.description to be stored as UTF-8...
Converting products.milestoneurl to be stored as UTF-8...
Converting products.defaultmilestone to be stored as UTF-8...
Converting profile_setting.setting_name to be stored as UTF-8...
Converting profile_setting.setting_value to be stored as UTF-8...
Converting profiles.login_name to be stored as UTF-8...
Converting profiles.cryptpassword to be stored as UTF-8...
Converting profiles.realname to be stored as UTF-8...
Converting profiles.disabledtext to be stored as UTF-8...
Converting profiles.emailflags to be stored as UTF-8...
Converting profiles_activity.oldvalue to be stored as UTF-8...
Converting profiles_activity.newvalue to be stored as UTF-8...
Converting quips.quip to be stored as UTF-8...
Converting rep_platform.value to be stored as UTF-8...
Converting resolution.value to be stored as UTF-8...
Converting series.name to be stored as UTF-8...
Converting series.query to be stored as UTF-8...
Converting series_categories.name to be stored as UTF-8...
Converting setting.name to be stored as UTF-8...
Converting setting.default_value to be stored as UTF-8...
Converting setting.subclass to be stored as UTF-8...
Converting setting_value.name to be stored as UTF-8...
Converting setting_value.value to be stored as UTF-8...
Converting shadowlog.command to be stored as UTF-8...
Converting tokens.token to be stored as UTF-8...
Converting tokens.tokentype to be stored as UTF-8...
Converting tokens.eventdata to be stored as UTF-8...
Converting versions.value to be stored as UTF-8...
Converting versions.program to be stored as UTF-8...
Converting whine_events.subject to be stored as UTF-8...
Converting whine_events.body to be stored as UTF-8...
Converting whine_queries.query_name to be stored as UTF-8...
Converting whine_queries.title to be stored as UTF-8...
Converting whine_schedules.run_day to be stored as UTF-8...
Converting whine_schedules.run_time to be stored as UTF-8...
Inserting values into the 'priority' table:
'P1' sortkey: 100
'P2' sortkey: 200
'P3' sortkey: 300
'P4' sortkey: 400
'P5' sortkey: 500
Inserting values into the 'bug_status' table:
'UNCONFIRMED' sortkey: 100
'NEW'         sortkey: 200
'ASSIGNED'    sortkey: 300
'REOPENED'    sortkey: 400
'RESOLVED'    sortkey: 500
'VERIFIED'    sortkey: 600
'CLOSED'      sortkey: 700
Inserting values into the 'rep_platform' table:
'All'       sortkey: 100
'DEC'       sortkey: 200
'HP'        sortkey: 300
'Macintosh' sortkey: 400
'PC'        sortkey: 500
'SGI'       sortkey: 600
'Sun'       sortkey: 700
'Other'     sortkey: 800
Inserting values into the 'resolution' table:
''           sortkey: 100
'FIXED'      sortkey: 200
'INVALID'    sortkey: 300
'WONTFIX'    sortkey: 400
'LATER'      sortkey: 500
'REMIND'     sortkey: 600
'DUPLICATE'  sortkey: 700
'WORKSFORME' sortkey: 800
'MOVED'      sortkey: 900
Inserting values into the 'bug_severity' table:
'blocker'     sortkey: 100
'critical'    sortkey: 200
'major'       sortkey: 300
'normal'      sortkey: 400
'minor'       sortkey: 500
'trivial'     sortkey: 600
'enhancement' sortkey: 700
Inserting values into the 'op_sys' table:
'All'              sortkey: 100
'Windows 3.1'      sortkey: 200
'Windows 95'       sortkey: 300
'Windows 98'       sortkey: 400
'Windows ME'       sortkey: 500
'Windows 2000'     sortkey: 600
'Windows NT'       sortkey: 700
'Windows XP'       sortkey: 800
'Mac System 7'     sortkey: 900
'Mac System 7.5'   sortkey: 1000
'Mac System 7.6.1' sortkey: 1100
'Mac System 8.0'   sortkey: 1200
'Mac System 8.5'   sortkey: 1300
'Mac System 8.6'   sortkey: 1400
'Mac System 9.x'   sortkey: 1500
'MacOS X'          sortkey: 1600
'Linux'            sortkey: 1700
'BSDI'             sortkey: 1800
'FreeBSD'          sortkey: 1900
'NetBSD'           sortkey: 2000
'OpenBSD'          sortkey: 2100
'AIX'              sortkey: 2200
'BeOS'             sortkey: 2300
'HP-UX'            sortkey: 2400
'IRIX'             sortkey: 2500
'Neutrino'         sortkey: 2600
'OpenVMS'          sortkey: 2700
'OS/2'             sortkey: 2800
'OSF/1'            sortkey: 2900
'Solaris'          sortkey: 3000
'SunOS'            sortkey: 3100
'other'            sortkey: 3200
Removing existing compiled templates ...
Precompiling templates...
Fixing file permissions...
Adding new column 'obsolete' to the 'fielddefs' table...
Marking qacontact_accessible and assignee_accessible as obsolete fields...
Adding new column 'type' to the 'fielddefs' table...
Adding new column 'custom' to the 'fielddefs' table...
Adding new column 'enter_bug' to the 'fielddefs' table...
Renaming column 'fielddefs.fieldid' to 'fielddefs.id'...
SQL fragment found in the 'fielddefs' table...
Old field name: (to_days(now()) - to_days(bugs.delta_ts))
Fixing the 'fielddefs' table...
New field name: days_elapsed
Updating column product in table bugs ...
Old: varchar(64) DEFAULT '' NOT NULL
New: varchar(64) NOT NULL
Updating column program in table versions ...
Old: varchar(64) DEFAULT '' NOT NULL
New: varchar(64) NOT NULL
Updating column cryptpassword in table profiles ...
Old: varchar(34)
New: varchar(128)
Adding new column 'work_time' to the 'longdescs' table...
Adding new column 'estimated_time' to the 'bugs' table...
Adding new column 'remaining_time' to the 'bugs' table...
Adding new column 'deadline' to the 'bugs' table...
Adding new column 'isprivate' to the 'longdescs' table...
Adding new column 'isprivate' to the 'attachments' table...
Adding new column 'alias' to the 'bugs' table...
Adding new index 'bugs_alias_idx' to the bugs table ...
Deleting the 'watchfordiffs' column from the 'namedqueries' table...
Updating database to use product IDs.
Adding new column 'id' to the 'products' table...
Adding new column 'product_id' to the 'components' table...
Adding new column 'product_id' to the 'versions' table...
Adding new column 'product_id' to the 'milestones' table...
Adding new column 'product_id' to the 'bugs' table...
Adding new column 'product_id' to the 'attachstatusdefs' table...
Updating the database to use component IDs.
Adding new column 'id' to the 'components' table...
Adding new column 'component_id' to the 'bugs' table...
Fixing Indexes and Uniqueness.
Removing index 'milestones_product_idx' from the milestones table...
Adding new index 'milestones_product_id_idx' to the milestones table ...
Removing index 'bugs_product_idx' from the bugs table...
Adding new index 'bugs_product_id_idx' to the bugs table ...
Removing index 'bugs_component_idx' from the bugs table...
Adding new index 'bugs_component_id_idx' to the bugs table ...
Removing, renaming, and retyping old product and component fields.
Deleting the 'program' column from the 'components' table...
Deleting the 'program' column from the 'versions' table...
Deleting the 'product' column from the 'milestones' table...
Deleting the 'product' column from the 'bugs' table...
Deleting the 'component' column from the 'bugs' table...
Deleting the 'product' column from the 'attachstatusdefs' table...
Renaming column 'products.product' to 'products.name'...
Updating column name in table products ...
Old: varchar(64)
New: varchar(64) NOT NULL
Renaming column 'components.value' to 'components.name'...
Updating column name in table components ...
Old: tinytext
New: varchar(64) NOT NULL
Adding indexes for products and components tables.
Adding new index 'products_name_idx' to the products table ...
Adding new index 'components_product_id_idx' to the components table ...
Adding new index 'components_name_idx' to the components table ...
Removing index 'groups_bit_idx' from the groups table...
Removing index 'groups_name_idx' from the groups table...
Adding new column 'id' to the 'groups' table...
Adding new index 'groups_name_idx' to the groups table ...
Deleting the 'groupset' column from the 'profiles' table...
Deleting the 'blessgroupset' column from the 'profiles' table...
Deleting the 'groupset' column from the 'bugs' table...
Deleting the 'bit' column from the 'groups' table...
Converting attachment statuses to flags...
Dropping the 'attachstatuses' table...
Dropping the 'attachstatusdefs' table...
done.
Adding new column 'extern_id' to the 'profiles' table...
Adding new column 'already_wrapped' to the 'longdescs' table...
Fixing old, mis-wrapped comments...
Updating column bug_status in table bugs ...
Old: ENUM DEFAULT 'UNCONFIRMED' NOT NULL
New: varchar(64) NOT NULL
Updating column resolution in table bugs ...
Old: ENUM DEFAULT '' NOT NULL
New: varchar(64) DEFAULT '' NOT NULL
Updating column priority in table bugs ...
Old: ENUM DEFAULT 'P1' NOT NULL
New: varchar(64) NOT NULL
Updating column bug_severity in table bugs ...
Old: ENUM DEFAULT 'blocker' NOT NULL
New: varchar(64) NOT NULL
Updating column rep_platform in table bugs ...
Old: ENUM
New: varchar(64) NOT NULL
Updating column op_sys in table bugs ...
Old: ENUM DEFAULT 'All' NOT NULL
New: varchar(64) NOT NULL
Adding new index 'longdescs_thetext_idx' to the longdescs table ...
Removing paths from filenames in attachments table...
Done.
Resizing attachments.filename from mediumtext to varchar(100).
Updating column filename in table attachments ...
Old: mediumtext NOT NULL
New: varchar(100) NOT NULL
Dropping the 'shadowlog' table...
Renaming column 'votes.count' to 'votes.vote_count'...
Updating column short_desc in table bugs ...
Old: mediumtext
New: mediumtext NOT NULL
Adding new column 'classification_id' to the 'products' table...
Adding new index 'bugs_activity_who_idx' to the bugs_activity table ...
Updating column lastdiffed in table bugs ...
Old: datetime NOT NULL
New: datetime
Updating column qa_contact in table bugs ...
Old: mediumint NOT NULL
New: mediumint
Updating column initialqacontact in table components ...
Old: mediumint NOT NULL
New: mediumint
Migrating email preferences to new table...
......
Deleting the 'emailflags' column from the 'profiles' table...
Initializing "Dependency Tree Changes" email_setting ...
Updating column value in table versions ...
Old: tinytext
New: varchar(64) NOT NULL
Fixing duplicate version Ãþ¸Â訢-0 in product_id 3...
Fixing duplicate version æ¬çªå¾ in product_id 5...
Fixing duplicate version å®å® in product_id 6...
Fixing duplicate version 社åGateway in product_id 11...
Fixing duplicate version ä¼ç»å¡¾ãã¼ã¸ã§ã³ in product_id 13...
Fixing duplicate version å®å®å± in product_id 21...
Fixing duplicate version ã»ã³ãã©ã«ç­è³ãªã³ã©ã¤ã³ãã¬ã¼ã in product_id 22...
Fixing duplicate version è訢件å®ç¾© in product_id 23...
Adding new index 'versions_product_id_idx' to the versions table ...
Updating column creation_ts in table bugs ...
Old: datetime NOT NULL
New: datetime
Adding new index 'attachments_submitter_id_idx' to the attachments table ...
Migrating attachment data to its own table...
(This may take a very long time)
Deleting the 'thedata' column from the 'attachments' table...
Adding new column 'isurl' to the 'attachments' table...
Adding new column 'query_type' to the 'namedqueries' table...
Updating column cookie in table logincookies ...
Old: mediumint auto_increment NOT NULL PRIMARY KEY
New: varchar(16) NOT NULL PRIMARY KEY
Cleaning control characters from bug summaries... 3700... 4984... 4985... 4986... 4987... 5055... 12539... 12543... 12545... 12550... done.
Adding new column 'comment_id' to the 'longdescs' table...

WARNING: Some of your bugs had summaries longer than 255 characters.
They have had their original summary copied into a comment, and then
the summary was truncated to 255 characters. The affected bug numbers were:
1051, 1204, 1209, 2145, 2648, 3262, 3756, 3771, 3777, 4102, 4137, 4487, 4508, 4517, 5109, 5151, 5159, 5160, 5161, 5179, 5338, 5393, 5395, 5457, 5585, 5601, 5621, 5622, 5735, 5777, 5809, 5826, 5887, 5923, 6234, 6322, 6448, 6522, 6558, 6744, 6797, 7326, 7394, 7449, 7519, 7941, 8000, 8092, 8268, 8335, 8651, 8703, 9000, 9200, 11133, 11986, 12185, 12172, 12133, 12059, 12330, 12382, 12587, 12612, 12699, 12719

Updating column short_desc in table bugs ...
Old: mediumtext NOT NULL
New: varchar(255) NOT NULL
Adding new column 'id' to the 'namedqueries' table...
Deleting the 'linkinfooter' column from the 'namedqueries' table...
Adding new column 'disable_mail' to the 'profiles' table...
Updating column disallownew in table products ...
Old: tinyint DEFAULT 0 NOT NULL
New: tinyint DEFAULT 0 NOT NULL
Updating column id in table keyworddefs ...
Old: smallint NOT NULL PRIMARY KEY
New: smallint auto_increment NOT NULL PRIMARY KEY
Updating column userid in table tokens ...
Old: mediumint NOT NULL
New: mediumint
Updating column realname in table profiles ...
Old: varchar(255)
New: varchar(255) DEFAULT '' NOT NULL
Removing index 'longdescs_who_idx' from the longdescs table...
Adding new index 'longdescs_who_idx' to the longdescs table ...
Updating column thetext in table longdescs ...
Old: mediumtext
New: mediumtext NOT NULL
Adding new column 'type' to the 'longdescs' table...
Adding new column 'extra_data' to the 'longdescs' table...
Adding new column 'id' to the 'versions' table...
Adding new column 'id' to the 'milestones' table...
Adding new column 'mailchar' to the 'profiles' table...
Creating group editclassifications...
Creating group bz_canusewhines...
Creating group bz_sudoers...
Creating group bz_canusewhineatothers...
Creating group bz_sudo_protect...
Adding a new user setting called 'skin'
Adding a new user setting called 'quote_replies'
Adding a new user setting called 'lang'
Adding a new user setting called 'post_bug_submit_action'
Adding a new user setting called 'per_bug_queries'
Adding a new user setting called 'bug_comment_pos'
Adding a new user setting called 'zoom_textareas'
Adding a new user setting called 'csv_colsepchar'
Adding a new user setting called 'state_addselfcc'
Adding a new user setting called 'comment_sort_order'
Adding a new user setting called 'display_quips'
Creating default classification 'Unclassified'...

・・・終わってみたら、なぜか文字化けしています。。recode.pl を実行した直後にデータベースをのぞくと、ちゃんとUTF-8になっているようなのに、なぜ。。。

社内の MySQL 本体や、CPANモジュールをインフラチームにアップデートしてもらったりして、もう一歩なのに、なかなかどうして遠い Bugzilla バージョンアップへの道。