[pacman-dev] [PATCH] pacman: better handle -F when file is not found

Andrew Gregory andrew.gregory.8 at gmail.com
Tue Sep 10 15:32:22 UTC 2019


On 09/09/19 at 05:49pm, morganamilo wrote:
> Error messages are now printed.
> Pacman now returns 1 if any of the files queried are not found.
> ---
>  src/pacman/files.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/src/pacman/files.c b/src/pacman/files.c
> index 8e518486..c4351114 100644
> --- a/src/pacman/files.c
> +++ b/src/pacman/files.c
> @@ -115,7 +115,6 @@ static int files_search(alpm_list_t *syncs, alpm_list_t *targets, int regex) {
>  
>  		if(regex) {
>  			if(regcomp(&reg, targ, REG_EXTENDED | REG_NOSUB | REG_ICASE | REG_NEWLINE) != 0) {
> -				/* TODO: error message */
>  				goto notfound;

...

>  notfound:
> -		if(!found) {
> -			ret++;
> +		ret = 1;
> +		if(regex) {
> +			pm_printf(ALPM_LOG_ERROR, _("no files match '%s'\n"), targ);

"no files match" isn't really a great error message if the real
problem is that the regex failed to even compile.


More information about the pacman-dev mailing list