Thoughts regarding uninstall
wjk opened this issue · comments
In the above code snippet, there is made mention of attempting to modify the MSI database in-situ during the install. I have never seen anyone try this before. I do not think what you are doing is a supported practice. The snippet mentions problems committing the changes to the database. I am pretty certain given the symptoms listed that Windows holds a lock on the MSI file being installed that prevents it from being modified during the installation.
There is another method, however. Custom actions can be run on uninstall as well. We could create a second MSI custom action function in the same DLL that does the same path lookup but deletes files instead of copying them. I could submit a PR for this myself, but since I would have to build Swift from source, it may take me a while to get into the state where I can work on this issue directly.
Yes, it is unsupported, and I don't think it can work given the lock. Interesting idea with the uninstall CA. How would we track the installed module maps though? I'm still holding out hope to support a multi-versioned installation so we can have more than one installed toolchain, so we could not remove the module maps until the last uninstall occurs.
How would we track the installed module maps though?
Unfortunately, on that one I have no clue.
I don't want to suggest this (because having more people building the toolchain helps clean up issues that I've become blind to), but you could grab the artifacts from https://github.com/compnerd/swift-build/actions/runs/3776707293 and only run the packaging stage.
Now that we no longer actually install the module maps into the VS installation, the next problem is the removal of the existing ones.
@wjk - I was wondering if you still have any thoughts about this. I feel like we should just cut our losses and say that we won't be able to clean up old installs 😞. There are so many improvements that we have made since the original installer that I am not sure if we can do much here.
@compnerd Yeah, I agree. 😔 My idea was to use the same logic that copied the maps in to delete them, but since that’s long gone I can’t think of anything good to do here either. Would having old versions on the filesystem cause problems?
Nope, nothing outside of the extreme amount of discomfort that the image is no longer "clean".