Olaf Hering
2013-Apr-11 17:56 UTC
[Libguestfs] [PATCH] skip unreadable files in zypp_rpm_list_files
Signed-off-by: Olaf Hering <olaf at 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 720f50a..1c6243d 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
Apparently Analagous Threads
- [PATCH] remove leading tabs in zypp driver
- [PATCH 1/2] add run_shell helper
- [PATCH supermin v4] Supermin 5 rewrite.
- [PATCH] febootstrap: Use contents of installed Debian packages instead of downloading and unpacking them.
- [PATCH] handle --use-installed in zypp driver