SHA256
1
0
forked from pool/supermin

skip unreadable files in zypp_rpm_list_files

OBS-URL: https://build.opensuse.org/package/show/Virtualization/supermin?expand=0&rev=5
This commit is contained in:
Olaf Hering 2013-04-11 18:13:47 +00:00 committed by Git OBS Bridge
parent 1b5dfec97b
commit e04d44186c
9 changed files with 85 additions and 7 deletions

View File

@ -1,7 +1,7 @@
From 9f60bbb8e486c410d76e1864a11d3990c2119787 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 5 Feb 2013 16:46:22 +0000
Subject: [PATCH 1/6] Actually update gnulib.
Subject: Actually update gnulib.
This fixes commit 4df7ff0786d872c9bb8a0a1b5410429ca1f8440b.
---

View File

@ -1,8 +1,7 @@
From 81a3470088aff911c4e5e729bf1f1b61480baab8 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 5 Apr 2013 17:14:52 +0100
Subject: [PATCH 2/6] helper: Add missing options to --help and man page
(RHBZ#948880).
Subject: helper: Add missing options to --help and man page (RHBZ#948880).
---
helper/main.c | 4 ++--

View File

@ -1,7 +1,7 @@
From 1ecd918f88065b55bcb411b54311d813ce54c2ad Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Tue, 9 Apr 2013 19:27:01 +0200
Subject: [PATCH 3/6] add run_shell helper
Subject: add run_shell helper
The new run_shell helper is a copy of run_python,
and will be used by upcoming changes.

View File

@ -1,7 +1,7 @@
From 392eca634d68a01045475799a76b988e4589006c Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Tue, 9 Apr 2013 19:27:02 +0200
Subject: [PATCH 4/6] add support for zypp
Subject: add support for zypp
This adds support for zypper which is used as package management in
SuSE Linux. It started out as copy of yum support.

View File

@ -1,7 +1,7 @@
From 235933bb68a378cb48c5c740b97e5075975edf9a Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Thu, 11 Apr 2013 16:36:40 +0200
Subject: [PATCH 5/6] always work with empty --root in zypp driver
Subject: always work with empty --root in zypp driver
The current mode of operation in the zypp driver is to download all
packages into a temporary pkg-cache-dir. Installed packages in the root

View File

@ -1,7 +1,7 @@
From 9750c2e6050d73276699090180dc2e43d87c9663 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Thu, 11 Apr 2013 19:07:11 +0200
Subject: [PATCH 6/6] handle --use-installed in zypp driver
Subject: handle --use-installed in zypp driver
An attempt to use installed files in zypp driver.
Add also a comment about the theory of operation.

View File

@ -0,0 +1,34 @@
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

View File

@ -0,0 +1,41 @@
From 7a2b8a95e0e6d8dea105db6853d23a6e6d68694e Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Thu, 11 Apr 2013 19:57:41 +0200
Subject: remove leading tabs in zypp driver
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
src/supermin_zypp_rpm.ml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/supermin_zypp_rpm.ml b/src/supermin_zypp_rpm.ml
index 9aa9de6..09b1695 100644
--- a/src/supermin_zypp_rpm.ml
+++ b/src/supermin_zypp_rpm.ml
@@ -173,7 +173,7 @@ let rec zypp_rpm_list_files pkg =
| [filename; flags; mode; size] ->
let test_flag = String.contains flags in
let mode = int_of_string mode in
- let size = int_of_string size in
+ let size = int_of_string size in
if test_flag 'd' then None (* ignore documentation *)
else (
(* Skip unreadable files when called as non-root *)
@@ -206,7 +206,7 @@ let rec zypp_rpm_list_files pkg =
List.map (fun name ->
name, { ft_dir = true; ft_ghost = false;
ft_config = false; ft_mode = 0o40755;
- ft_size = 0 }) dirs in
+ ft_size = 0 }) dirs in
let devs = [ "/dev/null"; "/dev/full"; "/dev/zero"; "/dev/random";
"/dev/urandom"; "/dev/tty"; "/dev/console";
"/dev/ptmx"; "/dev/stdin"; "/dev/stdout"; "/dev/stderr" ] in
@@ -215,7 +215,7 @@ let rec zypp_rpm_list_files pkg =
List.map (fun name ->
name, { ft_dir = false; ft_ghost = false;
ft_config = false; ft_mode = 0o644;
- ft_size = 0 }) devs in
+ ft_size = 0 }) devs in
dirs @ devs @ files
) else files in

View File

@ -37,6 +37,8 @@ Patch3: 0003-add-run_shell-helper.patch
Patch4: 0004-add-support-for-zypp.patch
Patch5: 0005-always-work-with-empty-root-in-zypp-driver.patch
Patch6: 0006-handle-use-installed-in-zypp-driver.patch
Patch7: 0007-skip-unreadable-files-in-zypp_rpm_list_files.patch
Patch8: 0008-remove-leading-tabs-in-zypp-driver.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: e2fsprogs
@ -62,6 +64,8 @@ you need to boot one of them.
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%build
export ZYPPER=zypper