-
Notifications
You must be signed in to change notification settings - Fork 99
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
When uninstalling, the glu agent tries to remove the target of a symlink #304
Comments
Can you provide more descriptions of the problem. I am not sure I understand. |
For instance, I have a package that uses a python virtualenv. Part of the setup for the virtualenv is to create symlinks to system files inside of the virtualenv directory. It is definitely not intended for glu to remove the system files linked to by these symlinks when it uninstalls the package which includes the virtualenv. In general, I think that following symlinks when deleting files is a bug and a violation of the principal of least surprise. On unix, symlinks are generally treated as files unless you explicitly treat them like a directory. For instance, if you do this:
The symlink is removed, as if it is a file in the directory, but the target file is left unchanged. I would argue that this should always be the default when recursively deleting a directory as removing the target of a symlink could affect files outside of the directory. In the case we are running into, if we were (inadvisably) running glu as an inherently privileged user (such as root, or one with a group who had write to system files) then it would have removed system files which were not installed by glu. |
This is a similar case to this: http://glu.977617.n3.nabble.com/Glu-uninstall-follows-symlinks-and-delete-files-outside-of-mountPoint-td4024877.html What is happening is that justin is installing a package that has a lot of symlinks pointing to root owned files (Python's VirtualEnv is doing it). When uninstalling our groovy script is calling There is a case however where if the install step failed, after unpacking the archive with the symlinks, where the console consider (correctly) that the uninstall step should not be called and then the code in RootScript.groovy is calling We can't change the behavior of the package since it is using Python's VirtualEnv which symlinks to OS owned files a lot. This case should be rare yet we would need to have a way to handle it. I propose 2 ways to handle this:
Personally I think symlinks should not be followed on deletes by default since it indeeds differs from the standard *nix behavior but I respect the fact that you might want to preserve existing behavior by default. |
I understand now. It was not obvious what the problem was from the original bug. I do agree that glu should not be deleting the target of symlinks. I am not sure who would be relying on this behavior but I can imagine it would be a non backward compatible change so there should definitely be an option to turn it on/off. |
Removal of the symlink is sufficient and more correct as it follows the conventions of e.g. rm -r.
The text was updated successfully, but these errors were encountered: