[pacman-dev] [PATCH] libalpm: free trans before databases

2020-01-19 Thread morganamilo
When releasing the handle, alpm tries to do some self clean up by
freeing the databases and transaction.

However, databases refuse to unregister is there is an in progress
transaction. Causing them to leak if the handle is released while
a transaction is active.

diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index 1a378db9..02b8fc9b 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -30,6 +30,7 @@
 #include "alpm_list.h"
 #include "handle.h"
 #include "log.h"
+#include "trans.h"
 #include "util.h"
 
 /** \addtogroup alpm_interface Interface Functions
@@ -114,6 +115,8 @@ int SYMEXPORT alpm_release(alpm_handle_t *myhandle)
 
CHECK_HANDLE(myhandle, return -1);
 
+   _alpm_trans_free(myhandle->trans);
+
/* close local database */
db = myhandle->db_local;
if(db) {
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index e3193f40..1e42f4a8 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -34,7 +34,6 @@
 #include "alpm_list.h"
 #include "util.h"
 #include "log.h"
-#include "trans.h"
 #include "alpm.h"
 #include "deps.h"
 
@@ -74,7 +73,6 @@ void _alpm_handle_free(alpm_handle_t *handle)
 #endif
 
/* free memory */
-   _alpm_trans_free(handle->trans);
FREE(handle->root);
FREE(handle->dbpath);
FREE(handle->dbext);
-- 
2.25.0


Re: [pacman-dev] [PATCH] Increase maximum database size

2020-01-19 Thread Eli Schwartz
On 1/19/20 5:04 AM, Allan McRae wrote:
> On 19/1/20 9:42 am, Allan McRae wrote:
>> We previously has the maximum database size as 25MB.  This was set in the 
>> days
>> before repos had as many packages as they do now, and before we started
>> distributing files databases.  Increase this limit to 128MB.
>>
>> Signed-off-by: Allan McRae 
>> ---
>>
>> So this has been hit in the wild.   Manjaro patches their pacman package to
>> allow databases of 32MB, because their [community] repo files database
>> breaks the 25MB limit.   But being Manjaro, the patch was never forwarded
>> upstream, just like everything they have ever done.
>>
>> People in Arch are no better.  A bug was reported, but some idiot (named
>> Antonio Rojas) closed the bug as "not a bug", because it was not an
>> Arch repo running into the issue.
>>
>> So I only discovered this by seeing a closed bug report.
>>
> 
> I'm going to retract my statement there.   Manjaro did report this, in
> the #archlinux-projects channel.  Not the right place, but at least they
> tried.  Reportedly Arch team in there started discussing doing things
> like splitting repos etc to avoid this, rather than reporting or fixing
> the bug.
> 
> So Manjaro did try to help here.  And it turns out I need to extend my
> idiot count to the Arch team members involved in the discussion in the
> #archlinux-projects channel who did not forward the report from Manjaro
> to the right place.

Well, we could stop leaping to assumptions.

Someone very rapidly pointed out:
"i think the best place would be #pacman-dev or the mailinglist, as
thats where the consensus for an upstream change needs to take place"

(followup, in case you're thinking the obvious: "ups, its
#archlinux-pacman")

While it is true that no Arch team members took up the ball on that one,
one could reasonably assume that everyone figured Jonathon from Manjaro
would do so, and never got around to verifying that that happened.
Personally, I'd forgotten about this whole conversation.

-- 
Eli Schwartz
Bug Wrangler and Trusted User



signature.asc
Description: OpenPGP digital signature


Re: [pacman-dev] [PATCH] Increase maximum database size

2020-01-19 Thread Allan McRae
On 19/1/20 9:42 am, Allan McRae wrote:
> We previously has the maximum database size as 25MB.  This was set in the days
> before repos had as many packages as they do now, and before we started
> distributing files databases.  Increase this limit to 128MB.
> 
> Signed-off-by: Allan McRae 
> ---
> 
> So this has been hit in the wild.   Manjaro patches their pacman package to
> allow databases of 32MB, because their [community] repo files database
> breaks the 25MB limit.   But being Manjaro, the patch was never forwarded
> upstream, just like everything they have ever done.
> 
> People in Arch are no better.  A bug was reported, but some idiot (named
> Antonio Rojas) closed the bug as "not a bug", because it was not an
> Arch repo running into the issue.
> 
> So I only discovered this by seeing a closed bug report.
> 

I'm going to retract my statement there.   Manjaro did report this, in
the #archlinux-projects channel.  Not the right place, but at least they
tried.  Reportedly Arch team in there started discussing doing things
like splitting repos etc to avoid this, rather than reporting or fixing
the bug.

So Manjaro did try to help here.  And it turns out I need to extend my
idiot count to the Arch team members involved in the discussion in the
#archlinux-projects channel who did not forward the report from Manjaro
to the right place.

Allan