-
Notifications
You must be signed in to change notification settings - Fork 373
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
opam deleted home directory #3316
Comments
Given how much is controlled by env vars, here is the offending logic "patched". camlp5/camlp5@d561693#diff-b67911656ef5d18c4ae36cb6741b7965
If the above env vars are not set, that command decays into Maybe opam shouldn't proceed with any action unless the proper env vars are set, including in subshells? |
Sorry you've been hit by this :( A few things to clarify, though:
opam's starting to use sand-boxing where available to prevent this - there's not a lot opam can do with environment variables here. |
I was in a new shell that afaik didn't have the opam env vars set, I had just done an upgrade of ocaml, opam detected the change and offered to upgrade opam for me. I think if the env vars are not set and/or they are not set in a fresh subshell (for what ever reason), then opam should exit with an informative error. There are only a couple cases where opam should still function with out proper environment variables. |
What are you regarding as "proper" environment variables? The fault here is that camlp5's configure script fails, leaving LIBDIR and DESTDIR unset, as you note above - it's not opam which sets those. |
I am very sorry about this. Due to the issues you mentionned, we have been running to integrate sandboxing as quickly as possible in opam 2.0, and this is the main reason for the rc2 delay (we want to make sure it will work properly for everyone). Support is now in opam's master branch, but not yet in the release.
Unfortunately, to ensure consistency, opam 2 will use the definition it has been using for installation when removing, so
it's not related to opam (would actually happen if compiling camlp5 from the command-line too!), these variables are expected to be set in the package's own Makefile.configure through its Again, sorry, I was hoping we could ship the sandboxing update quickly enough to avoid such disasters. |
The faulty Therefore:
|
True enough, but cold comfort to someone who has just had their system blown away. Perhaps if OPAM notices that an older version of camlp5 is about to be used in the offending manner, even though this is a special case, it should refuse to proceed. |
@AltGr, you say:
Can one then restore 4.06, or does one have to leave it disabled to be safe? If the former, how can one check if one is already safe or not? |
AFAIU. This problem is horrible because basically we can't do anything, if you |
Perhaps an announcement on the caml mailing list and on discuss.ocaml.org with precise diagnosis and mitigation instructions would help then? I only found out about this by accident. |
@pmetzger wrote:
Indeed, my first comment noted my sympathy to the situation. Context matters, please. I was investigating this in detail with @AltGr on Friday. If you downgrade your system compiler back to 4.06.0, do an So, we reckon that the only reliable way to fix this is going to be to push an update to opam 1.2.2 - possibly expressly for macOS (so via homebrew and, if it's also affected, MacPorts). The problem in opam 1.2.2 is that the question to upgrade the system compiler is asked before anything else can possibly process. The first fix will be to defer the "upgrade your system compiler" question when you run My opinion is that the risk of announcing this even more widely before that patch is available is that there will be users who will fail to follow the instructions properly and answer "yes" to the "upgrade your system compiler" question so, especially at the weekend, I think it would be better not to post this to Discuss - what do you think? (and @AltGr, @avsm?) I don't use macOS, but if I did, I'd really want GNU coreutils overriding
(added in GNU coreutils 5.1.0 in November 2003) |
Suggestion: would a shell script to let one check if one is vulnerable, possibly followed by saving the list of installed packages and forcing the removal of the bad switch, and then reinstallation, be feasible? |
Oh, that came through. It may not have been obvious in what I then wrote, written language doesn't convey tone that well. Mostly I'm just encouraging some sort of action to be taken, though I don't know what exactly would work. |
@pmetzger - the script is a good idea (which I'm now working on!). The problem is that if you're affected (so you have the old metadata version of |
Unfortunate. Then again, this whole situation is unfortunate. 🙁🙁🙁 |
that's what opam 2 does, but opam 1.2 didn't enforce separation of I'll edit my post above to remove the mention of running |
Original issue submitter here. I appreciate the amount of discussion all of you have put around this. One outcome is that I no longer run homebrew AND opam (if that is entirely possible) as my main user account, but most people still probably will. Could opam coordinate with the homebrew folks and update or rework the upgrade that homebrew does? As I commented on in 3231#issuecomment-384712118 I did the following steps.
So brew had a window of opportunity to slip a fix in that might have prevented this. |
@nerpderp83 - @avsm has suggested this, too. Although it would fix the problem, I'm not keen on the idea of a package manager invoking All that said, homebrew seems to update about 90 seconds after a release - this problem will be largely eliminated by OCaml 4.07.0's release to homebrew. How long do previous versions hang around in homebrew? |
By
I mean that as anything that could prevent this from happening. Not necessarily run the updater itself.
But won't this still impact folks using earlier version of OCaml and opam? OCaml and opam are separate packages in homebrew. I currently have on a newly configured OSX + Homebrew instance (hours after home dir deletion)
see brew info Is this combination still vulnerable to the issue? If someone (like me) upgrades their OCaml and w/o upgrading opam, and they run opam won't it offer to "rebuild" opam and |
Can this issue be closed, or is there still anything else to do here? It seems to have been forgotten. But I'm just a fellow user (who also had their drive removed, tho I had backups). |
Ugh, it gives a shudder to re-read this issue, but sandboxing has been in place since 2.0, and OPAM 1.2.2 is long-since fully retired, so I think this can be consigned to the part of my brain used for painful memories! |
This issue was previously logged @ #3231 , I am re-submitting here to raise visibility incase it hits anyone else.
If your ocaml compiler version changes, opam will do an
upgrade
and I think if you don't have the opam vars set in the current shell, it will do anrm -rf
from the root of your system.See #3231 (comment)
The text was updated successfully, but these errors were encountered: