diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2021-12-12 21:52:29 -0600 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2021-12-13 14:44:02 -0600 |
commit | 72b024f33d9630432e8aad2bf8261051a0df1e41 (patch) | |
tree | 3ff13dffd1a3f93b87f789716bf4c47268a845d9 /src/burn/engine | |
parent | e223ab393bdf04a9c3d0d2144b48a10d7b2650a2 (diff) | |
download | wix-72b024f33d9630432e8aad2bf8261051a0df1e41.tar.gz wix-72b024f33d9630432e8aad2bf8261051a0df1e41.tar.bz2 wix-72b024f33d9630432e8aad2bf8261051a0df1e41.zip |
After rolling back in a non-vital rollback boundary, skip to its end.
Fixes #6309
Diffstat (limited to 'src/burn/engine')
-rw-r--r-- | src/burn/engine/apply.cpp | 73 | ||||
-rw-r--r-- | src/burn/engine/engine.mc | 14 | ||||
-rw-r--r-- | src/burn/engine/plan.cpp | 24 | ||||
-rw-r--r-- | src/burn/engine/plan.h | 3 |
4 files changed, 84 insertions, 30 deletions
diff --git a/src/burn/engine/apply.cpp b/src/burn/engine/apply.cpp index 283c0ada..0467132e 100644 --- a/src/burn/engine/apply.cpp +++ b/src/burn/engine/apply.cpp | |||
@@ -191,7 +191,6 @@ static HRESULT DoExecuteAction( | |||
191 | __in BURN_ENGINE_STATE* pEngineState, | 191 | __in BURN_ENGINE_STATE* pEngineState, |
192 | __in BURN_EXECUTE_ACTION* pExecuteAction, | 192 | __in BURN_EXECUTE_ACTION* pExecuteAction, |
193 | __in BURN_EXECUTE_CONTEXT* pContext, | 193 | __in BURN_EXECUTE_CONTEXT* pContext, |
194 | __inout BURN_ROLLBACK_BOUNDARY** ppRollbackBoundary, | ||
195 | __inout BURN_EXECUTE_ACTION_CHECKPOINT** ppCheckpoint, | 194 | __inout BURN_EXECUTE_ACTION_CHECKPOINT** ppCheckpoint, |
196 | __out BOOL* pfSuspend, | 195 | __out BOOL* pfSuspend, |
197 | __out BOOTSTRAPPER_APPLY_RESTART* pRestart | 196 | __out BOOTSTRAPPER_APPLY_RESTART* pRestart |
@@ -657,8 +656,7 @@ extern "C" HRESULT ApplyExecute( | |||
657 | HRESULT hrRollback = S_OK; | 656 | HRESULT hrRollback = S_OK; |
658 | BURN_EXECUTE_ACTION_CHECKPOINT* pCheckpoint = NULL; | 657 | BURN_EXECUTE_ACTION_CHECKPOINT* pCheckpoint = NULL; |
659 | BURN_EXECUTE_CONTEXT context = { }; | 658 | BURN_EXECUTE_CONTEXT context = { }; |
660 | BURN_ROLLBACK_BOUNDARY* pRollbackBoundary = NULL; | 659 | BOOL fSeekRollbackBoundaryEnd = FALSE; |
661 | BOOL fSeekNextRollbackBoundary = FALSE; | ||
662 | 660 | ||
663 | context.pCache = pEngineState->plan.pCache; | 661 | context.pCache = pEngineState->plan.pCache; |
664 | context.pUX = &pEngineState->userExperience; | 662 | context.pUX = &pEngineState->userExperience; |
@@ -680,21 +678,41 @@ extern "C" HRESULT ApplyExecute( | |||
680 | continue; | 678 | continue; |
681 | } | 679 | } |
682 | 680 | ||
683 | // If we are seeking the next rollback boundary, skip if this action wasn't it. | 681 | // If we are seeking the end of the rollback boundary, skip if this action wasn't it. |
684 | if (fSeekNextRollbackBoundary) | 682 | if (fSeekRollbackBoundaryEnd) |
685 | { | 683 | { |
686 | if (BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY == pExecuteAction->type) | 684 | if (BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY_END != pExecuteAction->type) |
687 | { | 685 | { |
686 | LPCWSTR wzId = NULL; | ||
687 | switch (pExecuteAction->type) | ||
688 | { | ||
689 | case BURN_EXECUTE_ACTION_TYPE_EXE_PACKAGE: | ||
690 | wzId = pExecuteAction->exePackage.pPackage->sczId; | ||
691 | break; | ||
692 | case BURN_EXECUTE_ACTION_TYPE_MSI_PACKAGE: | ||
693 | wzId = pExecuteAction->msiPackage.pPackage->sczId; | ||
694 | break; | ||
695 | case BURN_EXECUTE_ACTION_TYPE_MSP_TARGET: | ||
696 | wzId = pExecuteAction->mspTarget.pPackage->sczId; | ||
697 | break; | ||
698 | case BURN_EXECUTE_ACTION_TYPE_MSU_PACKAGE: | ||
699 | wzId = pExecuteAction->msuPackage.pPackage->sczId; | ||
700 | break; | ||
701 | } | ||
702 | |||
703 | if (wzId) | ||
704 | { | ||
705 | LogId(REPORT_WARNING, MSG_APPLY_SKIPPING_NONVITAL_ROLLBACK_BOUNDARY_PACKAGE, wzId); | ||
706 | } | ||
707 | |||
688 | continue; | 708 | continue; |
689 | } | 709 | } |
690 | else | 710 | |
691 | { | 711 | fSeekRollbackBoundaryEnd = FALSE; |
692 | fSeekNextRollbackBoundary = FALSE; | ||
693 | } | ||
694 | } | 712 | } |
695 | 713 | ||
696 | // Execute the action. | 714 | // Execute the action. |
697 | hr = DoExecuteAction(pEngineState, pExecuteAction, &context, &pRollbackBoundary, &pCheckpoint, pfSuspend, pRestart); | 715 | hr = DoExecuteAction(pEngineState, pExecuteAction, &context, &pCheckpoint, pfSuspend, pRestart); |
698 | 716 | ||
699 | if (*pfSuspend || BOOTSTRAPPER_APPLY_RESTART_INITIATED == *pRestart) | 717 | if (*pfSuspend || BOOTSTRAPPER_APPLY_RESTART_INITIATED == *pRestart) |
700 | { | 718 | { |
@@ -737,19 +755,24 @@ extern "C" HRESULT ApplyExecute( | |||
737 | 755 | ||
738 | hrRollback = DoRollbackActions(pEngineState, &context, pCheckpoint->dwId, pRestart); | 756 | hrRollback = DoRollbackActions(pEngineState, &context, pCheckpoint->dwId, pRestart); |
739 | IgnoreRollbackError(hrRollback, "Failed rollback actions"); | 757 | IgnoreRollbackError(hrRollback, "Failed rollback actions"); |
740 | } | ||
741 | 758 | ||
742 | // If the rollback boundary is vital, end execution here. | 759 | if (pCheckpoint->pActiveRollbackBoundary) |
743 | if (pRollbackBoundary && pRollbackBoundary->fVital) | 760 | { |
744 | { | 761 | if (pCheckpoint->pActiveRollbackBoundary->fVital) |
745 | break; | 762 | { |
763 | // If the rollback boundary is vital, end execution here. | ||
764 | break; | ||
765 | } | ||
766 | |||
767 | // Move forward to the end of this rollback boundary. | ||
768 | fSeekRollbackBoundaryEnd = TRUE; | ||
769 | |||
770 | LogId(REPORT_WARNING, MSG_APPLY_SKIPPING_REST_OF_NONVITAL_ROLLBACK_BOUNDARY, pCheckpoint->pActiveRollbackBoundary->sczId); | ||
771 | } | ||
746 | } | 772 | } |
747 | 773 | ||
748 | // Ignore failure inside of a non-vital rollback boundary. | 774 | // Ignore failure outside of a vital rollback boundary. |
749 | hr = S_OK; | 775 | hr = S_OK; |
750 | |||
751 | // Move forward to next rollback boundary. | ||
752 | fSeekNextRollbackBoundary = TRUE; | ||
753 | } | 776 | } |
754 | } | 777 | } |
755 | 778 | ||
@@ -2207,7 +2230,6 @@ static HRESULT DoExecuteAction( | |||
2207 | __in BURN_ENGINE_STATE* pEngineState, | 2230 | __in BURN_ENGINE_STATE* pEngineState, |
2208 | __in BURN_EXECUTE_ACTION* pExecuteAction, | 2231 | __in BURN_EXECUTE_ACTION* pExecuteAction, |
2209 | __in BURN_EXECUTE_CONTEXT* pContext, | 2232 | __in BURN_EXECUTE_CONTEXT* pContext, |
2210 | __inout BURN_ROLLBACK_BOUNDARY** ppRollbackBoundary, | ||
2211 | __inout BURN_EXECUTE_ACTION_CHECKPOINT** ppCheckpoint, | 2233 | __inout BURN_EXECUTE_ACTION_CHECKPOINT** ppCheckpoint, |
2212 | __out BOOL* pfSuspend, | 2234 | __out BOOL* pfSuspend, |
2213 | __out BOOTSTRAPPER_APPLY_RESTART* pRestart | 2235 | __out BOOTSTRAPPER_APPLY_RESTART* pRestart |
@@ -2226,7 +2248,7 @@ static HRESULT DoExecuteAction( | |||
2226 | 2248 | ||
2227 | do | 2249 | do |
2228 | { | 2250 | { |
2229 | fInsideMsiTransaction = *ppRollbackBoundary && (*ppRollbackBoundary)->fActiveTransaction; | 2251 | fInsideMsiTransaction = *ppCheckpoint && (*ppCheckpoint)->pActiveRollbackBoundary && (*ppCheckpoint)->pActiveRollbackBoundary->fActiveTransaction; |
2230 | 2252 | ||
2231 | switch (pExecuteAction->type) | 2253 | switch (pExecuteAction->type) |
2232 | { | 2254 | { |
@@ -2296,8 +2318,9 @@ static HRESULT DoExecuteAction( | |||
2296 | 2318 | ||
2297 | break; | 2319 | break; |
2298 | 2320 | ||
2299 | case BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY: | 2321 | case BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY_START: __fallthrough; |
2300 | *ppRollbackBoundary = pExecuteAction->rollbackBoundary.pRollbackBoundary; | 2322 | case BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY_END: |
2323 | *ppCheckpoint = NULL; | ||
2301 | break; | 2324 | break; |
2302 | 2325 | ||
2303 | case BURN_EXECUTE_ACTION_TYPE_BEGIN_MSI_TRANSACTION: | 2326 | case BURN_EXECUTE_ACTION_TYPE_BEGIN_MSI_TRANSACTION: |
@@ -2406,7 +2429,7 @@ static HRESULT DoRollbackActions( | |||
2406 | IgnoreRollbackError(hr, "Failed to rollback dependency action."); | 2429 | IgnoreRollbackError(hr, "Failed to rollback dependency action."); |
2407 | break; | 2430 | break; |
2408 | 2431 | ||
2409 | case BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY: | 2432 | case BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY_START: |
2410 | ExitFunction1(hr = S_OK); | 2433 | ExitFunction1(hr = S_OK); |
2411 | 2434 | ||
2412 | case BURN_EXECUTE_ACTION_TYPE_UNCACHE_PACKAGE: | 2435 | case BURN_EXECUTE_ACTION_TYPE_UNCACHE_PACKAGE: |
diff --git a/src/burn/engine/engine.mc b/src/burn/engine/engine.mc index dcd18074..b9267593 100644 --- a/src/burn/engine/engine.mc +++ b/src/burn/engine/engine.mc | |||
@@ -991,6 +991,20 @@ Language=English | |||
991 | Illegal state: Reboot requested within an MSI transaction, id: %1!ls! | 991 | Illegal state: Reboot requested within an MSI transaction, id: %1!ls! |
992 | . | 992 | . |
993 | 993 | ||
994 | MessageId=388 | ||
995 | Severity=Warning | ||
996 | SymbolicName=MSG_APPLY_SKIPPING_NONVITAL_ROLLBACK_BOUNDARY_PACKAGE | ||
997 | Language=English | ||
998 | Skipping package inside non-vital rollback boundary, id: %1!ls! | ||
999 | . | ||
1000 | |||
1001 | MessageId=389 | ||
1002 | Severity=Warning | ||
1003 | SymbolicName=MSG_APPLY_SKIPPING_REST_OF_NONVITAL_ROLLBACK_BOUNDARY | ||
1004 | Language=English | ||
1005 | Skipping the rest of non-vital rollback boundary, id: %1!ls! | ||
1006 | . | ||
1007 | |||
994 | MessageId=399 | 1008 | MessageId=399 |
995 | Severity=Success | 1009 | Severity=Success |
996 | SymbolicName=MSG_APPLY_COMPLETE | 1010 | SymbolicName=MSG_APPLY_COMPLETE |
diff --git a/src/burn/engine/plan.cpp b/src/burn/engine/plan.cpp index 5aad8c9b..0f63a945 100644 --- a/src/burn/engine/plan.cpp +++ b/src/burn/engine/plan.cpp | |||
@@ -1724,14 +1724,14 @@ extern "C" HRESULT PlanRollbackBoundaryBegin( | |||
1724 | hr = PlanAppendExecuteAction(pPlan, &pExecuteAction); | 1724 | hr = PlanAppendExecuteAction(pPlan, &pExecuteAction); |
1725 | ExitOnFailure(hr, "Failed to append rollback boundary begin action."); | 1725 | ExitOnFailure(hr, "Failed to append rollback boundary begin action."); |
1726 | 1726 | ||
1727 | pExecuteAction->type = BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY; | 1727 | pExecuteAction->type = BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY_START; |
1728 | pExecuteAction->rollbackBoundary.pRollbackBoundary = pRollbackBoundary; | 1728 | pExecuteAction->rollbackBoundary.pRollbackBoundary = pRollbackBoundary; |
1729 | 1729 | ||
1730 | // Add begin rollback boundary to rollback plan. | 1730 | // Add begin rollback boundary to rollback plan. |
1731 | hr = PlanAppendRollbackAction(pPlan, &pExecuteAction); | 1731 | hr = PlanAppendRollbackAction(pPlan, &pExecuteAction); |
1732 | ExitOnFailure(hr, "Failed to append rollback boundary begin action."); | 1732 | ExitOnFailure(hr, "Failed to append rollback boundary begin action."); |
1733 | 1733 | ||
1734 | pExecuteAction->type = BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY; | 1734 | pExecuteAction->type = BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY_START; |
1735 | pExecuteAction->rollbackBoundary.pRollbackBoundary = pRollbackBoundary; | 1735 | pExecuteAction->rollbackBoundary.pRollbackBoundary = pRollbackBoundary; |
1736 | 1736 | ||
1737 | hr = UserExperienceOnPlanRollbackBoundary(pUX, pRollbackBoundary->sczId, &pRollbackBoundary->fTransaction); | 1737 | hr = UserExperienceOnPlanRollbackBoundary(pUX, pRollbackBoundary->sczId, &pRollbackBoundary->fTransaction); |
@@ -1786,6 +1786,18 @@ extern "C" HRESULT PlanRollbackBoundaryComplete( | |||
1786 | // Add checkpoints. | 1786 | // Add checkpoints. |
1787 | hr = PlanExecuteCheckpoint(pPlan); | 1787 | hr = PlanExecuteCheckpoint(pPlan); |
1788 | 1788 | ||
1789 | // Add complete rollback boundary to execute plan. | ||
1790 | hr = PlanAppendExecuteAction(pPlan, &pExecuteAction); | ||
1791 | ExitOnFailure(hr, "Failed to append rollback boundary complete action."); | ||
1792 | |||
1793 | pExecuteAction->type = BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY_END; | ||
1794 | |||
1795 | // Add begin rollback boundary to rollback plan. | ||
1796 | hr = PlanAppendRollbackAction(pPlan, &pExecuteAction); | ||
1797 | ExitOnFailure(hr, "Failed to append rollback boundary complete action."); | ||
1798 | |||
1799 | pExecuteAction->type = BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY_END; | ||
1800 | |||
1789 | LExit: | 1801 | LExit: |
1790 | return hr; | 1802 | return hr; |
1791 | } | 1803 | } |
@@ -2616,8 +2628,12 @@ static void ExecuteActionLog( | |||
2616 | LogStringLine(PlanDumpLevel, "%ls action[%u]: MSU_PACKAGE package id: %ls, action: %hs, log path: %ls", wzBase, iAction, pAction->msuPackage.pPackage->sczId, LoggingActionStateToString(pAction->msuPackage.action), pAction->msuPackage.sczLogPath); | 2628 | LogStringLine(PlanDumpLevel, "%ls action[%u]: MSU_PACKAGE package id: %ls, action: %hs, log path: %ls", wzBase, iAction, pAction->msuPackage.pPackage->sczId, LoggingActionStateToString(pAction->msuPackage.action), pAction->msuPackage.sczLogPath); |
2617 | break; | 2629 | break; |
2618 | 2630 | ||
2619 | case BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY: | 2631 | case BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY_START: |
2620 | LogStringLine(PlanDumpLevel, "%ls action[%u]: ROLLBACK_BOUNDARY id: %ls, vital: %ls", wzBase, iAction, pAction->rollbackBoundary.pRollbackBoundary->sczId, pAction->rollbackBoundary.pRollbackBoundary->fVital ? L"yes" : L"no"); | 2632 | LogStringLine(PlanDumpLevel, "%ls action[%u]: ROLLBACK_BOUNDARY_START id: %ls, vital: %ls", wzBase, iAction, pAction->rollbackBoundary.pRollbackBoundary->sczId, pAction->rollbackBoundary.pRollbackBoundary->fVital ? L"yes" : L"no"); |
2633 | break; | ||
2634 | |||
2635 | case BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY_END: | ||
2636 | LogStringLine(PlanDumpLevel, "%ls action[%u]: ROLLBACK_BOUNDARY_END", wzBase, iAction); | ||
2621 | break; | 2637 | break; |
2622 | 2638 | ||
2623 | case BURN_EXECUTE_ACTION_TYPE_WAIT_CACHE_PACKAGE: | 2639 | case BURN_EXECUTE_ACTION_TYPE_WAIT_CACHE_PACKAGE: |
diff --git a/src/burn/engine/plan.h b/src/burn/engine/plan.h index b4348cc4..f0560e6e 100644 --- a/src/burn/engine/plan.h +++ b/src/burn/engine/plan.h | |||
@@ -56,7 +56,8 @@ enum BURN_EXECUTE_ACTION_TYPE | |||
56 | BURN_EXECUTE_ACTION_TYPE_MSU_PACKAGE, | 56 | BURN_EXECUTE_ACTION_TYPE_MSU_PACKAGE, |
57 | BURN_EXECUTE_ACTION_TYPE_PACKAGE_PROVIDER, | 57 | BURN_EXECUTE_ACTION_TYPE_PACKAGE_PROVIDER, |
58 | BURN_EXECUTE_ACTION_TYPE_PACKAGE_DEPENDENCY, | 58 | BURN_EXECUTE_ACTION_TYPE_PACKAGE_DEPENDENCY, |
59 | BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY, | 59 | BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY_START, |
60 | BURN_EXECUTE_ACTION_TYPE_ROLLBACK_BOUNDARY_END, | ||
60 | BURN_EXECUTE_ACTION_TYPE_BEGIN_MSI_TRANSACTION, | 61 | BURN_EXECUTE_ACTION_TYPE_BEGIN_MSI_TRANSACTION, |
61 | BURN_EXECUTE_ACTION_TYPE_COMMIT_MSI_TRANSACTION, | 62 | BURN_EXECUTE_ACTION_TYPE_COMMIT_MSI_TRANSACTION, |
62 | }; | 63 | }; |