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

Bundle is not registered in ARP during install if bundle is already cached #5702

Open
0ptikGhost opened this Issue Oct 13, 2017 · 0 comments

Comments

Projects
None yet
2 participants
@0ptikGhost

0ptikGhost commented Oct 13, 2017

  • Which version of WiX are you building with?

WiX Toolset v3.9.1208.0

  • Which version of Visual Studio are you building with (if any)?

Microsoft Visual Studio Premium 2012 Version 11.0.6129.00 Update 5

  • Which version of the WiX Toolset Visual Studio Extension are you building with (if any)?

Windows Installer XML Toolset version 3.9.1208.0

  • Which version of .NET are you building with?

Microsoft .NET Framework, version 4.0.30319.42000

  • If the problem occurs when installing your packages built with WiX, what is the version of Windows the package is running on?

Windows Server 2008 R2 Standard

  • Describe the problem and the steps to reproduce it.

A bundle will fail to register itself in ARP during an install if the bundle is already cached.

Steps to Reproduce:
1.) Build a minimal bundle that installs a minimal MSI.
2.) Install this bundle and determine the location where the bundle is cached. For example,
C:\ProgramData\Package Cache{051c0bac-c782-49dd-a0c8-9cbd649eb59f}\setup.exe
3.) Backup the cached bundle. For example,
robocpopy /mir C:\ProgramData\Package Cache{051c0bac-c782-49dd-a0c8-9cbd649eb59f} C:\ProgramData\Package Cache{051c0bac-c782-49dd-a0c8-9cbd649eb59f}.bak
4.) Uninstall the bundle.
5.) Restore bundle cache from backup. For example,
robocpopy /mir C:\ProgramData\Package Cache{051c0bac-c782-49dd-a0c8-9cbd649eb59f}.bak C:\ProgramData\Package Cache{051c0bac-c782-49dd-a0c8-9cbd649eb59f}
6.) Install bundle again.

After step 6, the bundle will fail to appear in ARP.

If the GUID used in the package cache is known ahead of time, then the steps to reproduce can be reduced to:
1.) Create zero-byte file at cache location. For example,
copy nul C:\ProgramData\Package Cache{051c0bac-c782-49dd-a0c8-9cbd649eb59f}\setup.exe
2.) Install bundle

After step 2, the bundle will fail to appear in ARP.

  • Describe the behavior you expected and how it differed from the actual behavior.

The burn engine really cannot trust the cached bundle to be correct unless it is already running from that cached location. Today, the decision to cache and/or register the bundle for pPlan->action != BOOTSTRAPPER_ACTION_UNINSTALL occurs in src/burn/engine/plan.cpp lines 690 - 703. When action is BOOTSTRAPPER_ACTION_INSTALL the bundle is only cached/registered if the bundle is not cached.

At a minimum, the bundle should be registered on BOOTSTRAPPER_ACTION_INSTALL even if it is already cached. The bundle probably should be registered and cached on BOOTSTRAPPER_ACTION_INSTALL if it is not already running from cache.

Proposed Code:

        if (!FileExistsAfterRestart(pRegistration->sczCacheExecutablePath, NULL))
        {
            pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE;
            pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION;
        }
        else if (BOOTSTRAPPER_ACTION_INSTALL == pPlan->action && !CacheBundleRunningFromCache()) // installing but not not running from the cache.
        {
            pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE;
            pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION;
        }
        else if (BOOTSTRAPPER_ACTION_INSTALL == pPlan->action) // installing, make sure the bundle is registered.
        {
            pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION;
        }
        else if (BOOTSTRAPPER_ACTION_REPAIR == pPlan->action && !CacheBundleRunningFromCache()) // repairing but not not running from the cache.
        {
            pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE;
            pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION;
        }
        else if (BOOTSTRAPPER_ACTION_REPAIR == pPlan->action) // just repair, make sure the registration is "fixed up".
        {
            pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION;
        }

@barnson barnson added this to the v4.0 milestone Oct 26, 2017

@barnson barnson added bug burn labels Oct 26, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment