[pacman-dev] [PATCH 1/2] User-visible log when validity check fails due to access

Allan McRae allan at archlinux.org
Wed Sep 19 00:53:22 UTC 2018


On 10/9/18 10:59 am, David Phillips wrote:
> Currently, if checking the validity of packages fails due to an access
> error on one or more packages, the user must sift through debug output
> in order to find the culprit package(s). This patch adds a call to
> _alpm_log in such a case to make the culprits more easily visible.
> ---
>  lib/libalpm/sync.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
> index 696a5131..85f70200 100644
> --- a/lib/libalpm/sync.c
> +++ b/lib/libalpm/sync.c
> @@ -1187,6 +1187,10 @@ static int check_validity(alpm_handle_t *handle,
>  				prompt_to_delete(handle, v->path, v->error);
>  			} else if(v->error == ALPM_ERR_PKG_INVALID_CHECKSUM) {
>  				prompt_to_delete(handle, v->path, v->error);
> +			} else if(v->error == ALPM_ERR_PKG_NOT_FOUND ||
> +			          v->error == ALPM_ERR_BADPERMS ||
> +			          v->error == ALPM_ERR_PKG_OPEN) {
> +				_alpm_log(handle, ALPM_LOG_ERROR, _("error while reading file %s: %s\n"), v->path, alpm_strerror(v->error));

This will print:

error: error while reading

How about "failed to read file %s: %s\n"?


You will also need to rebase your switch statement on top of the
adjusted patch.  It would be better to do the convert to switch first to
avoid this.


A


More information about the pacman-dev mailing list