ocaml / opam

opam is a source-based package manager. It supports multiple simultaneous compiler installations, flexible package constraints, and a Git-friendly development workflow.
https://opam.ocaml.org
Other
1.21k stars 348 forks source link

import with opam 2.2 of an export file created with 2.1.2 fails #5941

Closed Khady closed 2 months ago

Khady commented 2 months ago
$ opam sw import ./opam-switch-export-20240424-111440.txt --sw=.
Switch initialisation failed: clean up? ('n' will leave the switch partially installed)
[y/n] y
Fatal error:
Invalid_argument("Wrong padding")

The file was generated with

opam switch export --full opam-switch-export-20240424-111440.txt

I'll see if I can share the file without leaking details.

kit-ty-kate commented 2 months ago

I had access to the file and the "Wrong padding" exception here is raised from the base64 library.

There seems to be an incompatibility between the base64 encoder from extlib (< 1.7.8) that was used before and the decoder from the base64 library (that is now used in 2.2 by https://github.com/ocaml/opam/commit/4d8229ef139b8431a10b468ead2f4e7fc5f35f4c). I'm having a deeper look

kit-ty-kate commented 2 months ago

https://github.com/ocaml/opam/pull/5943 should fix this