Re: [pacman-dev] [PATCH] pacman: print error message for -F with invalid regex

2019-11-08 Thread Morgan Adamiec
On Thu, 7 Nov 2019 at 11:42, Allan McRae  wrote:
>
> On 6/11/19 12:00 pm, morganamilo wrote:
> >
> > diff --git a/src/pacman/files.c b/src/pacman/files.c
> > index 19191dd8..05b6f223 100644
> > --- a/src/pacman/files.c
> > +++ b/src/pacman/files.c
> > @@ -115,7 +115,8 @@ static int files_search(alpm_list_t *syncs, alpm_list_t 
> > *targets, int regex) {
> >
> >   if(regex) {
> >   if(regcomp(, targ, REG_EXTENDED | REG_NOSUB | 
> > REG_ICASE | REG_NEWLINE) != 0) {
> > - /* TODO: error message */
> > + pm_printf(ALPM_LOG_ERROR,
> > + _("search failed: invalid 
> > regular expression '%s'\n"), targ);
>
> This will already print "error: " at the start. So I don't the colon
> there is good.  How about just:
>
> invalid search regular expression
>
> >   goto notfound;
> >   }
> >   }
> >

This is the exact same error message used in my patch for -Ss. I don't
mind changing it but would at least like both to be the same.


Re: [pacman-dev] [PATCH] pacman: print error message for -F with invalid regex

2019-11-07 Thread Allan McRae
On 6/11/19 12:00 pm, morganamilo wrote:
> 
> diff --git a/src/pacman/files.c b/src/pacman/files.c
> index 19191dd8..05b6f223 100644
> --- a/src/pacman/files.c
> +++ b/src/pacman/files.c
> @@ -115,7 +115,8 @@ static int files_search(alpm_list_t *syncs, alpm_list_t 
> *targets, int regex) {
>  
>   if(regex) {
>   if(regcomp(, targ, REG_EXTENDED | REG_NOSUB | 
> REG_ICASE | REG_NEWLINE) != 0) {
> - /* TODO: error message */
> + pm_printf(ALPM_LOG_ERROR,
> + _("search failed: invalid 
> regular expression '%s'\n"), targ);

This will already print "error: " at the start. So I don't the colon
there is good.  How about just:

invalid search regular expression

>   goto notfound;
>   }
>   }
> 


[pacman-dev] [PATCH] pacman: print error message for -F with invalid regex

2019-11-05 Thread morganamilo


diff --git a/src/pacman/files.c b/src/pacman/files.c
index 19191dd8..05b6f223 100644
--- a/src/pacman/files.c
+++ b/src/pacman/files.c
@@ -115,7 +115,8 @@ static int files_search(alpm_list_t *syncs, alpm_list_t 
*targets, int regex) {
 
if(regex) {
if(regcomp(, targ, REG_EXTENDED | REG_NOSUB | 
REG_ICASE | REG_NEWLINE) != 0) {
-   /* TODO: error message */
+   pm_printf(ALPM_LOG_ERROR,
+   _("search failed: invalid 
regular expression '%s'\n"), targ);
goto notfound;
}
}
-- 
2.23.0