Defect #1050

migrate_to_trac fails with: "''" is not a valid constant name!

Added by paul k over 12 years ago. Updated over 12 years ago.

Status:ClosedStart date:2008-04-12
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:Importers
Target version:-
Resolution:Invalid Affected version:

Description

rails 1.2.5, ruby 1.8 (OTOH), redmine svn.
I'm no ruby expert, so here is the traceback:

Migrating components......
Migrating milestones...
Migrating custom fields...
Migrating tickets.rake aborted!
"''" is not a valid constant name!
/var/lib/gems/1.8/gems/activesupport-1.4.4/lib/active_support/inflector.rb:247:in `constantize'
/var/lib/gems/1.8/gems/activesupport-1.4.4/lib/active_support/core_ext/string/inflections.rb:148:in `constantize'
/var/lib/gems/1.8/gems/activerecord-1.15.5/lib/active_record/associations/belongs_to_polymorphic_association.rb:46:in `association_class'
/var/lib/gems/1.8/gems/activerecord-1.15.5/lib/active_record/associations/belongs_to_polymorphic_association.rb:28:in `find_target'
/var/lib/gems/1.8/gems/activerecord-1.15.5/lib/active_record/associations/association_proxy.rb:131:in `load_target'
/var/lib/gems/1.8/gems/activerecord-1.15.5/lib/active_record/associations/association_proxy.rb:55:in `reload'
/var/lib/gems/1.8/gems/activerecord-1.15.5/lib/active_record/associations.rb:906:in `customized'
/home/kopernikus/redmine/app/models/custom_value.rb:23:in `after_initialize'
/var/lib/gems/1.8/gems/activerecord-1.15.5/lib/active_record/callbacks.rb:348:in `send'
/var/lib/gems/1.8/gems/activerecord-1.15.5/lib/active_record/callbacks.rb:348:in `callback'
/var/lib/gems/1.8/gems/activerecord-1.15.5/lib/active_record/callbacks.rb:227:in `initialize'
/home/kopernikus/redmine/config/../lib/tasks/migrate_from_trac.rake:375:in `new'
/home/kopernikus/redmine/config/../lib/tasks/migrate_from_trac.rake:375:in `migrate'
/home/kopernikus/redmine/config/../lib/tasks/migrate_from_trac.rake:362:in `each'
/home/kopernikus/redmine/config/../lib/tasks/migrate_from_trac.rake:362:in `migrate'
/home/kopernikus/redmine/config/../lib/tasks/migrate_from_trac.rake:655
/usr/lib/ruby/1.8/rake.rb:387:in `call'
/usr/lib/ruby/1.8/rake.rb:387:in `execute'
/usr/lib/ruby/1.8/rake.rb:387:in `each'
/usr/lib/ruby/1.8/rake.rb:387:in `execute'
/usr/lib/ruby/1.8/rake.rb:357:in `invoke'
/usr/lib/ruby/1.8/thread.rb:135:in `synchronize'
/usr/lib/ruby/1.8/rake.rb:350:in `invoke'
/usr/lib/ruby/1.8/rake.rb:1906:in `run'
/usr/lib/ruby/1.8/rake.rb:1906:in `each'
/usr/lib/ruby/1.8/rake.rb:1906:in `run'
/usr/bin/rake:4

thanks,
k

History

#1 Updated by paul k over 12 years ago

sorry, forgot to set category to "importers".

#2 Updated by Jean-Philippe Lang over 12 years ago

It looks like you're not using the latest HEAD revision of the script (or a modified one).
Which exact Redmine revision are you using ?

#3 Updated by paul k over 12 years ago

Hi Jean-Philippe,

thanks for looking into this. I just updated to svn ref 1350, however the error is still there.

thanks,
k

#4 Updated by Jean-Philippe Lang over 12 years ago

Could you post the stack trace you get with r1350 please ?

#5 Updated by paul k over 12 years ago

ok, something fishy is going on here. In order to login in the first place I had to uncomment line 265 in user.rb, otherwise the login controller throws:

RuntimeError (Unable to create the anonymous user.):
/home/kopernikus/redmine/app/models/user.rb:265:in `anonymous'
/home/kopernikus/redmine/app/models/user.rb:257:in `current'
/home/kopernikus/redmine/app/controllers/application.rb:62:in `set_localization'
/var/lib/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/filters.rb:469:in `send'
/var/lib/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/filters.rb:469:in `call'
/var/lib/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/filters.rb:442:in `run'
/var/lib/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/filters.rb:714:in `run_before_filters'
/var/lib/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/filters.rb:694:in `call_filters'
/var/lib/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/filters.rb:688:in `perform_action_without_benchmark'
/var/lib/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/benchmarking.rb:66:in `perform_action_without_rescue'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/var/lib/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/benchmarking.rb:66:in `perform_action_without_rescue'
/var/lib/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/rescue.rb:83:in `perform_action'
/var/lib/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/base.rb:435:in `send'
/var/lib/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/base.rb:435:in `process_without_filters'
/var/lib/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/filters.rb:684:in `process_without_session_management_support'
/var/lib/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/session_management.rb:114:in `process'
/var/lib/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/base.rb:334:in `process'
/var/lib/gems/1.8/gems/rails-1.2.5/lib/dispatcher.rb:41:in `dispatch'
/var/lib/gems/1.8/gems/mongrel-1.0.4/bin/../lib/mongrel/rails.rb:76:in `process'
/usr/lib/ruby/1.8/thread.rb:135:in `synchronize'
/var/lib/gems/1.8/gems/mongrel-1.0.4/bin/../lib/mongrel/rails.rb:74:in `process'
/var/lib/gems/1.8/gems/mongrel-1.0.4/lib/mongrel.rb:626:in `process_client'
/var/lib/gems/1.8/gems/mongrel-1.0.4/lib/mongrel.rb:625:in `each'
/var/lib/gems/1.8/gems/mongrel-1.0.4/lib/mongrel.rb:625:in `process_client'
/var/lib/gems/1.8/gems/mongrel-1.0.4/lib/mongrel.rb:751:in `run'
/var/lib/gems/1.8/gems/mongrel-1.0.4/lib/mongrel.rb:751:in `initialize'
/var/lib/gems/1.8/gems/mongrel-1.0.4/lib/mongrel.rb:751:in `new'
/var/lib/gems/1.8/gems/mongrel-1.0.4/lib/mongrel.rb:751:in `run'
/var/lib/gems/1.8/gems/mongrel-1.0.4/lib/mongrel.rb:735:in `initialize'
/var/lib/gems/1.8/gems/mongrel-1.0.4/lib/mongrel.rb:735:in `new'
/var/lib/gems/1.8/gems/mongrel-1.0.4/lib/mongrel.rb:735:in `run'
/var/lib/gems/1.8/gems/mongrel-1.0.4/lib/mongrel/configurator.rb:282:in `run'
/var/lib/gems/1.8/gems/mongrel-1.0.4/lib/mongrel/configurator.rb:281:in `each'
/var/lib/gems/1.8/gems/mongrel-1.0.4/lib/mongrel/configurator.rb:281:in `run'
/var/lib/gems/1.8/gems/mongrel-1.0.4/bin/mongrel_rails:126:in `run'
/var/lib/gems/1.8/gems/mongrel-1.0.4/lib/mongrel/command.rb:211:in `run'
/var/lib/gems/1.8/gems/mongrel-1.0.4/bin/mongrel_rails:279
/var/lib/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:488:in `load'
/var/lib/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:488:in `load'
/var/lib/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:342:in `new_constants_in'
/var/lib/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:488:in `load'
/var/lib/gems/1.8/gems/rails-1.2.5/lib/commands/servers/mongrel.rb:60
/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
/var/lib/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:495:in `require'
/var/lib/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:342:in `new_constants_in'
/var/lib/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:495:in `require'
/var/lib/gems/1.8/gems/rails-1.2.5/lib/commands/server.rb:39
/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
script/server:3

