You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The first problem is solved and working correcting in that the last-env file contains the environment updates which were previously applied to the environment. Previously, opam always used the sameenvironment file both to revert and apply updates, which was what resulted in the effective prohibition of packages using setenv (because after uninstalling a package which had setenv instructions, environment no longer contains the changes from that package, so they can't be reverted).
The second part was solved in the original version of the PR by proposing that the last-env files be stored in /tmp, but we changed this prior to merge. Unfortunately, the change at present breaks/removes the second part of the fix.
The last-env files must at least be stored outside the switch, or the removal of a global switch or removal/moving of a local switch causes the same problem (the fact that moving a local switch probably breaks the switch is not important here - it's still important to be able to revert the old environment). This becomes a serious concern for the MSVC compiler packages, which contain a large number of environment updates.
There are two choices:
As in the original, put the last-env files in /tmp (or equivalent)
This means that one can delete the opam root and still successfully revert previous environment updates
At first glance, that seems utterly niche (not sure anyone beyond opam devs operates with multiple opam roots), but it also hardens the case of rm -rf ~/.opam && opam init which is a more common user "fix" than we wish it was
I'm still kinda keen on 1, perhaps with a fallback to 2 if, for some reason, TMPDIR is not writeable, but the Windows implications mean I think we must do at least 2.
The text was updated successfully, but these errors were encountered:
The original implementation of #5417 addressed two problems:
opam env
does not recalculate all paths correctly when local switch is moved #5423)The first problem is solved and working correcting in that the
last-env
file contains the environment updates which were previously applied to the environment. Previously, opam always used the sameenvironment
file both to revert and apply updates, which was what resulted in the effective prohibition of packages usingsetenv
(because after uninstalling a package which hadsetenv
instructions,environment
no longer contains the changes from that package, so they can't be reverted).The second part was solved in the original version of the PR by proposing that the last-env files be stored in
/tmp
, but we changed this prior to merge. Unfortunately, the change at present breaks/removes the second part of the fix.The last-env files must at least be stored outside the switch, or the removal of a global switch or removal/moving of a local switch causes the same problem (the fact that moving a local switch probably breaks the switch is not important here - it's still important to be able to revert the old environment). This becomes a serious concern for the MSVC compiler packages, which contain a large number of environment updates.
There are two choices:
/tmp
(or equivalent)rm -rf ~/.opam && opam init
which is a more common user "fix" than we wish it was~/.opam/.last-env
opam switch remove foo
run before runningeval $(opam env --revert)
I'm still kinda keen on 1, perhaps with a fallback to 2 if, for some reason, TMPDIR is not writeable, but the Windows implications mean I think we must do at least 2.
The text was updated successfully, but these errors were encountered: