Strange frozen string problem starting rails


#1

hi,

I am experiencing a very strange problem with my Rails installation. I’m
using ruby 1.8.6 on Debian Linux, with edge rails.

Whenever I try to start mongrel, I get an exception about “can’t modify
frozen string”. I get a similar exception when I try to do “rake
db:migrate”. In this case, the exception seems to pop up after the
migrations do succesfully run.

The problem seems similar to the one described at
http://rubyforge.org/forum/message.php?msg_id=20575, except the user
there is running Windows and I am running Linux.

Most mysteriously, other members of my development team do not
experience this problem.

Here is a stack trace of the exception:

mlc@coconut:~/src/demomcracynow.org$ rake --trace db:migrate
(in /home/mlc/src/democracynow.org)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
** Invoke db:schema:dump (first_time)
** Invoke environment
** Execute db:schema:dump
rake aborted!
can’t modify frozen string
/usr/lib/ruby/1.8/date/format.rb:105:in chomp!' /usr/lib/ruby/1.8/date/format.rb:105:inmethod_missing’
/usr/lib/ruby/1.8/date/format.rb:963:in _parse' /home/mlc/src/democracynow.org/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb:114:instring_to_time’
/home/mlc/src/democracynow.org/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb:60:in
type_cast' /home/mlc/src/democracynow.org/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb:22:ininitialize’
/home/mlc/src/democracynow.org/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:93:in
initialize' /home/mlc/src/democracynow.org/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:354:innew’
/home/mlc/src/democracynow.org/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:354:in
columns' /home/mlc/src/democracynow.org/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:354:ineach’
/home/mlc/src/democracynow.org/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:354:in
columns' /home/mlc/src/democracynow.org/vendor/rails/activerecord/lib/active_record/schema_dumper.rb:68:intable’
/home/mlc/src/democracynow.org/vendor/rails/activerecord/lib/active_record/schema_dumper.rb:63:in
tables' /home/mlc/src/democracynow.org/vendor/rails/activerecord/lib/active_record/schema_dumper.rb:54:ineach’
/home/mlc/src/democracynow.org/vendor/rails/activerecord/lib/active_record/schema_dumper.rb:54:in
tables' /home/mlc/src/democracynow.org/vendor/rails/activerecord/lib/active_record/schema_dumper.rb:23:indump’
/home/mlc/src/democracynow.org/vendor/rails/activerecord/lib/active_record/schema_dumper.rb:17:in
dump' /home/mlc/src/democracynow.org/vendor/rails/railties/lib/tasks/databases.rake:24/home/mlc/src/democracynow.org/vendor/rails/railties/lib/tasks/databases.rake:23:inopen’
/home/mlc/src/democracynow.org/vendor/rails/railties/lib/tasks/databases.rake:23/usr/lib/ruby/1.8/rake.rb:387:in
call' /usr/lib/ruby/1.8/rake.rb:387:inexecute’
/usr/lib/ruby/1.8/rake.rb:387:in each' /usr/lib/ruby/1.8/rake.rb:387:inexecute’
/usr/lib/ruby/1.8/rake.rb:357:in invoke' /usr/lib/ruby/1.8/rake.rb:350:insynchronize’
/usr/lib/ruby/1.8/rake.rb:350:in invoke' /home/mlc/src/democracynow.org/vendor/rails/railties/lib/tasks/databases.rake:5 /usr/lib/ruby/1.8/rake.rb:387:incall’
/usr/lib/ruby/1.8/rake.rb:387:in execute' /usr/lib/ruby/1.8/rake.rb:387:ineach’
/usr/lib/ruby/1.8/rake.rb:387:in execute' /usr/lib/ruby/1.8/rake.rb:357:ininvoke’
/usr/lib/ruby/1.8/rake.rb:350:in synchronize' /usr/lib/ruby/1.8/rake.rb:350:ininvoke’
/usr/lib/ruby/1.8/rake.rb:1906:in run' /usr/lib/ruby/1.8/rake.rb:1906:ineach’
/usr/lib/ruby/1.8/rake.rb:1906:in `run’
/usr/bin/rake:4

Any help would be very greatly appreciated. Let me know if I can provide
any more information.


#2

mike castleman wrote:

can’t modify frozen string
/usr/lib/ruby/1.8/date/format.rb:105:in chomp!' /usr/lib/ruby/1.8/date/format.rb:105:inmethod_missing’
/usr/lib/ruby/1.8/date/format.rb:963:in `_parse’

ok, so I managed to work around the problem by patching
/usr/lib/ruby/1.8/date/format.rb as shown below. anyone who can tell me
why this was necessary will be my new hero.

— format.rb.orig 2007-04-24 18:41:28.820600021 -0400
+++ format.rb 2007-04-24 18:40:50.362196521 -0400
@@ -101,7 +101,7 @@
end

   def method_missing(t, *args, &block)
  •   t = t.to_s
    
  •   t = String.new(t.to_s)
      set = t.chomp!('=')
      t = t.intern
      if set