[pacman-dev] [PATCH 8/9] Allow invalid sync DBs to be returned by the library

Allan McRae allan at archlinux.org
Wed Jun 8 06:12:06 EDT 2011


On 08/06/11 17:51, Dan McGee wrote:
> They are placeholders, but important for things like trying to re-sync a
> database missing a signature. By using the alpm_db_valid() method at the
> right time, a client can take the appropriate action with these invalid
> databases as necessary.
>
> In pacman's case, we disallow just about anything that involves looking
> at a sync database outside of an '-Sy' operation (although we do check
> the validity immediately after). A few operations are still permitted-
> '-Q' ops that don't touch sync databases as well as '-R'.
>
> Signed-off-by: Dan McGee<dan at archlinux.org>
> ---
>   lib/libalpm/be_sync.c |    6 +-----
>   src/pacman/database.c |    2 +-
>   src/pacman/query.c    |    7 ++-----
>   src/pacman/remove.c   |    2 +-

<snip>

> diff --git a/src/pacman/util.c b/src/pacman/util.c
> index 2388e5c..ce305a4 100644
> --- a/src/pacman/util.c
> +++ b/src/pacman/util.c
<snip>
> @@ -100,6 +103,28 @@ int needs_root(void)
>   	}
>   }
>
> +int check_syncdbs(int min_count, int check_valid)

unsigned int min_count?

> +{
> +	alpm_list_t *i, *sync_dbs;
> +	sync_dbs = alpm_option_get_syncdbs(config->handle);
> +	if(sync_dbs == NULL || alpm_list_count(sync_dbs)<  min_count) {

otherwise we are doing a comparison between signed and unsigned integer 
expressions here.

Allan


More information about the pacman-dev mailing list