From 3862d8dc516807ef9ee0f54a17f3e3122e1e73f9 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Mar 02 2017 09:26:19 +0000 Subject: Resolves: #1398913 - install,mkdir: fix handling of -DZ and -pZ, respectively --- diff --git a/coreutils-8.25-mkdir-p-selinux.patch b/coreutils-8.25-mkdir-p-selinux.patch new file mode 100644 index 0000000..a321e6d --- /dev/null +++ b/coreutils-8.25-mkdir-p-selinux.patch @@ -0,0 +1,52 @@ +From 8b89985a3904e0267750c430e01684edf008051b Mon Sep 17 00:00:00 2001 +From: Kamil Dudka +Date: Mon, 28 Nov 2016 16:21:42 +0100 +Subject: [PATCH] install,mkdir: fix handling of -DZ and -pZ, respectively + +... in the case where two or more directories nested in each other are +created and each of them defaults to a different SELinux context. + +* src/install.c (make_ancestor): When calling defaultcon(), give it the +same path that is given to mkdir(). The other path is not always valid +wrt. current working directory. +* src/mkdir.c (make_ancestor): Likewise. +* NEWS: Mention the bug fix. + +Reported at https://bugzilla.redhat.com/1398913 + +Upstream-commit: d8104265f229ababd5a68a46eeccbccc07e72cdc +Signed-off-by: Kamil Dudka +--- + src/install.c | 2 +- + src/mkdir.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/install.c b/src/install.c +index 1b7a209..cae0a53 100644 +--- a/src/install.c ++++ b/src/install.c +@@ -425,7 +425,7 @@ static int + make_ancestor (char const *dir, char const *component, void *options) + { + struct cp_options const *x = options; +- if (x->set_security_context && defaultcon (dir, S_IFDIR) < 0 ++ if (x->set_security_context && defaultcon (component, S_IFDIR) < 0 + && ! ignorable_ctx_err (errno)) + error (0, errno, _("failed to set default creation context for %s"), + quoteaf (dir)); +diff --git a/src/mkdir.c b/src/mkdir.c +index 60fc08a..77af857 100644 +--- a/src/mkdir.c ++++ b/src/mkdir.c +@@ -122,7 +122,7 @@ make_ancestor (char const *dir, char const *component, void *options) + { + struct mkdir_options const *o = options; + +- if (o->set_security_context && defaultcon (dir, S_IFDIR) < 0 ++ if (o->set_security_context && defaultcon (component, S_IFDIR) < 0 + && ! ignorable_ctx_err (errno)) + error (0, errno, _("failed to set default creation context for %s"), + quoteaf (dir)); +-- +2.9.3 + diff --git a/coreutils.spec b/coreutils.spec index fc44cd4..b234c67 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,7 +1,7 @@ Summary: A set of basic GNU tools commonly used in shell scripts Name: coreutils Version: 8.25 -Release: 15%{?dist} +Release: 16%{?dist} License: GPLv3+ Group: System Environment/Base Url: http://www.gnu.org/software/coreutils/ @@ -25,6 +25,8 @@ Patch953: coreutils-8.25-sort-thousands-sep.patch Patch954: coreutils-8.25-ls-signal.patch # md5sum,sha*sum: fix --ignore-missing with checksums starting with 00 Patch955: coreutils-8.25-sum-ignore-missing.patch +# install,mkdir: fix handling of -DZ and -pZ, respectively (#1398913) +Patch956: coreutils-8.25-mkdir-p-selinux.patch # Our patches #general patch to workaround koji build system issues @@ -219,6 +221,7 @@ tee DIR_COLORS{,.256color,.lightbgcolor} /dev/null %patch953 -p1 %patch954 -p1 %patch955 -p1 +%patch956 -p1 chmod a+x \ tests/df/direct.sh \ @@ -353,6 +356,9 @@ fi %license COPYING %changelog +* Thu Mar 02 2017 Kamil Dudka - 8.25-16 +- install,mkdir: fix handling of -DZ and -pZ, respectively (#1398913) + * Mon Oct 31 2016 Kamil Dudka - 8.25-15 - md5sum,sha*sum: fix --ignore-missing with checksums starting with 00 - ls: allow interruption when reading slow directories (#1365933)