From 50d70ca9b376fc3e887b0172576deb0e1dfafc71 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Fri, 11 Aug 2017 14:16:56 +0200 Subject: [PATCH] work around false positives in deltatar fs checks during rpmbuild MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit These only happen when running in rpmbuild, otherwise the tests are fine. Of course, on RHBT the choir resoundeth “thou shalt not run thine rpm build as root” but that’s not really an option here. --- deltatar/deltatar.py | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/deltatar/deltatar.py b/deltatar/deltatar.py index 9a96467..6f8cbb1 100644 --- a/deltatar/deltatar.py +++ b/deltatar/deltatar.py @@ -500,7 +500,11 @@ class DeltaTar(object): # only if user is root, then also check gid/uid. otherwise do not check it, # because tarfile can chown in case of being superuser only - if hasattr(os, "geteuid") and os.geteuid() == 0: + # + # also, skip the check in rpmbuild since the sources end up with the + # uid:gid of the packager while the extracted files are 0:0. + if hasattr(os, "geteuid") and os.geteuid() == 0 \ + and os.getenv ("RPMBUILD_OPTIONS") is None: keys.append('gid') keys.append('uid') -- 1.7.1