From 29c2e15b0ee109be1db0e94e2afc6717076540b4 Mon Sep 17 00:00:00 2001 From: Vratislav Podzimek Date: Tue, 21 Jul 2015 16:43:04 +0200 Subject: [PATCH 5/7] Beware of RPM->cpio entries' paths having absolute paths Otherwise the check for required files fails because the paths may be given as relative. Related: rhbz#1241064 Signed-off-by: Vratislav Podzimek --- org_fedora_oscap/common.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/org_fedora_oscap/common.py b/org_fedora_oscap/common.py index 7873b50..d09ccbd 100644 --- a/org_fedora_oscap/common.py +++ b/org_fedora_oscap/common.py @@ -397,7 +397,8 @@ def _extract_rpm(rpm_path, root="/", ensure_has_files=None): entry_names = [entry.name.lstrip(".") for entry in entries] for fpath in ensure_has_files or (): - if not fpath in entry_names: + # RPM->cpio entries have absolute paths + if fpath not in entry_names and os.path.join("/", fpath) not in entry_names: msg = "File '%s' not found in the archive '%s'" % (fpath, rpm_path) raise ExtractionError(msg) -- 2.4.3