Bug 496480

Summary: Rails is broken
Product: [Fedora] Fedora Reporter: Dietmar Kling <baldur>
Component: rubygem-railsAssignee: David Lutterkort <lutter>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: high    
Version: 11CC: baldur, blackcode, cse.cem+redhatbugz, gdubreui, hbrock, lutter, mastahnke, mitchb, ricardo.arguello, sseago, vanmeeuwen+fedora
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 2.3.2-3.fc11 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-08-01 23:56:55 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch to spec file to avoid removing required zero-length files none

Description Dietmar Kling 2009-04-19 15:05:41 UTC
Description of problem:
Rails is broken in the current rawhide version. Executing the standard
"generate" scipt results in an error. This is one of the essentials to
run if you are doing ruby :-)

Version-Release number of selected component (if applicable):
rubygem-rails-2.3.2-1.fc11.noarch

How reproducible:



Steps to Reproduce:
1. cd ~
2. rails test_rails
3. cd test_rails
4. ./script/generate model fedora
  
Actual results:

/usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:20:in `configuration': uninitialized class variable @@configuration in Rails (NameError)
        from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails_generator/lookup.rb:109:in `use_component_sources!'
        from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails_generator/lookup.rb:55:in `included'
        from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails_generator.rb:38:in `include'
        from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails_generator.rb:38:in `send'
        from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails_generator.rb:38
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/commands/generate.rb:2
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from ./script/generate:3



Expected results:
Generates template model

Additional info:
Additional bug at generate time:

No such file or directory - /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/bin/../lib/rails_generator/generators/applications/app/../../../../../html/favicon.ico

Comment 1 Dietmar Kling 2009-04-19 19:02:43 UTC
Tested this on an x86 and x86_64 installation.  Both machines show the same behaviour.

BTW.

./scripts/generate   

is sufficient to show the bug (normally now a help message should come up).

Comment 2 Dietmar Kling 2009-04-21 16:26:37 UTC
rails is broken and nobody is interested?

Comment 3 David Lutterkort 2009-04-21 17:53:11 UTC
I am interested, I simply haven't had time to look into it. Any suggestions for a fix ?

Comment 4 Dietmar Kling 2009-04-21 18:07:40 UTC
Nope, i am quite new to rail and tried some research on the internet.
There are various bug reports on such an issue on other versions, but they all fail to provide any solution.

debug output - there at least seems something missing?

# ruby --debug ./script/generate

Exception `LoadError' at /usr/lib/ruby/site_ruby/1.8/rubygems.rb:871 - no such file to load -- rubygems/defaults/operating_system
Exception `LoadError' at /usr/lib/ruby/site_ruby/1.8/rubygems/config_file.rb:35 - no such file to load -- Win32API
Exception `Gem::LoadError' at /usr/lib/ruby/site_ruby/1.8/rubygems.rb:636 - Could not find RubyGem builder (~> 2.1.2)

Exception `Gem::LoadError' at /usr/lib/ruby/site_ruby/1.8/rubygems.rb:636 - Could not find RubyGem memcache-client (>=1.6.5)

Exception `Gem::LoadError' at /usr/lib/ruby/site_ruby/1.8/rubygems.rb:636 - Could not find RubyGem tzinfo (~> 0.3.12)

Exception `TypeError' at (eval):4 - can't modify frozen object
Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31 - no such file to load -- fast_xs
Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:38 - no such file to load -- fast_xs
Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31 - no such file to load -- Win32API
Exception `MissingSourceFile' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:38 - no such file to load -- Win32API
Exception `MissingSourceFile' at /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:162 - no such file to load -- Win32API
Exception `NameError' at /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:20 - uninitialized class variable @@configuration in Rails
/usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:20:in `configuration': uninitialized class variable @@configuration in Rails (NameError)
        from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails_generator/lookup.rb:109:in `use_component_sources!'
        from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails_generator/lookup.rb:55:in `included'
        from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails_generator.rb:38:in `include'
        from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails_generator.rb:38:in `send'
        from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails_generator.rb:38
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/commands/generate.rb:2
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from ./script/generate:3

Comment 5 Dietmar Kling 2009-04-21 18:18:12 UTC
at least one error i could remove 
by installing 
yum install rubygem-gem_plugin
yum install rubygem-builder

( i originally did an install by yum install rubygem-rails and installed a all suggested packages by yum).

This what is installed now, but still it doesn't work.


#rpm -qa|grep ruby
rubygem-rails-2.3.2-1.fc11.noarch
ruby-mode-1.8.6.287-8.fc11.x86_64
rubygem-activeresource-2.3.2-1.fc11.noarch
rubygem-activesupport-2.3.2-1.fc11.noarch
ruby-irb-1.8.6.287-8.fc11.x86_64
rubygem-rake-0.8.4-1.fc11.noarch
ruby-libs-1.8.6.287-8.fc11.x86_64
rubygem-actionmailer-2.3.2-1.fc11.noarch
rubygem-gem_plugin-0.2.3-2.fc11.noarch
rubygems-1.3.1-2.fc11.noarch
ruby-devel-1.8.6.287-8.fc11.x86_64
rubygem-activerecord-2.3.2-1.fc11.noarch
rubygem-actionpack-2.3.2-1.fc11.noarch
ruby-1.8.6.287-8.fc11.x86_64
ruby-rdoc-1.8.6.287-8.fc11.x86_64
rubygem-builder-2.1.2-3.fc11.noarch

Comment 6 Dietmar Kling 2009-04-24 17:51:37 UTC
Well in my desperate answer i tried the following... 


# gem install rails                                    
WARNING:  Installing to ~/.gem since /usr/lib/ruby/gems/1.8 and
          /usr/bin aren't both writable.
Successfully installed rails-2.3.2
1 gem installed


WORKS!


However i believe this not the way it should be :-)

Comment 7 Fedora Update System 2009-05-06 23:48:53 UTC
rubygem-rails-2.3.2-2.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/rubygem-rails-2.3.2-2.fc11

Comment 8 David Lutterkort 2009-05-06 23:53:58 UTC
I found the issue - the spec file inadvertantly broke scripts/generate by
patching the line 'require "#{RAILS_ROOT}/config/environment"' in
lib/commands/generate.rb

Built rubygem-rails-2.3.2-2 to address the issue

Comment 9 Conrad Meyer 2009-05-10 08:00:52 UTC
I find that rubygem-rails-2.3.2-2 is still broken; running 'rails foo' to generate a new rails project shows that a few files are missing:

create  public/favicon.ico
No such file or directory - /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/bin/../lib/rails_generator/generators/applications/app/../../../../../html/favicon.ico

...

create  log/server.log
No such file or directory - /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/bin/../lib/rails_generator/generators/applications/app/../../../../../configs/empty.log

Comment 10 Conrad Meyer 2009-05-10 08:02:21 UTC
(This list is not necessarily complete.)

I have installed the version from 'gem install rails' for now; obviously this is not how-it-should-be.

Comment 11 Bug Zapper 2009-06-09 14:07:33 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 11 development cycle.
Changing version to '11'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 12 Gilles Dubreuil 2009-07-04 05:58:45 UTC
Two files are missing from Fedora 11 rubygem-rails-2.3.2-2.fc11 rpm package.
So when doing a "rails <application>" it would break right after:

rails myapp
.../...
create  public/favicon.ico
No such file or directory - /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/bin/../lib/rails_generator/generators/applications/app/../../../../../html/favicon.ico

It breaks the first time because gems/rails-2.3.2/Rakefile is looking for favicon.ico and later the empty.log is required by gems/rails-2.3.2/rails_generator/generators/applications/app/app_generator.rb

The two missing files that are missing are:
/usr/lib/ruby/gems/1.8/gems/rails-2.3.2/html/favicon.ico
/usr/lib/ruby/gems/1.8/gems/rails-2.3.2/configs/empty.log

Therefore the following files are not installed in the application tree:
      create  public/robots.txt
      create  public/images/rails.png
      create  public/javascripts/prototype.js
      create  public/javascripts/effects.js
      create  public/javascripts/dragdrop.js
      create  public/javascripts/controls.js
      create  public/javascripts/application.js
      create  doc/README_FOR_APP
      create  log/server.log
      create  log/production.log
      create  log/development.log
      create  log/test.log

I guess those two files where ignored from the rpm spec files because there are empty. There are obviously needed - see Rakefile and CHANGELOG in gems/rails-2.3.2.

BTW, that also breaks rails ajax/javascripts features as the public/javascripts/file are not copied during application structure generation.

Temporary workarounds:

1 - Using gem package instead of standard rpm:
# yum uninstall rubygem-rails
# gem install rails

2 - Adding the two missing empty files (adapt your path /usr/lib/ruby/gems/1.8/gems accordingly)
touch /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/html/favicon.ico
touch /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/configs/empty.log
 
rubygem-rails specs file to add those two files.

I hope it helps

Comment 13 Mitchell Berger 2009-07-18 08:56:21 UTC
Created attachment 354243 [details]
Patch to spec file to avoid removing required zero-length files

Sometime between the version of this package appearing in Fedora 9
and the current version, the spec file gained a stanza that removes
all zero-length files from the destination tree.  This is an error,
and causes it to remove the following four required empty files from
the package (and nothing else):

./configs/empty.log
./html/favicon.ico
./lib/rails_generator/generators/components/mailer/templates/fixture.rhtml
./lib/rails_generator/generators/components/mailer/templates/view.rhtml

Without the first two files above, you cannot even run 'rails' to
create a new application.  This patch corrects the spec file to no
longer delete these required files.

Comment 14 Hugh Brock 2009-07-18 22:11:45 UTC
Verified touching these 4 files and regenerating my rails app works for me. We'll make sure to apply the patch above for f11 and f12. Sorry about that.

Comment 15 Fedora Update System 2009-07-24 16:56:07 UTC
rubygem-rails-2.3.2-3.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/rubygem-rails-2.3.2-3.fc11

Comment 16 Fedora Update System 2009-07-27 21:29:31 UTC
rubygem-rails-2.3.2-3.fc11 has been pushed to the Fedora 11 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update rubygem-rails'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F11/FEDORA-2009-8020

Comment 17 Fedora Update System 2009-08-01 23:56:49 UTC
rubygem-rails-2.3.2-3.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 18 bugfinder 2009-09-27 17:01:49 UTC
  --> Missing Dependency: rubygem(activesupport) = 2.3.2 is needed by package rubygem-activerecord-2.3.2-1.fc11.noarch (installed)