Bundler installs file with the wrong permission on deployment

33 views
Skip to first unread message

J. Pablo Fernández

unread,
May 27, 2014, 4:53:41 AM5/27/14
to ruby-b...@googlegroups.com
For some reasons the file of the gem random_unique_id end up with the wrong permissions when installed on deployment:

    # ls -la /var/www/projectx/shared/bundle/ruby/2.1.0/gems/random_unique_id-0.2.0
    total 48
    drwxrwxr-x   5 projectx projectx 4096 May 26 23:36 .
    drwxrwxr-x 148 projectx projectx 4096 May 26 23:36 ..
    -rw-------   1 projectx projectx  320 May 26 23:36 Gemfile
    drwxrwxr-x   2 projectx projectx 4096 May 26 23:36 gemfiles
    -rw-------   1 projectx projectx  184 May 26 23:36 .gitignore
    drwxrwxr-x   3 projectx projectx 4096 May 26 23:36 lib
    -rw-------   1 projectx projectx 1067 May 26 23:36 LICENSE.txt
    -rw-------   1 projectx projectx  223 May 26 23:36 Rakefile
    -rw-------   1 projectx projectx 1000 May 26 23:36 random_unique_id.gemspec
    -rw-------   1 projectx projectx 2934 May 26 23:36 README.md
    drwxrwxr-x   2 projectx projectx 4096 May 26 23:36 test
    -rw-------   1 projectx projectx  127 May 26 23:36 .travis.yml

They should be readable by all. Other gems have the right permissions:

    # ls -la /var/www/projectx/shared/bundle/ruby/2.1.0/gems/sorcery-0.8.5/
    total 76
    drwxrwxr-x   4 projectx projectx  4096 May 26 23:36 .
    drwxrwxr-x 148 projectx projectx  4096 May 26 23:36 ..
    -rw-r--r--   1 projectx projectx  5802 May 26 23:36 CHANGELOG.md
    -rw-r--r--   1 projectx projectx    55 May 26 23:36 .document
    -rw-r--r--   1 projectx projectx   733 May 26 23:36 Gemfile
    -rw-r--r--   1 projectx projectx   503 May 26 23:36 Gemfile.rails4
    -rw-r--r--   1 projectx projectx   865 May 26 23:36 .gitignore
    drwxrwxr-x   4 projectx projectx  4096 May 26 23:36 lib
    -rw-r--r--   1 projectx projectx  1083 May 26 23:36 LICENSE.txt
    -rw-r--r--   1 projectx projectx   117 May 26 23:36 Rakefile
    -rw-r--r--   1 projectx projectx 10309 May 26 23:36 README.md
    -rw-r--r--   1 projectx projectx     8 May 26 23:36 .rspec
    -rw-r--r--   1 projectx projectx  1309 May 26 23:36 sorcery.gemspec
    drwxrwxr-x   8 projectx projectx  4096 May 26 23:36 spec
    -rw-r--r--   1 projectx projectx   329 May 26 23:36 .travis.yml
    -rw-r--r--   1 projectx projectx     5 May 26 23:36 VERSION

I'm installing these gems by using Bundler 1.6.2 and the Gemfile includes random_unique_id like this:

    gem "random_unique_id", "~> 0.2.0"

I'm deploying using Capistrano 3.2.1 (Rake Version: 10.3.1) and capistrano-bundler 1.1.2. The generated bundle line looks like this:

    cd /var/www/projectx/releases/20140526233202 && /usr/local/rvm/bin/rvm default do bundle install --binstubs /var/www/projectx/shared/bin --path /var/www/projectx/shared/bundle --without development test --deployment --quiet

Any ideas what can cause this issue?

Disclaimer: I wrote that gem, random_unique_id, but I don't see how that can have any effect.

André Arko

unread,
May 28, 2014, 1:45:41 PM5/28/14
to ruby-b...@googlegroups.com
Bundler doesn’t manipulate the permissions of gems when they are installed unless you run `bundle install` as a user who doesn’t have write permissions to the directory Bundler is installing into. My guesses are that you are either using Bundler’s sudo mode, or you managed to generate a .gem that has those permissions set inside it already.

--
You received this message because you are subscribed to the Google Groups "ruby-bundler" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-bundler...@googlegroups.com.
To post to this group, send email to ruby-b...@googlegroups.com.
Visit this group at http://groups.google.com/group/ruby-bundler.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages