[pacman-dev] [PATCH] Adds a check to -Qo, so that pacman warns the user if the file does not exits

Eli Schwartz eschwartz at archlinux.org
Wed Jun 17 00:26:05 UTC 2020


On 6/16/20 8:05 PM, Pedro Victor wrote:
> From: Pedro Victor <pedrocga1 at gmail.com>
> 
> ---
>  src/pacman/query.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/pacman/query.c b/src/pacman/query.c
> index 513ddb7a..784936b9 100644
> --- a/src/pacman/query.c
> +++ b/src/pacman/query.c
> @@ -209,6 +209,11 @@ static int query_fileowner(alpm_list_t *targets)
>  			strcat(rpath + rlen, "/");
>  		}
>  
> +		if (access(rel_path, F_OK) == -1) {
> +			pm_printf(ALPM_LOG_ERROR, _("File does not exist: %s\n"), rel_path);
> +			goto targcleanup;
> +		}
> +

Note that the current behavior is, if a file has been deleted and a
warning is reported by 'pacman -Qkk', pacman -Qo /path/to/file will
still report which package is *supposed* to it.

>  		for(i = packages; i && (!found || is_dir); i = alpm_list_next(i)) {
>  			if(alpm_filelist_contains(alpm_pkg_get_files(i->data), rel_path)) {
>  				print_query_fileowner(rpath, i->data);
> 


-- 
Eli Schwartz
Bug Wrangler and Trusted User

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1601 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/pacman-dev/attachments/20200616/81d4f9da/attachment.sig>


More information about the pacman-dev mailing list