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

opam layout upgrade from 2.2~alpha to 2.2~beta seems to delete empty switches #6049

Open
Khady opened this issue Jun 24, 2024 · 1 comment
Open
Assignees

Comments

@Khady
Copy link
Contributor

Khady commented Jun 24, 2024

I had a switch ahrefs-placeholder created with opam sw create ahrefs-placeholder --empty using an "old" alpha or beta of 2.2 (sorry I can't remember which version exactly). It was fine while using 2.2.0~beta2.

While running opam 2.2.0~rc1 for the first time, I had a warning telling me that my empty switch doesn't exist anymore

[WARNING] Removing global switch 'ahrefs-placeholder' as it no longer exists
This version of opam requires an update to the layout of /home/me/.opam from version 2.2~alpha to version 2.2~beta,
which can't be reverted.

The removal doesn't seem complete though, as if I try to create the switch again I get an error

opam sw create ahrefs-placeholder --empty || true
[ERROR] Directory "/home/me/.opam/ahrefs-placeholder" already exists, please choose a different name

This isn't a big problem as we have this empty repo for legacy reasons and creating it again is simple. But reporting anyway as it seems to be a weird behavior.

@rjbou
Copy link
Collaborator

rjbou commented Jun 24, 2024

Are you able to reproduce? I wasn't able to reproduce locally. Upgrade mechanism is supposed to remove only non well formed switches (missing switch-config file for global registered switches), so it shouldn't delete your empty switches (empty switches have a config file, it's just empty of packages).
If you still have the issue, can you share the content of /home/me/.opam/ahrefs-placeholder and the /home/me/.opam/ahrefs-placeholder/.opam-switch/switch-config if present.

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

3 participants
@Khady @rjbou and others