From: Ivy Foster <i...@escondida.tk>

Query operations act on the local db, not the filesystem. Also, a
valid use case for -Qo is to discover what package owns a deleted file
so it can be reinstalled.

Closes FS#55856.

Signed-off-by: Ivy Foster <i...@escondida.tk>
---
I've opted to simply remove the relevant error messages here, since
there's a good chance that the user is aware that the file is missing
if they're querying a missing file.

As a side note, this removes the sole usage of the translated error
"failed to find '%s' in PATH: %s\n". I have not deleted this string
from every .po file, but that option now exists.

 src/pacman/query.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/src/pacman/query.c b/src/pacman/query.c
index 024d3e21..64c42f19 100644
--- a/src/pacman/query.c
+++ b/src/pacman/query.c
@@ -171,19 +171,9 @@ static int query_fileowner(alpm_list_t *targets)
                        filename[len--] = '\0';
                }
 
-               if(lstat(filename, &buf) == -1) {
-                       /* if it is not a path but a program name, then check 
in PATH */
-                       if(strchr(filename, '/') == NULL) {
-                               if(search_path(&filename, &buf) == -1) {
-                                       pm_printf(ALPM_LOG_ERROR, _("failed to 
find '%s' in PATH: %s\n"),
-                                                       filename, 
strerror(errno));
-                                       goto targcleanup;
-                               }
-                       } else {
-                               pm_printf(ALPM_LOG_ERROR, _("failed to read 
file '%s': %s\n"),
-                                               filename, strerror(errno));
-                               goto targcleanup;
-                       }
+               /* if it is not a path but a program name, then check in PATH */
+               if((lstat(filename, &buf) == -1) && (strchr(filename, '/') == 
NULL)) {
+                       search_path(&filename, &buf);
                }
 
                if(!lrealpath(filename, rpath)) {
-- 
2.15.0

Reply via email to