Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-user rvm cleanup fails without rvmsudo #4361

Open
BrianHawley opened this issue Apr 17, 2018 · 1 comment
Open

Multi-user rvm cleanup fails without rvmsudo #4361

BrianHawley opened this issue Apr 17, 2018 · 1 comment

Comments

@BrianHawley
Copy link
Contributor

BrianHawley commented Apr 17, 2018

Description

Getting failures running rvm cleanup archives or during the archives phase of rvm cleanup all.

Steps to reproduce

For multi-user installed rvm:

rvm cleanup archives

Expected behavior

Cleaning up rvm archives
Cleanup done.

Actual behavior

Cleaning up rvm archives
chmod: changing permissions of ‘/usr/local/rvm/user/md5’: Operation not permitted
 - failed emptying /usr/local/rvm/user/md5 - please check ownership and permissions
chmod: changing permissions of ‘/usr/local/rvm/user/sha512’: Operation not permitted
 - failed emptying /usr/local/rvm/user/sha512 - please check ownership and permissions
Cleanup failed for 2

Environment info

Only info needed here, the ls -l command for the directory:

total 16
-rw-rw-r--. 1 root rvm   0 Apr 16 16:28 custom_flags
-rw-rw-r--. 1 root rvm  69 Feb 22 10:17 db
-rw-rw-r--. 1 root rvm 115 Feb 22 10:31 installs
-rw-rw-r--. 1 root rvm   1 Apr 16 16:51 md5
-rw-rw-r--  1 root rvm   0 Apr 16 16:28 rvmrcs
-rw-rw-r--. 1 root rvm   1 Apr 16 16:51 sha512

The problem in chmod_unless_link in the cleanup script is that chmod -R u+w "$1" is trying to change the mode for the user, but in multi-user mode the user is root, and the permission needs to be set on the group instead. It doesn't affect the return code so the failure is more of a misleading warning, but it would be nice if it actually fixed the right permission for multi-user mode.

@BrianHawley
Copy link
Contributor Author

After doing a fresh rvmsudo rvm get master (because of #4356), I tried rvm cleanup all, and I got a bunch of more errors:

Cleaning up rvm archives
chmod: changing permissions of `/usr/local/rvm/user/md5': Operation not permitted
 - failed emptying /usr/local/rvm/user/md5 - please check ownership and permissions
chmod: changing permissions of `/usr/local/rvm/user/sha512': Operation not permitted
 - failed emptying /usr/local/rvm/user/sha512 - please check ownership and permissions
chmod: changing permissions of `/usr/local/rvm/archives/rvm-installer': Operation not permitted
 - failed removing /usr/local/rvm/archives/rvm-installer - please check ownership and permissions
chmod: changing permissions of `/usr/local/rvm/archives/rvm-installer.asc': Operation not permitted
 - failed removing /usr/local/rvm/archives/rvm-installer.asc - please check ownership and permissions
chmod: changing permissions of `/usr/local/rvm/archives/rvm-master.tgz': Operation not permitted
 - failed removing /usr/local/rvm/archives/rvm-master.tgz - please check ownership and permissions

and then every file in "/usr/local/rvm/src/rvm/".

Looks like remove_or_log calls chmod_unless_link too, so the other cleanup functions are also affected. It doesn't matter if things were already clean.

@BrianHawley BrianHawley changed the title Multi-user rvm cleanup archives fails without rvmsudo Multi-user rvm cleanup fails without rvmsudo Apr 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant