From e04d44186cf77eb073bbb2c571f047d4854a5a9f3491c2f207a6439ce5981d81 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Thu, 11 Apr 2013 18:13:47 +0000 Subject: [PATCH] skip unreadable files in zypp_rpm_list_files OBS-URL: https://build.opensuse.org/package/show/Virtualization/supermin?expand=0&rev=5 --- 0001-Actually-update-gnulib.patch | 2 +- ...ng-options-to-help-and-man-page-RHBZ.patch | 3 +- 0003-add-run_shell-helper.patch | 2 +- 0004-add-support-for-zypp.patch | 2 +- ...-work-with-empty-root-in-zypp-driver.patch | 2 +- ...-handle-use-installed-in-zypp-driver.patch | 2 +- ...eadable-files-in-zypp_rpm_list_files.patch | 34 +++++++++++++++ 0008-remove-leading-tabs-in-zypp-driver.patch | 41 +++++++++++++++++++ supermin.spec | 4 ++ 9 files changed, 85 insertions(+), 7 deletions(-) create mode 100644 0007-skip-unreadable-files-in-zypp_rpm_list_files.patch create mode 100644 0008-remove-leading-tabs-in-zypp-driver.patch diff --git a/0001-Actually-update-gnulib.patch b/0001-Actually-update-gnulib.patch index a77e411..1980184 100644 --- a/0001-Actually-update-gnulib.patch +++ b/0001-Actually-update-gnulib.patch @@ -1,7 +1,7 @@ From 9f60bbb8e486c410d76e1864a11d3990c2119787 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 5 Feb 2013 16:46:22 +0000 -Subject: [PATCH 1/6] Actually update gnulib. +Subject: Actually update gnulib. This fixes commit 4df7ff0786d872c9bb8a0a1b5410429ca1f8440b. --- diff --git a/0002-helper-Add-missing-options-to-help-and-man-page-RHBZ.patch b/0002-helper-Add-missing-options-to-help-and-man-page-RHBZ.patch index df484de..bc822c6 100644 --- a/0002-helper-Add-missing-options-to-help-and-man-page-RHBZ.patch +++ b/0002-helper-Add-missing-options-to-help-and-man-page-RHBZ.patch @@ -1,8 +1,7 @@ From 81a3470088aff911c4e5e729bf1f1b61480baab8 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" 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 ++-- diff --git a/0003-add-run_shell-helper.patch b/0003-add-run_shell-helper.patch index c757865..614de9d 100644 --- a/0003-add-run_shell-helper.patch +++ b/0003-add-run_shell-helper.patch @@ -1,7 +1,7 @@ From 1ecd918f88065b55bcb411b54311d813ce54c2ad Mon Sep 17 00:00:00 2001 From: Olaf Hering 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. diff --git a/0004-add-support-for-zypp.patch b/0004-add-support-for-zypp.patch index a744243..0ad5b3a 100644 --- a/0004-add-support-for-zypp.patch +++ b/0004-add-support-for-zypp.patch @@ -1,7 +1,7 @@ From 392eca634d68a01045475799a76b988e4589006c Mon Sep 17 00:00:00 2001 From: Olaf Hering 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. diff --git a/0005-always-work-with-empty-root-in-zypp-driver.patch b/0005-always-work-with-empty-root-in-zypp-driver.patch index 6c03d95..17859e1 100644 --- a/0005-always-work-with-empty-root-in-zypp-driver.patch +++ b/0005-always-work-with-empty-root-in-zypp-driver.patch @@ -1,7 +1,7 @@ From 235933bb68a378cb48c5c740b97e5075975edf9a Mon Sep 17 00:00:00 2001 From: Olaf Hering 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 diff --git a/0006-handle-use-installed-in-zypp-driver.patch b/0006-handle-use-installed-in-zypp-driver.patch index 6eda5d6..b4011eb 100644 --- a/0006-handle-use-installed-in-zypp-driver.patch +++ b/0006-handle-use-installed-in-zypp-driver.patch @@ -1,7 +1,7 @@ From 9750c2e6050d73276699090180dc2e43d87c9663 Mon Sep 17 00:00:00 2001 From: Olaf Hering 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. diff --git a/0007-skip-unreadable-files-in-zypp_rpm_list_files.patch b/0007-skip-unreadable-files-in-zypp_rpm_list_files.patch new file mode 100644 index 0000000..ecf133f --- /dev/null +++ b/0007-skip-unreadable-files-in-zypp_rpm_list_files.patch @@ -0,0 +1,34 @@ +From c1353a4933d30ce9103149586fec2b997870b6fc Mon Sep 17 00:00:00 2001 +From: Olaf Hering +Date: Thu, 11 Apr 2013 19:56:42 +0200 +Subject: skip unreadable files in zypp_rpm_list_files + +Signed-off-by: Olaf Hering +--- + 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 diff --git a/0008-remove-leading-tabs-in-zypp-driver.patch b/0008-remove-leading-tabs-in-zypp-driver.patch new file mode 100644 index 0000000..0c3d888 --- /dev/null +++ b/0008-remove-leading-tabs-in-zypp-driver.patch @@ -0,0 +1,41 @@ +From 7a2b8a95e0e6d8dea105db6853d23a6e6d68694e Mon Sep 17 00:00:00 2001 +From: Olaf Hering +Date: Thu, 11 Apr 2013 19:57:41 +0200 +Subject: remove leading tabs in zypp driver + +Signed-off-by: Olaf Hering +--- + 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 + diff --git a/supermin.spec b/supermin.spec index afcba44..d972789 100644 --- a/supermin.spec +++ b/supermin.spec @@ -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