From ca3f5b37895780e34ec823adaa1281ff0dd2a5ca Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Mar 22 2021 14:31:19 +0000 Subject: Properly disable SWDB in any transactional update mode In 494a179a92ae5b047b1d641f5b2de5e832c4e792, the SWDB disabler logic was moved up from before the transactional_update flag was set, which broke regular transactional updates. To fix this, we will just call the disabler twice, depending on the condition. --- diff --git a/src/txnupd.cpp b/src/txnupd.cpp index a6da1db..669c92f 100644 --- a/src/txnupd.cpp +++ b/src/txnupd.cpp @@ -115,20 +115,14 @@ static bool setupTransactionalUpdate(PluginHandle * handle) { return true; } - /* Disable SWDB when in transactional update mode, as it - * it currently causes crashes with transactional updates, - * and it is not particularly useful for our case anyway. - */ - if ((handle->transactional_update) || (handle->ext_transactional_update)) { - dnf_context_set_write_history(handle->context, FALSE); - } - /* Check if we're already in a transactional update, possibly * externally invoked by tukit or some other consumer of tukit. * In this scenario, bail early to stop us from attempting to * create a transactional update inside of one in progress. */ if (handle->ext_transactional_update) { + // Disable SWDB in transactional update mode + dnf_context_set_write_history(handle->context, FALSE); auto txnupdsnap_msg = std::string(info.name) + ": " + __func__ + ": Warning: running within transactional update, disabling snapshot handling!"; logger->warning(txnupdsnap_msg); @@ -157,6 +151,12 @@ static bool setupTransactionalUpdate(PluginHandle * handle) { auto transactionRoot = handle->transaction.getRoot(); dnf_context_set_install_root(handle->context, transactionRoot.c_str()); + /* Disable SWDB when in transactional update mode, as it + * it currently causes crashes with transactional updates, + * and it is not particularly useful for our case anyway. + */ + dnf_context_set_write_history(handle->context, FALSE); + /* Mark as being in the transactional update mode, so that * other functions using the handle can do the right thing later. */