SHA256
1
0
forked from pool/supermin
supermin/0007-skip-unreadable-files-in-zypp_rpm_list_files.patch

35 lines
1.4 KiB
Diff

From c1353a4933d30ce9103149586fec2b997870b6fc Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Thu, 11 Apr 2013 19:56:42 +0200
Subject: skip unreadable files in zypp_rpm_list_files
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
src/supermin_zypp_rpm.ml | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/supermin_zypp_rpm.ml b/src/supermin_zypp_rpm.ml
index 0f3b63a..9aa9de6 100644
--- a/src/supermin_zypp_rpm.ml
+++ b/src/supermin_zypp_rpm.ml
@@ -175,12 +175,18 @@ let rec zypp_rpm_list_files pkg =
let mode = int_of_string mode in
let size = int_of_string size in
if test_flag 'd' then None (* ignore documentation *)
- else
+ else (
+ (* Skip unreadable files when called as non-root *)
+ if Unix.getuid() > 0 &&
+ (try Unix.access filename [Unix.R_OK]; false with
+ Unix_error _ -> eprintf "supermin: EPERM %s\n%!" filename; true) then None
+ else
Some (filename, {
ft_dir = mode land 0o40000 <> 0;
ft_ghost = test_flag 'g'; ft_config = test_flag 'c';
ft_mode = mode; ft_size = size;
})
+ )
| _ ->
eprintf "supermin: bad output from rpm command: '%s'" line;
exit 1