perf buildid-cache: Warn --purge-all failures
authorRavi Bangoria <[email protected]>
Thu, 10 May 2018 04:36:51 +0000 (10:06 +0530)
committerArnaldo Carvalho de Melo <[email protected]>
Tue, 15 May 2018 13:32:16 +0000 (10:32 -0300)
Warn perf buildid-cache --purge-all failures in non verbose mode.

Ex.:

  $ sudo chown root:root /home/ravi/.debug -R
  $ sudo chmod 700 /home/ravi/.debug/ -R
  $ ./perf buildid-cache -P
    Couldn't remove some caches. Error: Permission denied.

Suggested-by: Masami Hiramatsu <[email protected]>
Signed-off-by: Ravi Bangoria <[email protected]>
Acked-by: Masami Hiramatsu <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Namhyung Kim <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/perf/builtin-buildid-cache.c

index 7a7403913b57488b175d6bd114aeabe5881dfb6e..115110a4796a1aa60ab8730066aad7df7522fd3a 100644 (file)
@@ -488,8 +488,12 @@ int cmd_buildid_cache(int argc, const char **argv)
                }
        }
 
-       if (purge_all)
-               ret = build_id_cache__purge_all();
+       if (purge_all) {
+               if (build_id_cache__purge_all()) {
+                       pr_warning("Couldn't remove some caches. Error: %s.\n",
+                               str_error_r(errno, sbuf, sizeof(sbuf)));
+               }
+       }
 
        if (missing_filename)
                ret = build_id_cache__fprintf_missing(session, stdout);