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

May nuke /usr/local #11

Closed
Keith-S-Thompson opened this issue Oct 27, 2019 · 3 comments
Closed

May nuke /usr/local #11

Keith-S-Thompson opened this issue Oct 27, 2019 · 3 comments

Comments

@Keith-S-Thompson
Copy link

Keith-S-Thompson commented Oct 27, 2019

According to a post by the author on comp.lang.ada:

Be careful as the default install directory is /usr/local and things like "make release" will clear that (sudo rm -rf /usr/local/*) before building, installing, and tar'ing up a release. "make -n release | less" will let you see what is happening.

I haven't verified this, but if true this is a serious bug.

@steve-cs
Copy link
Owner

Yes, this is a significant limitation. It turns out the targets that clean $(prefix) are release, bootstrap-clean, and prefix-clean. It would be trivial to remove prefix-clean as an automatic release dependency and hide it in a shell script or YAML file. Would that satisfy your concern? If not, what
might?

Cleaning (clearing) $(prefix) when bootstrapping (i.e. building a release) into $(prefix) is intentional. Currently there are things that break and/or need to be papered over with environment variables if $(prefix) is not /usr/local. The simpler answer (at least currently for me) is to run in a VM.

@Keith-S-Thompson
Copy link
Author

Keith-S-Thompson commented Oct 27, 2019

I wouldn't call this a "limitation". A limitation would be something that it fails to do. This can seriously damage a system. It is practically malware. If I were you, the first thing I would do is commit a change to Makefile so it immediately dies with an error message, pending a fix.

I think I'd recommend not invoking sudo from a Makefile. Instead, for anything that requires root access, check whether the user is running as root and abort if not. Make the user run sudo make ....

I'm not planning to use this, so I don't have any advice on how to make it useful. But it must not delete anything that it doesn't "own".

There are plenty of installation scripts that install things in a given location, defaulting to /usr/local. I've never heard of one that will nuke the entire /usr/local directory tree.

@Keith-S-Thompson
Copy link
Author

I'm curious why this was closed. Was the problem corrected?

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

2 participants