diskuv / dkml-installer-ocaml

The Windows-friendly distribution of OCaml
Apache License 2.0
62 stars 2 forks source link

Installer is not resilient to past partial installations #36

Closed ysalmon closed 1 year ago

ysalmon commented 1 year ago

Hello, I am trying to install diskuv OCaml 1.2.0 on Windows 10.

At some point it failed because the Git installer was, it says, corrupted. So I tried again, and I no longer have that error message, but the installer keeps failing on not being able to rename temp files into files under DiskuvOCaml/bin and tools.

And this seems to be just because those file are already present, from a previous installation attempt.

The installer should imo be more aggressive in overwriting those files.

jonahbeckford commented 1 year ago

Yep.

jonahbeckford commented 1 year ago

There is an uninstaller by the way. You can run that after a partial attempt to do the cleanup.

But it should be automatic.

ysalmon commented 1 year ago

Yes, but that is a problem : the installation procedure is complex, and thus has many occasions to fail at some point, and very long, so it is sad to have to restart from zero after a failure. It would be so much better is the installer was somehow "reentrant", in the sense that each step would be idempotent.

For example, after compiling for almost an hour, there was a failure in create-opam-switch.sh because rsync failed (why? no idea ; I retried the command manually and it worked). I cannot restart the installation from the point where it failed, I have to redo everything.

jonahbeckford commented 1 year ago

By the way, almost everything has been designed for idempotency. That is why you were able to install Git for Windows and it didn't try to re-install it. create-opam-switch.sh in particular is idempotent. create-opam-switch.sh is called by dkml init that not only creates a local switch but upgrades existing local switches; that wouldn't be possible if it weren't idempotent. But that is different from saying that I've exposed a way in the installer for you to restart from various points in the installer. There is a way however:

  1. Keep the installer window open so that the temporary working directory is available
  2. Go to the temporary working directory (it will be the latest $TEMP/7z* folder). In your other issue it was C:\Users\yann\AppData\Local\Temp\7zC98A7834
  3. Your error will show the command that you can run (ex. C:\Users\yann\AppData\Local\Temp\7zC98A7834\sg\network-ocamlcompiler\windows_x86_64\setup-userprofile.bat -AllowRunAsAdmin ...).
  4. Run that command but add the -IncrementalDeployment option

I used to use the -IncrementalDeployment option heavily, but it is no longer tested because downloading has become quite reliable even from slow virtual machines and Windows sandboxes. The only true network problem I've seen in a while (outside of your issue) is going through the Great Firewall.

jonahbeckford commented 1 year ago

Re-opening. Not sure why GitHub automatically closed the ticket.

Status: Currently the fix is being tested.

jonahbeckford commented 1 year ago

A fix for this is available at https://github.com/diskuv/dkml-installer-ocaml/releases/tag/v1.2.1-prerel1

jonahbeckford commented 1 year ago

Closing for inactivity.