[pacman-dev] [PATCH] pacman: better handle -F when file is not found
morganamilo
morganamilo at gmail.com
Mon Sep 9 16:49:16 UTC 2019
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(®, targ, REG_EXTENDED | REG_NOSUB | REG_ICASE | REG_NEWLINE) != 0) {
- /* TODO: error message */
goto notfound;
}
}
@@ -174,13 +173,20 @@ static int files_search(alpm_list_t *syncs, alpm_list_t *targets, int regex) {
regfree(®);
}
+ if(found) {
+ continue;
+ }
+
notfound:
- if(!found) {
- ret++;
+ ret = 1;
+ if(regex) {
+ pm_printf(ALPM_LOG_ERROR, _("no files match '%s'\n"), targ);
+ } else {
+ pm_printf(ALPM_LOG_ERROR, _("no package owns '%s'\n"), targ);
}
}
- return 0;
+ return ret;
}
static void dump_file_list(alpm_pkg_t *pkg) {
--
2.23.0
More information about the pacman-dev
mailing list