echo3
echo3

Reputation: 131

ArgumentError: parent directory is world writable but not sticky (bundle install)

Link to github for error printout

When i try to bundle install I receive the above error. I have tried what other posts suggest and the github community doesn't know the answer.

I am running Arch and am using zsh for my shell.

Updated Environment:

Bundler 1.12.5

Rubygems 2.5.1

Ruby 2.3.1p112 (2016-04-26 revision 54768)[x86_64-linux]

GEM_HOME /usr/lib/ruby/gems/2.3.0

GEM_PATH /usr/lib/ruby/gems/2.3.0:/home/.gem/ruby/2.3.0

Git 2.8.3

open_gem (1.5.0)

Thanks in advance!

Upvotes: 7

Views: 2837

Answers (3)

mpalencia
mpalencia

Reputation: 6037

This worked for me

sudo chmod +t -R ~/.bundle/cache/compact_index/

Upvotes: 0

baocheng liao
baocheng liao

Reputation: 161

Try this:

chmod +t -R ~/.bundle/cache

it works for me.

Upvotes: 12

Aetherus
Aetherus

Reputation: 8898

First, run command

ls -l ~/.bundle/cache/compact_index/

You should see something like

drwxr-xr-x  3 myname  staff  102 Jun  1 23:03 rubygems.org.443.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

(I'm a miserable Chinese programmer so my folder is ruby.taobao.org.443.07113fbafd9bf5f337f3f6cee4b3a723. I guess the dir name is <rubygems source domain>.<rubygems source port (443 for HTTPS)>.<checksum>)

Pay attention to the drwxr-xr-x part, and make sure it's NOT drwxrwxrwx.

If it is drwxrwxrwx, then change it by the command

chmod 0755 rubygems.org.443.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

drwxrwxrwx (0777) means anyone can create any file in that dir (world writable) as well as remove/move them (not sticky). Bundler (>= 1.12.4) uses compact_index which in turn uses Dir::mktmpdir to create sub directories in that dir.

For security reason, the method Dir::mktmpdir verifies the permission of the parent dir of the to-be-created tmp dir. If the permission is 0777 (drwxrwxrwx) then you will see this error because it's insecure.

0755 (drwxr-xr-x) is fine because only the owner (user) of that directory can create/delete/move files or sub directories in that dir (not world writable). Anyone else can only list their information.

1777 (drwxrwxrwt) is also fine because anyone can create file or sub directory in that dir (world writable), but only the creator of that file can remove/move it (sticky).

Upvotes: 4

Related Questions