wixtoolset / issues

WiX Toolset Issues Tracker
http://wixtoolset.org/
129 stars 36 forks source link

ExePackage is being rolled back even when it was not installed #7335

Open icnocop opened 1 year ago

icnocop commented 1 year ago

Bugs

If an ExePackage installation fails, the bundle will still try to rollback the ExePackage by running UninstallArguments. However, since the installation fails, there's nothing to rollback.

For example, if the ExePackage has a UI and the user cancels the ExePackage from installing, the bundle will start to perform a rollback. As part of the rollback, the ExePackage will be run again with UninstallArguments. If the ExePackage displays its UI again, the user has to now cancel/close the ExePackage again.

<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
     xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"
     xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">

    <Bundle
        Name="Name"
        Version="1.0.0.0"
        Manufacturer="Manufacturer"
        UpgradeCode="828AA222-7292-412E-A266-A26FAD74C490">
        <BootstrapperApplication>
            <bal:WixStandardBootstrapperApplication
                Theme="hyperlinkSidebarLicense"
                LicenseUrl=""
                SuppressOptionsUI="yes"
                ShowVersion="yes" />
        </BootstrapperApplication>

        <util:ProductSearch
            UpgradeCode="0808A4DE-4BDA-4CBA-B4DF-D0397E800952}
            Variable="ExePackage1Installed" />

        <Chain>

            <ExePackage
                Id="ExePackage1"
                DisplayName="DisplayName"
                Vital="yes"
                Permanent="no"
                InstallCondition="(VersionNT64)"
                DetectCondition="(VersionNT64) AND (ExePackage1Installed >= v1.0.0.0)"
                SourceFile="Setup.exe"
                Compressed="yes"
                InstallArguments="/i"
                RepairArguments="/e"
                UninstallArguments="/x"
                PerMachine="yes" />

        </Chain>
    </Bundle>
</Wix>

I did not expect the ExePackage to rollback because the ExePackage was not installed.

For example, the ExePackage may also have its own rollback mechanism.

Maybe the DetectCondition should be re-evaluated to determine if the ExePackage was successfully installed or not. For example, if the ExePackage returned an exit code which indicates an install failure and DetectCondition re-evaluates to false, then a rollback should not be performed.

Another option could be to dd a DisableRollback attribute to the ExePackage which can be set to yes for example which indicates to not rollback the ExePackage in case of a failure.

Thank you.

rseanhall commented 1 year ago

This was the behavior requested in https://github.com/wixtoolset/issues/issues/5950. I believe the correct way to address this is to change the ExePackage so it does not require user interaction when uninstalling.

Re-evaluating the DetectCondition would require going through the whole Detect cycle. We thought that doing that during Apply was not the right thing to do.

Permanent packages are never rolled back. I don't see us adding any other way to preventing rollback. I guess we could add the ability to disable rollback on a package only in this specific case when its failure caused the bundle to rollback but I don't know if that's a good idea.

barnson commented 1 year ago

We should not optimize for cases that involve user interactivity in the middle of a chain (execution or rollback).

barnson commented 1 year ago

This is the WiX v4 behavior. We could discuss changing that behavior in WiX v5 but as Sean points out, it's problematic.