Errors when freezing rails

Folks,

I am trying to freeze rails but am running into some errors that I
don’t understand. I have tried couple ways based on results I got from
searching on the web as below. I thought freezing rails would be a
simple and quick thing but am stuck here. Any thoughts on what I may
be doing wrong?

Thanks,
-S

------------------------------------- First Way

D:\myPadosi\Trunk>rake rails:freeze:edge TAG=rel_2-2-2
(in D:/myPadosi/Trunk)
cd vendor
Downloading Rails from
http://dev.rubyonrails.org/archives/rails_edge.zip
Unpacking Rails
rm -rf rails
c:/ruby/bin/rake: No such file or directory - unzip rails.zip
rm -f rails.zip
rm -f rails/Rakefile
rm -f rails/cleanlogs.sh
rm -f rails/pushgems.rb
rm -f rails/release.rb
touch rails/REVISION_abb899c54e8777428b7a607774370ba29a5573bd
rake aborted!
No such file or directory - rails/
REVISION_abb899c54e8777428b7a607774370ba29a5573bd

------------------------------------- Second Way

D:\myPadosi\Trunk>rake rails:freeze:edge RELEASE=2.2.2
(in D:/myPadosi/Trunk)
cd vendor
Downloading Rails from
http://dev.rubyonrails.org/archives/rails_2.2.2.zip
Unpacking Rails
rm -rf rails
c:/ruby/bin/rake: No such file or directory - unzip rails.zip
rm -f rails.zip
rm -f rails/Rakefile
rm -f rails/cleanlogs.sh
rm -f rails/pushgems.rb
rm -f rails/release.rb
touch rails/REVISION_abb899c54e8777428b7a607774370ba29a5573bd
rake aborted!
No such file or directory - rails/
REVISION_abb899c54e8777428b7a607774370ba29a5573bd

------------------------------------- Third Way

--------------- Not sure why it is giving a permission denied error

D:\myPadosi\Trunk>rake rails:freeze:gems
(in D:/myPadosi/Trunk)
Freezing to the gems for Rails 2.2.2
rm -rf vendor/rails
mkdir -p vendor/rails
cd vendor/rails
Unpacked gem: ‘D:/myPadosi/Trunk/vendor/rails/activesupport-2.2.2’
mv activesupport-2.2.2 activesupport
rm -rf vendor/rails
rake aborted!
Permission denied - activesupport-2.2.2 or activesupport

I am hoping someone will have some thoughts on this issue. I even
tried creating a completely fresh rails app and then running rake
rails:freeze:gems right after the app creation and I get the same
error

I ran the command with --trace and I get the output as below. I looked
at the code in fileutils.rb (where trace points to) and found that it
tries to do a simple rename of activesupport-2.2.2 to activesupport
(as also indicated in the output). I don’t understand why it does that
renaming but when I run the same command “rename activesupport-2.2.2
activesupport” on my command line it runs fine without giving the
“permission denied error” I am seeing in the output.

Any thoughts or pointers on what the issue maybe or how I can debug
further? Has anyone else seen this problem?

Thanks for your help.
-S