since everything seemed to work fine after commenting line 265, I forgot about it until I tried to import the trac project. Maybe this is the root cause and should be dealt with first. Otherwise the stack trace with r1350 is exactly the same as above.

thanks
k

#6 Updated by Jean-Philippe Lang over 12 years ago

since everything seemed to work fine after commenting line 265

It won't work fine after commenting line 265. Can you post the content of your users table please.

Otherwise the stack trace with r1350 is exactly the same as above.

The following can not happen with r1350:

/home/kopernikus/redmine/config/../lib/tasks/migrate_from_trac.rake:375:in `new'

Did you make any change to migrate_from_trac.rake ?

#7 Updated by paul k over 12 years ago

since everything seemed to work fine after commenting line 265

It won't work fine after commenting line 265. Can you post the content of your users table please.
new install, db:migrate, redmine:load_default_data:

sqlite> select * from users;
1|admin|d033e22ae348aeb5660fc2140aec35850c4da997|Redmine|Admin||f|t|1||en|0|2008-04-06 22:52:48|2008-04-06 22:52:48|User
sqlite>

Otherwise the stack trace with r1350 is exactly the same as above.

The following can not happen with r1350:
/home/kopernikus/redmine/config/../lib/tasks/migrate_from_trac.rake:375:in `new'
Did you make any change to migrate_from_trac.rake ?

I did insert some print statements, so line numbers could be off. Here is the new traceback:

kopernikus@san:~/redmine$ rake --trace redmine:migrate_from_trac RAILS_ENV="production"
(in /home/kopernikus/redmine)
  • Invoke redmine:migrate_from_trac (first_time)
  • Invoke environment (first_time)
  • Execute environment
  • Execute redmine:migrate_from_trac

WARNING: a new project will be added to Redmine during this process.
Are you sure you want to continue ? [y/N] y

Trac directory []: /home/kopernikus/trac_intern
Trac database adapter (sqlite, sqlite3, mysql, postgresql) [sqlite]: sqlite3
Trac database encoding [UTF-8]:
Target project identifier []: personal

Migrating components......
Migrating milestones...
Migrating custom fields...
Migrating tickets.rake aborted!
"''" is not a valid constant name!
/var/lib/gems/1.8/gems/activesupport-1.4.4/lib/active_support/inflector.rb:247:in `constantize'
/var/lib/gems/1.8/gems/activesupport-1.4.4/lib/active_support/core_ext/string/inflections.rb:148:in `constantize'
/var/lib/gems/1.8/gems/activerecord-1.15.5/lib/active_record/associations/belongs_to_polymorphic_association.rb:46:in `association_class'
/var/lib/gems/1.8/gems/activerecord-1.15.5/lib/active_record/associations/belongs_to_polymorphic_association.rb:28:in `find_target'
/var/lib/gems/1.8/gems/activerecord-1.15.5/lib/active_record/associations/association_proxy.rb:131:in `load_target'
/var/lib/gems/1.8/gems/activerecord-1.15.5/lib/active_record/associations/association_proxy.rb:55:in `reload'
/var/lib/gems/1.8/gems/activerecord-1.15.5/lib/active_record/associations.rb:906:in `customized'
/home/kopernikus/redmine/app/models/custom_value.rb:23:in `after_initialize'
/var/lib/gems/1.8/gems/activerecord-1.15.5/lib/active_record/callbacks.rb:348:in `send'
/var/lib/gems/1.8/gems/activerecord-1.15.5/lib/active_record/callbacks.rb:348:in `callback'
/var/lib/gems/1.8/gems/activerecord-1.15.5/lib/active_record/callbacks.rb:227:in `initialize'
/home/kopernikus/redmine/config/../lib/tasks/migrate_from_trac.rake:364:in `new'
/home/kopernikus/redmine/config/../lib/tasks/migrate_from_trac.rake:364:in `migrate'
/home/kopernikus/redmine/config/../lib/tasks/migrate_from_trac.rake:351:in `each'
/home/kopernikus/redmine/config/../lib/tasks/migrate_from_trac.rake:351:in `migrate'
/home/kopernikus/redmine/config/../lib/tasks/migrate_from_trac.rake:643
/usr/lib/ruby/1.8/rake.rb:387:in `call'
/usr/lib/ruby/1.8/rake.rb:387:in `execute'
/usr/lib/ruby/1.8/rake.rb:387:in `each'
/usr/lib/ruby/1.8/rake.rb:387:in `execute'
/usr/lib/ruby/1.8/rake.rb:357:in `invoke'
/usr/lib/ruby/1.8/thread.rb:135:in `synchronize'
/usr/lib/ruby/1.8/rake.rb:350:in `invoke'
/usr/lib/ruby/1.8/rake.rb:1906:in `run'
/usr/lib/ruby/1.8/rake.rb:1906:in `each'
/usr/lib/ruby/1.8/rake.rb:1906:in `run'
/usr/bin/rake:4
kopernikus@san:~/redmine$

thanks,
k

#8 Updated by Jean-Philippe Lang over 12 years ago

What is your sqlite version ?
I think your problem is related to this: http://dev.rubyonrails.org/ticket/7219

See the comment on the rails blog:
http://weblog.rubyonrails.org/2007/1/29/using-sqlite3-with-rails

#9 Updated by paul k over 12 years ago

  • % Done changed from 0 to 100

Hi Jean-Philippe,

I changed the db to mysql and importing trac projects works now.
I'll close the ticket since this doesn't seem to be a redmine issue.
Thanks for you patience.

cheers
k

#10 Updated by Jean-Philippe Lang over 12 years ago

  • Category set to Importers
  • Status changed from New to Closed
  • Resolution set to Invalid

Thanks.

Also available in: Atom PDF