Defect #3291

"undefined method `read' for nil:NilClass" in redmine:migrate_from_trac

Added by Michael Wünsch over 5 years ago. Updated over 5 years ago.

Status:ClosedStart date:2009-05-04
Priority:NormalDue date:
Assignee:-% Done:

0%

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

Description

redmine:migrate_from_trac task fails with "undefined method `read' for nil:NilClass" on Redmine 0.8.3. I had to apply the patch from #3254 to get the tickets imported.

% ruby script/about
About your application's environment
Ruby version              1.8.7 (i486-linux)
RubyGems version          1.3.1
Rails version             2.1.2
Active Record version     2.1.2
Action Pack version       2.1.2
Active Resource version   2.1.2
Action Mailer version     2.1.2
Active Support version    2.1.2
Application root          /var/www/rails_apps/redmine-0.8.3
Environment               development
Database adapter          postgresql
Database schema version   101
% RAILS_ENV=production rake redmine:migrate_from_trac --trace
(in /var/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 []: /root/trac
Trac database adapter (sqlite, sqlite3, mysql, postgresql) [sqlite]: sqlite3
Trac database encoding [UTF-8]:
Target project identifier []: myproject

Migrating components.....
Migrating milestones................
Migrating custom fields...
Migrating tickets........................................
Migrating wiki.........................rake aborted!
undefined method `read' for nil:NilClass
/var/www/rails_apps/redmine-0.8.3/lib/tasks/migrate_from_trac.rake:146:in `read'
/var/www/rails_apps/redmine-0.8.3/app/models/attachment.rb:76:in `before_save'
/var/www/rails_apps/redmine-0.8.3/app/models/attachment.rb:74:in `open'
/var/www/rails_apps/redmine-0.8.3/app/models/attachment.rb:74:in `before_save'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/callbacks.rb:301:in `send'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/callbacks.rb:301:in `callback'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/callbacks.rb:206:in `create_or_update'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/base.rb:2211:in `save_without_validation'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/validations.rb:911:in `save_without_dirty'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/dirty.rb:75:in `save_without_transactions'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/transactions.rb:106:in `save'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in `transaction'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/transactions.rb:79:in `transaction'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/transactions.rb:98:in `transaction'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/transactions.rb:106:in `save'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/transactions.rb:118:in `rollback_active_record_state!'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/transactions.rb:106:in `save'
/var/www/rails_apps/redmine-0.8.3/lib/tasks/migrate_from_trac.rake:573:in `migrate'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/associations/association_collection.rb:277:in `method_missing'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/associations/association_proxy.rb:171:in `method_missing'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/associations/association_proxy.rb:171:in `each'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/associations/association_proxy.rb:171:in `send'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/associations/association_proxy.rb:171:in `method_missing'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/associations/association_collection.rb:277:in `method_missing'
/var/www/rails_apps/redmine-0.8.3/lib/tasks/migrate_from_trac.rake:565:in `migrate'
/var/www/rails_apps/redmine-0.8.3/lib/tasks/migrate_from_trac.rake:548:in `each'
/var/www/rails_apps/redmine-0.8.3/lib/tasks/migrate_from_trac.rake:548:in `migrate'
/var/www/rails_apps/redmine-0.8.3/lib/tasks/migrate_from_trac.rake:756
/var/lib/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in `call'
/var/lib/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in `execute'
/var/lib/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in `each'
/var/lib/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in `execute'
/var/lib/gems/1.8/gems/rake-0.8.4/lib/rake.rb:578:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/var/lib/gems/1.8/gems/rake-0.8.4/lib/rake.rb:571:in `invoke_with_call_chain'
/var/lib/gems/1.8/gems/rake-0.8.4/lib/rake.rb:564:in `invoke'
/var/lib/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2027:in `invoke_task'
/var/lib/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in `top_level'
/var/lib/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in `each'
/var/lib/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in `top_level'
/var/lib/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in `standard_exception_handling'
/var/lib/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1999:in `top_level'
/var/lib/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1977:in `run'
/var/lib/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in `standard_exception_handling'
/var/lib/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1974:in `run'
/var/lib/gems/1.8/gems/rake-0.8.4/bin/rake:31
/var/lib/gems/1.8/bin/rake:19:in `load'
/var/lib/gems/1.8/bin/rake:19

migrate_from_trac.rake.patch Magnifier (1.16 KB) Kim Shrier, 2009-05-09 20:13


Related issues

Related to Defect #3254: [PATCH] ArgumentError in redmine:migrate_from_trac Closed 2009-04-28

Associated revisions

Revision 2706
Added by Jean-Philippe Lang over 5 years ago

Merged r2705 from trunk (#3291).

Revision 2718
Added by Jean-Philippe Lang over 5 years ago

Same as fix as r2705 from Trac wiki pages attachments (#3291).

Revision 2719
Added by Jean-Philippe Lang over 5 years ago

Merged r2718 from trunk (#3291).

History

#1 Updated by Jean-Philippe Lang over 5 years ago

  • Status changed from New to Closed
  • Affected version (unused) changed from 0.8.3 to devel
  • Resolution set to Fixed
  • Affected version deleted (0.8.3)

Patch merged in r2706 in 0.8-stable branch.

#2 Updated by Michael Wünsch over 5 years ago

  • Status changed from Closed to Reopened

I am sorry but I checked out r2711 and the error still persists (but with slightly different line numbers) same in trunk:

% RAILS_ENV=production rake redmine:migrate_from_trac --trace
(in /var/www/rails_apps/redmine-0.8-stable)
** 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 []: /root/trac
Trac database adapter (sqlite, sqlite3, mysql, postgresql) [sqlite]: sqlite3
Trac database encoding [UTF-8]: 
Target project identifier []: myproject

Migrating components........
Migrating milestones....
Migrating custom fields....
Migrating tickets..............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Migrating wiki.........................rake aborted!
undefined method `read' for nil:NilClass
/var/www/rails_apps/redmine-0.8-stable/lib/tasks/migrate_from_trac.rake:146:in `read'
/var/www/rails_apps/redmine-0.8-stable/app/models/attachment.rb:76:in `before_save'
/var/www/rails_apps/redmine-0.8-stable/app/models/attachment.rb:74:in `open'
/var/www/rails_apps/redmine-0.8-stable/app/models/attachment.rb:74:in `before_save'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/callbacks.rb:301:in `send'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/callbacks.rb:301:in `callback'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/callbacks.rb:206:in `create_or_update'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/base.rb:2211:in `save_without_validation'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/validations.rb:911:in `save_without_dirty'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/dirty.rb:75:in `save_without_transactions'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/transactions.rb:106:in `save'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in `transaction'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/transactions.rb:79:in `transaction'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/transactions.rb:98:in `transaction'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/transactions.rb:106:in `save'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/transactions.rb:118:in `rollback_active_record_state!'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/transactions.rb:106:in `save'
/var/www/rails_apps/redmine-0.8-stable/lib/tasks/migrate_from_trac.rake:573:in `migrate'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/associations/association_collection.rb:277:in `method_missing'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/associations/association_proxy.rb:171:in `method_missing'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/associations/association_proxy.rb:171:in `each'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/associations/association_proxy.rb:171:in `send'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/associations/association_proxy.rb:171:in `method_missing'
/var/lib/gems/1.8/gems/activerecord-2.1.2/lib/active_record/associations/association_collection.rb:277:in `method_missing'
/var/www/rails_apps/redmine-0.8-stable/lib/tasks/migrate_from_trac.rake:565:in `migrate'
/var/www/rails_apps/redmine-0.8-stable/lib/tasks/migrate_from_trac.rake:548:in `each'
/var/www/rails_apps/redmine-0.8-stable/lib/tasks/migrate_from_trac.rake:548:in `migrate'
/var/www/rails_apps/redmine-0.8-stable/lib/tasks/migrate_from_trac.rake:756
/usr/lib/ruby/1.8/rake.rb:546:in `call'
/usr/lib/ruby/1.8/rake.rb:546:in `execute'
/usr/lib/ruby/1.8/rake.rb:541:in `each'
/usr/lib/ruby/1.8/rake.rb:541:in `execute'
/usr/lib/ruby/1.8/rake.rb:508:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/rake.rb:501:in `synchronize'
/usr/lib/ruby/1.8/rake.rb:501:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/rake.rb:494:in `invoke'
/usr/lib/ruby/1.8/rake.rb:1931:in `invoke_task'
/usr/lib/ruby/1.8/rake.rb:1909:in `top_level'
/usr/lib/ruby/1.8/rake.rb:1909:in `each'
/usr/lib/ruby/1.8/rake.rb:1909:in `top_level'
/usr/lib/ruby/1.8/rake.rb:1948:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:1903:in `top_level'
/usr/lib/ruby/1.8/rake.rb:1881:in `run'
/usr/lib/ruby/1.8/rake.rb:1948:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:1878:in `run'
/usr/bin/rake:28

I did a dropdb, createdb, db:migrate and redmine:load_default_data before migrating.
The environment is now:

About your application's environment
Ruby version              1.8.7 (i486-linux)
RubyGems version          1.3.1
Rails version             2.1.2
Active Record version     2.1.2
Action Pack version       2.1.2
Active Resource version   2.1.2
Action Mailer version     2.1.2
Active Support version    2.1.2
Application root          /var/www/rails_apps/redmine-0.8-stable
Environment               development
Database adapter          postgresql
Database schema version   101

#3 Updated by Kim Shrier over 5 years ago

I am using Redmine 0.8.3 r2717 and had the same problem when importing attachments to wiki pages. The following patch fixes the problem.

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

  • Category set to Importers
  • Status changed from Reopened to Closed

Patch committed in r2718 in trunk and r2719 in 0.8-stable.
Thanks.

Also available in: Atom PDF