On 05/29/23 at 02:54pm, Ronan Pigott wrote:
> Signed-off-by: Ronan Pigott <[email protected]>
> ---
> The error string is missing translations in this version, would
> appreciate some advice on what to do about that.
> 
>  src/pacman/pacman.c |  1 -
>  src/pacman/query.c  | 17 ++++++++++++++---
>  2 files changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
> index e5c6e4200932..320c7654e0a7 100644
> --- a/src/pacman/pacman.c
> +++ b/src/pacman/pacman.c
> @@ -608,7 +608,6 @@ static void checkargs_query(void)
>       } else if(config->op_q_owns) {
>               invalid_opt(config->group, "--owns", "--groups");
>               checkargs_query_display_opts("--owns");
> -             checkargs_query_filter_opts("--owns");
>       } else if(config->group) {
>               checkargs_query_display_opts("--groups");
>       }
> diff --git a/src/pacman/query.c b/src/pacman/query.c
> index 84b885776e2d..dda3209a250c 100644
> --- a/src/pacman/query.c
> +++ b/src/pacman/query.c
> @@ -251,8 +251,7 @@ static int query_fileowner(alpm_list_t *targets)
>  
>               if(strncmp(rpath, root, rootlen) != 0) {
>                       /* file is outside root, we know nothing can own it */
> -                     pm_printf(ALPM_LOG_ERROR, _("No package owns %s\n"), 
> filename);
> -                     goto targcleanup;
> +                     goto targnotfound;
>               }
>  
>               rel_path = rpath + rootlen;
> @@ -267,13 +266,25 @@ static int query_fileowner(alpm_list_t *targets)
>               }
>  
>               for(i = packages; i && (!found || is_dir); i = 
> alpm_list_next(i)) {
> +                     if (!filter(i->data)) {
> +                             continue;
> +                     }
>                       if(alpm_filelist_contains(alpm_pkg_get_files(i->data), 
> rel_path)) {
>                               print_query_fileowner(rpath, i->data);
>                               found = 1;
>                       }
>               }
> +
> +targnotfound:
>               if(!found) {
> -                     pm_printf(ALPM_LOG_ERROR, _("No package owns %s\n"), 
> filename);
> +                     pm_printf(ALPM_LOG_ERROR, _("No %s%s%s%s%s%spackage 
> owns %s\n"),
> +                                     config->op_q_deps ? "non-explicit " : 
> "",
> +                                     config->op_q_explicit ? "explicit " : 
> "",
> +                                     config->op_q_upgrade ? "upgradable " : 
> "",
> +                                     config->op_q_unrequired ? "unrequired " 
> : "",
> +                                     config->op_q_locality & 
> PKG_LOCALITY_NATIVE ? "native " : "",
> +                                     config->op_q_locality & 
> PKG_LOCALITY_FOREIGN ? "foreign " : "",
> +                                     filename);

I really don't think this is necessary.  Sure, you can argue that if a filter
is used "No package owns X" is not technically true, but the user explicitly
provided the filter and this adds something non-obvious we'd have to keep in
sync if we add more filtering criteria.

>               }
>  
>  targcleanup:
> -- 
> 2.40.1
> 

Reply via email to