[PATCH] fix: release transaction lock before unregistering syncdbs

Kevin Morris kevr at 0cost.org
Sat Nov 20 05:09:40 UTC 2021


Signed-off-by: Kevin Morris <kevr at 0cost.org>
---
`alpm_unregister_all_syncdbs` errors out when a transaction is held.
Since this function closes transactions as-is, moving this call below
the transaction unlock step solves issues that `pyalpm` sees when
it cleans up the handle.

 lib/libalpm/alpm.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index 6708e202..1c38feb8 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -107,10 +107,6 @@ int SYMEXPORT alpm_release(alpm_handle_t *myhandle)
 		myhandle->db_local = NULL;
 	}
 
-	if(alpm_unregister_all_syncdbs(myhandle) == -1) {
-		ret = -1;
-	}
-
 #ifdef HAVE_LIBCURL
 	curl_multi_cleanup(myhandle->curlm);
 	curl_global_cleanup();
@@ -118,6 +114,11 @@ int SYMEXPORT alpm_release(alpm_handle_t *myhandle)
 #endif
 
 	_alpm_handle_unlock(myhandle);
+
+	if(alpm_unregister_all_syncdbs(myhandle) == -1) {
+		ret = -1;
+	}
+
 	_alpm_handle_free(myhandle);
 
 	return ret;
-- 
2.34.0



More information about the pacman-dev mailing list