D:\myPadosi\test>rake rails:freeze:gems --trace
(in D:/myPadosi/test)
** Invoke rails:freeze:gems (first_time)
** Execute rails:freeze:gems
Freezing to the gems for Rails 2.2.2
rm -rf vendor/rails
mkdir -p vendor/rails
cd vendor/rails
Unpacked gem: ‘D:/myPadosi/test/vendor/rails/activesupport-2.2.2’
mv activesupport-2.2.2 activesupport
rm -rf vendor/rails
rake aborted!
Permission denied - activesupport-2.2.2 or activesupport
c:/ruby/lib/ruby/1.8/fileutils.rb:501:in rename' c:/ruby/lib/ruby/1.8/fileutils.rb:501:inmv’
c:/ruby/lib/ruby/1.8/fileutils.rb:1379:in fu_each_src_dest' c:/ruby/lib/ruby/1.8/fileutils.rb:1395:infu_each_src_dest0’
c:/ruby/lib/ruby/1.8/fileutils.rb:1377:in fu_each_src_dest' c:/ruby/lib/ruby/1.8/fileutils.rb:490:inmv’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1070:in mv' c:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/framework.rake:28 c:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/framework.rake: 26:ineach’
c:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/framework.rake:26
c:/ruby/lib/ruby/1.8/fileutils.rb:121:in chdir' c:/ruby/lib/ruby/1.8/fileutils.rb:121:inchdir’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1070:in chdir' c:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/framework.rake:25 c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:incall’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in execute' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:ineach’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in execute' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:578:ininvoke_with_call_chain’
c:/ruby/lib/ruby/1.8/monitor.rb:238:in synchronize' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:571:ininvoke_with_call_chain’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:564:in invoke' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2027:ininvoke_task’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in
top_level' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:ineach’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in
top_level' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:instandard_exception_handling’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1999:in
top_level' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1977:inrun’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in
standard_exception_handling' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1974:inrun’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/bin/rake:31
c:/ruby/bin/rake:19:in `load’
c:/ruby/bin/rake:19

I’ve seen this before, in this thread:

http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/48eed477f7519760/9c1eac3b3145b984

Can you manually unpack activesupport (use ‘gem unpack activesupport’)
and then run ‘perms \whatever\path\you\unpacked\it\to’?
There’s something weird going on with the permissions on that
directory.

Also, are you running as an admin or with a limited user account? It
may make a difference, so try it as an admin if you aren’t already.

–Matt J.

Thanks Matt. I did see that thread as well after my post but that didn’t
help me. I dug into the framework.rake file where the freeze:gems task
is located and added some debug statements there. I renamed the tasks to
be sure I am calling the right one (added 2_3_2 at the end - previously
I was trying to freeze 2.2.2 then started trying 2.3.2 in case there
were bugs in 2.2.2) and added some comments to the code in the task -
one comment after the unpack statement completes and another one after
the mv statement completes. Below is the output of running the command.
The statement after unpack shows up but the one after mv doesn’t.

Essentially code tells me that the unpacking is successful but when the
code tries to rename the file through “mv activesupport-2.3.2
activesupport” it fails with “permission denied”. Here are some things
to note.

  1. Running the freeze:gems task as below creates the vendor/rails and
    then after unpacking it creates the activesupport-2.3.2 directory. That
    directory contains part of the directory structure of the actual
    activesupport-2.3.2 and with no files in any directory

  2. I run the command “ren activesupport-2.3.2 activesupport” and it
    works find - don’t understand why that rename fails through the script
    which gets called through fileutils.rb through the mv command (I will
    have to dig into that next)

  3. I cleaned out the vendor/rails directory and manually ran the “gem
    unpack activesupport” and it created a complete copy of the
    activesupport-2.3.2 directory structure with the files

  4. Sounds like perms command is more for a linux box - doesn’t seem to
    be applicable for my XP box. The directory has read only permissions
    when I check in the directory properties

  5. I have admin privileges on my laptop - never had any issue with any
    install so I don’t understand what the “permission denied” error is
    about. It almost sounds like the script is running under another user’s
    privileges but that doesn’t sound right. Or is that possible?

I will continue to dig but I have already wasted so much time on
something that was supposed to be so trivial that it is hurting.

Thanks for your help.

-S
D:\myPadosi\Trunk>rake rails:freeze_2_3_2:gems_2_3_2 --trace
(in D:/myPadosi/Trunk)
** Invoke rails:freeze_2_3_2:gems_2_3_2 (first_time)
** Execute rails:freeze_2_3_2:gems_2_3_2
Statring gem freeze with deps =
actionpackactiverecordactionmaileractivesupportactiveresource from 2.3.2
Freezing to the gems for Rails 2.3.2
rm -rf vendor/rails
mkdir -p vendor/rails
cd vendor/rails
—> g.name = activesupport
Unpacked gem: ‘D:/myPadosi/Trunk/vendor/rails/activesupport-2.3.2’
—>Unpacked successfully - moving activesupport-2.3.2 to activesupport
mv activesupport-2.3.2 activesupport
rm -rf vendor/rails
rake aborted!
Permission denied - activesupport-2.3.2 or activesupport
c:/ruby/lib/ruby/1.8/fileutils.rb:501:in rename' c:/ruby/lib/ruby/1.8/fileutils.rb:501:inmv’
c:/ruby/lib/ruby/1.8/fileutils.rb:1379:in fu_each_src_dest' c:/ruby/lib/ruby/1.8/fileutils.rb:1395:infu_each_src_dest0’
c:/ruby/lib/ruby/1.8/fileutils.rb:1377:in fu_each_src_dest' c:/ruby/lib/ruby/1.8/fileutils.rb:490:inmv’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1070:in mv' c:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/tasks/framework.rake:31 c:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/tasks/framework.rake:27:ineach’
c:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/tasks/framework.rake:27
c:/ruby/lib/ruby/1.8/fileutils.rb:121:in chdir' c:/ruby/lib/ruby/1.8/fileutils.rb:121:inchdir’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1070:in chdir' c:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/tasks/framework.rake:26 c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:incall’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in execute' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:ineach’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in execute' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:578:ininvoke_with_call_chain’
c:/ruby/lib/ruby/1.8/monitor.rb:238:in synchronize' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:571:ininvoke_with_call_chain’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:564:in invoke' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2027:ininvoke_task’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in
top_level' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:ineach’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in
top_level' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:instandard_exception_handling’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1999:in
top_level' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1977:inrun’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in
standard_exception_handling' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1974:inrun’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/bin/rake:31
c:/ruby/bin/rake:19:in `load’
c:/ruby/bin/rake:19

To add to it, I was able to run the mv command successfully through irb.
I will continue digging as to why the unpacking doesn’t happen properly
and the mv fails when done through the rake rails:freeze:gems task.

If anyone has any thoughts/ideas - I look forward to it.

-S

D:\myPadosi\Trunk\vendor\rails>irb
irb(main):001:0> require ‘fileutils.rb’
=> true
irb(main):003:0> include FileUtils
=> Object
irb(main):004:0> mv(“activesupport-2.3.2”, “activesupport”)
=> 0
irb(main):005:0>

To eliminate any corruption I reinstalled ruby and rails (2.2.2) and
created an empty project but the same error persists with “rake
rails:freeze:gems”.

“Permission denied - activesupport-2.2.2 or activesupport”

I added some debug code to the mv function in fileUtils but I can’t get
any additional information.

  1. How can I debug rake tasks? Is there a way to set breakpoints in
    fileutils.rb when “rake rails:freeze:gems” runs so I can inspect the
    data there?

  2. How can I get information about what user is the command “rake
    rails:freeze:gems” running under? I am system admin on my box so I just
    don’t understand the permission denied error I am seeing

I also tried to go down the other path I had tried earlier to freeze
rails with “rake rails:freeze:edge TAG=rel_2-2-2”. It looks like there
the system can’t find an unzip executable - I have Winzip on my box but
not sure if that matters. I saw in another post
(http://www.question-defense.com/2009/04/02/error-freezing-rails-usr-local-lib-ruby-1-8-fileutils-rb-1297-command-not-found-unzip-railszip/)
that doing a “yum install unzip” on a linux box apparently solved this
kind of problem. Is there an equivalent “unzip” install for XP box that
might address this aspect of the problem?

D:\TestRails2>rake rails:freeze:edge TAG=rel_2-2-2 --trace
(in D:/TestRails2)
** Invoke rails:freeze:edge (first_time)
** Execute rails:freeze:edge
cd vendor
Downloading Rails from
http://dev.rubyonrails.org/archives/rails_edge.zip
Unpacking Rails
rm -rf rails
—> removed rails directory successfully
c:/ruby/bin/rake.bat: No such file or directory - unzip rails.zip
—> unzipped rails.zip
rm -f rails.zip
rm -f rails/Rakefile
rm -f rails/cleanlogs.sh
rm -f rails/pushgems.rb
rm -f rails/release.rb
touch rails/REVISION_7ce0778a1516110cf8015e59e2e8fac15032379c
rake aborted!
No such file or directory -
rails/REVISION_7ce0778a1516110cf8015e59e2e8fac15032379c

I don’t really know what else to do to debug this problem. Could use
some help/pointers here.

Thanks,
-S

Found one other mention that might be of interest:

http://www.ruby-forum.com/topic/115921

This is with a similar problem related to renaming session files.

Given that the above issue doesn’t share any code with the
rails:freeze:gems task, I’m guessing this is some kind of extremely
obscure Ruby bug. And given that it doesn’t occur when the commands
are executed in irb, it seems likely that it’s some kind of filesystem
race condition…

Sj, could you try dropping a sleep(10) call in between the unpack and
move steps? If that makes the problem go away, that will be useful
information…

–Matt J.

Thanks Matt. I tried what you suggested and it seems to heave worked -
no idea why exactly though. Output included below. I played around with
sleep time and it seems like even 1 sec is enough to avoid the problem
with “permission denied” in renaming the directory. This clearly looks
like some RoR rbug with some race condition as you suspect. What is the
best way to report this to all those wonderful folks toiling away with
helping us with the RoR framework - especially given it is apparently so
hard to reproduce for anyone else?

I can go to sleep tonight with my mind at peace - at least for now!
Appreciate the suggestion/help Matt.

D:\myPadosi\Trunk>rake rails:freeze:gems
(in D:/myPadosi/Trunk)
Freezing to the gems for Rails 2.2.2
rm -rf vendor/rails
mkdir -p vendor/rails
cd vendor/rails
Unpacked gem: ‘D:/myPadosi/Trunk/vendor/rails/activesupport-2.2.2’
–> Going to sleep for 1 seconds
–> Waking from sleep and about to start mv
mv activesupport-2.2.2 activesupport
Unpacked gem: ‘D:/myPadosi/Trunk/vendor/rails/activerecord-2.2.2’
–> Going to sleep for 1 seconds
–> Waking from sleep and about to start mv
mv activerecord-2.2.2 activerecord
Unpacked gem: ‘D:/myPadosi/Trunk/vendor/rails/actionpack-2.2.2’
–> Going to sleep for 1 seconds
–> Waking from sleep and about to start mv
mv actionpack-2.2.2 actionpack
Unpacked gem: ‘D:/myPadosi/Trunk/vendor/rails/actionmailer-2.2.2’
–> Going to sleep for 1 seconds
–> Waking from sleep and about to start mv
mv actionmailer-2.2.2 actionmailer
Unpacked gem: ‘D:/myPadosi/Trunk/vendor/rails/activeresource-2.2.2’
–> Going to sleep for 1 seconds
–> Waking from sleep and about to start mv
mv activeresource-2.2.2 activeresource
Unpacked gem: ‘D:/myPadosi/Trunk/vendor/rails/rails-2.2.2’
–> Going to sleep for 1 seconds
–> Waking from sleep and about to start mv
cd -

In case anyone comes across this problem still (I’m a sucker and still
using 2.2) on vista64, the sleep(10) wasn’t enough, but sleep(30)
worked. Hope this helps anyone still having trouble.

Somebody sent me a note recommending to disable virus scanning - it
makes sense that that could cause these kind of issues with the FS.
Can you try that when you get a minute?

–Matt J.

On Oct 10, 10:10 am, Scott W. [email protected]