-
Notifications
You must be signed in to change notification settings - Fork 370
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
handling setenv field at package removal #3181
Comments
I recently stumbled on this aswell, in the following context: If you reinstall However, the problem is that if you did an It is not really possible for opam to undo the In this this message @AltGr mentioned that in the future opam commands may run in cleaned up environments. With the advent of This would mean to explicitly manage environment variables per opam switch and add However it could become painful to setup new switches (e.g. how to setup
|
@dbuenzli, That's another excellent problem, and I'd suggest it would make a good issue to report separate from your comment here. In my case, I just noticed that removing a package with a What am I doing? I have a package, called |
Are you sure you don't simply see the inability to undo environment updates once you For example:
Now of course if I |
Not entirely true: opam will attempt to revert the changes, as far as possible ; same as it does when you switch over to another switch and run
So @jhwoodyatt is actually right. However, the issue is difficult to solve: what opam does is, at time This could advise the proper Another solution would be to store the changes done by opam to the environment, in the environment itself, in some format. That would allow accurate selection of what to revert, if we can find a proper encoding, at the cost of a maybe very large environment variable (at the moment, @dbuenzli: yes, I'm definitely planning some "sanitized environment" feature for an upcoming version (not yet in 2.0.0). I'll keep your comment in mind when I design that. For the reference, stacked ¹I'm looking at you, |
After some thought, I think that encoding the environment changes within the environment itself is the only way to keep some kind of consistency, so maybe it's the way we should go before making the rest more complicated than necessary. This would make So, to be more explicit, the idea would be that the
be encoded into a specific variable, that we read and revert before applying any new changes. What we currently do instead is read the appropriate |
Personally I would rather call it a day on Isolating builds from the user environment (modulo snapshooting) seems a better strategy in the long term, especially for adding a potential build cache to |
@dbuenzli, yep... if I remove my omake-env package, the environment persists in the shell even after |
This should be fully addressed in opam 2.2 by #5417 - please do re-open if that turns out to be incorrect. |
In 2.0.0~beta6, it seems that removing a package with a setenv field should entail use of eval $(opam env) to remove the environment updates that were previously applied by the install. I'm not seeing this in my experimentation.
The text was updated successfully, but these errors were encountered: