> This is strange. What are the permissions that you are seeing? I ran
> the same steps on my b87 machine, and here's how the permissions show
> up. They are sufficient for a user to use rails.
I completely re-installed OpenSolaris 2008.05 on a formatted hard drive.
% pfexec pkg refresh --full
% pfexec pkg install gcc-dev ss-dev ruby-dev webstackui
% pfexec gem update
% pfexec gem install rails --include-dependencies
% cd /usr/ruby/1.8/bin
% ls -hlF
total 55K
-rwxr-xr-x 1 root bin 3.8K 2008-05-11 20:43 erb*
-rwxr-xr-x 1 root bin 707 2008-05-11 20:43 gem*
-rwxr-xr-x 1 root bin 3.2K 2008-05-11 20:43 gemlock*
-rwxr-xr-x 1 root bin 1.8K 2008-05-11 20:43 gem_mirror*
-rwxr-xr-x 1 root bin 521 2008-05-11 20:43 gemri*
-rwxr-xr-x 1 root bin 76 2008-05-11 20:43 gem_server*
-rwxr-xr-x 1 root bin 1.8K 2008-05-11 20:43 gemwhich*
-rwxr-xr-x 1 root bin 7.8K 2008-05-11 20:43 index_gem_repository.rb*
-rwxr-xr-x 1 root bin 382 2008-05-11 20:43 irb*
-rwx------ 1 root root 342 2008-05-11 20:47 rails*
-rwx------ 1 root root 342 2008-05-11 20:47 rake*
-rwxr-xr-x 1 root bin 1.6K 2008-05-11 20:43 rdoc*
-rwxr-xr-x 1 root bin 1.5K 2008-05-11 20:43 ri*
-rwxr-xr-x 1 root bin 6.2K 2008-05-11 20:43 ruby*
-rwxr-xr-x 1 root bin 156 2008-05-11 20:43 testrb*
-rwxr-xr-x 1 root bin 655 2008-05-11 20:43 update_rubygems*
So you can see that the permissions are not created correctly during the
installation of rails. I'm not sure why they are done differently on my
machine, but I completely re-installed from scratch to ensure I was in a clean
environment.
% pfexec chmod a+rx rails rake
You already mentioned that patching rubygems for the long term fix, but for now:
% pfexec ln -s /usr/ruby/1.8/bin/rails /usr/bin/rails
% pfexec ln -s /usr/ruby/1.8/bin/rake /usr/bin/rake
Setting GEM_HOME environment variable goes a long way to fixing the previous
problem (thanks!):
% export GEM_HOME=/var/ruby/1.8/gem_home
% echo $GEM_HOME
/var/ruby/1.8/gem_home
So now I try to create a rails work space:
% cd ~
% rails test-rails
/usr/ruby/1.8/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91:in `read'':
Permission denied -
/var/ruby/1.8/gem_home/specifications/activerecord-2.0.0.gemspec (Errno::EACCES)
... et cetera ...
Let's try again with super-user priviledges:
% pfexec rails test
create
create app/controllers
create app/helpers
...
create log/test.log
% ls -hlF
total 11K
drwx------ 2 karrick staff 2 2008-05-10 12:18 bin/
drwxr-xr-x 2 karrick staff 2 2008-05-10 12:18 Desktop/
-rwx------ 2 karrick staff 2 2008-05-10 12:18 install-dev.script/
drwx------ 5 karrick staff 114 2008-05-10 12:18 scripts/
drwx------ 15 root root 15 2008-05-11 21:05 test-rails/
Sure enough, looking into the [/var/ruby/1.8/gem_home] directory, all the
subdirectories in [cache], [doc], [gems], and [specifications] are all read
only to the owner, who is root.
% cd /var/ruby/1.8/gem_home
% pfexec find . -type d -exec chmod a+rx {} \;
(long pause while all directories have group and world read and execute
permissions added...)
% pfexec find . -type f -exec chmod a+r {} \;
(long pause while all files have group and world read permissions added...)
% cd ~
% rails test-again
create
create app/controllers
create app/helpers
...
create log/test.log
% ls -hlF
total 11K
drwx------ 2 karrick staff 2 2008-05-10 12:18 bin/
drwxr-xr-x 2 karrick staff 2 2008-05-10 12:18 Desktop/
-rwx------ 2 karrick staff 2 2008-05-10 12:18 install-dev.script/
drwx------ 5 karrick staff 114 2008-05-10 12:18 scripts/
drwx------ 15 root root 15 2008-05-11 21:05 test-rails/
drwx------ 15 karrick staff 15 2008-05-11 21:05 test-rails/
So the problem is solved with some mechanical finess.
Summary of the process:
% pfexec pkg refresh --full
% pfexec pkg install gcc-dev ss-dev ruby-dev webstackui
% pfexec gem update
% pfexec gem install rails --include-dependencies
% pfexec chmod a+rx rails rake
% pfexec ln -s /usr/ruby/1.8/bin/rails /usr/bin/rails
% pfexec ln -s /usr/ruby/1.8/bin/rake /usr/bin/rake
% export GEM_HOME=/var/ruby/1.8/gem_home
% cd /var/ruby/1.8/gem_home
% pfexec find . -type d -exec chmod a+rx {} \;
% pfexec find . -type f -exec chmod a+r {} \;
I surely hope someone else finds this usefull. A big thanks to the OpenSolaris
community that gave a few insightfull pointers along the way.
-Karrick
This message posted from opensolaris.org