echo3 echo3 - 1 year ago 95
Linux Question

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!


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

(I'm a miserable Chinese programmer so my folder is 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

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).