[pacman-dev] [PATCH] trans_release: do not error on STATE_IDLE

Allan McRae allan at archlinux.org
Tue Mar 3 06:36:06 UTC 2015


On 07/04/14 01:10, Andrew Gregory wrote:
> If a transaction were actually in STATE_IDLE, which it should never be,
> the handle would be stuck with a useless transaction and lock file that
> it can't remove.
> 

alpm_trans_release calls alpm_trans_free.  This will have issues if the
transaction is not properly initialised.  So I see this is a case of
"should never happen", but if it does we don't want to continue.  And
the assert is then fine.

Allan

> Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
> ---
>  lib/libalpm/trans.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
> index e5328c5..0c84bb0 100644
> --- a/lib/libalpm/trans.c
> +++ b/lib/libalpm/trans.c
> @@ -222,7 +222,6 @@ int SYMEXPORT alpm_trans_release(alpm_handle_t *handle)
>  
>  	trans = handle->trans;
>  	ASSERT(trans != NULL, RET_ERR(handle, ALPM_ERR_TRANS_NULL, -1));
> -	ASSERT(trans->state != STATE_IDLE, RET_ERR(handle, ALPM_ERR_TRANS_NULL, -1));
>  
>  	int nolock_flag = trans->flags & ALPM_TRANS_FLAG_NOLOCK;
>  
> 


More information about the pacman-dev mailing list