| Summary: | mkdir fails to label some directories when -p -Z options are used. | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Scott Shambarger <scott-fedora> |
| Component: | coreutils | Assignee: | Kamil Dudka <kdudka> |
| Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 24 | CC: | admiller, jamartis, kdudka, kzak, ooprala, ovasik, p, twaugh |
| Target Milestone: | --- | Keywords: | Patch |
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | coreutils-8.26-1.fc26 coreutils-8.25-16.fc25 coreutils-8.25-8.fc24 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2017-03-03 21:51:02 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
|
Description
Scott Shambarger
2016-11-27 09:42:33 UTC
Confirmed. Minimal example: $ sudo semanage fcontext -a -t user_home_t /tmp/a $ sudo semanage fcontext -a -t mozilla_home_t /tmp/a/b $ sudo semanage fcontext -a -t home_cert_t /tmp/a/b/c $ mkdir -Zp a/b/c $ ls -1Zd a a/b a/b/c unconfined_u:object_r:user_home_t:s0 a unconfined_u:object_r:user_home_t:s0 a/b unconfined_u:object_r:home_cert_t:s0 a/b/c $ restorecon -R a $ ls -1Zd a a/b a/b/c unconfined_u:object_r:user_home_t:s0 a unconfined_u:object_r:mozilla_home_t:s0 a/b unconfined_u:object_r:home_cert_t:s0 a/b/c Same problem with install(1): $ rm -fr a $ install -ZDd a/b/c $ ls -1Zd a a/b a/b/c unconfined_u:object_r:user_home_t:s0 a unconfined_u:object_r:user_home_t:s0 a/b unconfined_u:object_r:home_cert_t:s0 a/b/c This looks like a copy-paste error (duplicated at two places in the code):
--- a/src/install.c
+++ b/src/install.c
@@ -427,7 +427,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));
--- a/src/mkdir.c
+++ b/src/mkdir.c
@@ -123,7 +123,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));
I will submit a patch upstream once I have idea how to test this...
(In reply to Kamil Dudka from comment #2) > I will submit a patch upstream once I have idea how to test this... I have not figured out how to reliably test this without having root access but submitted a patch upstream anyway: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25052 coreutils-8.25-8.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2017-b21a847e7a coreutils-8.25-16.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-24ce0b63c4 coreutils-8.25-16.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-24ce0b63c4 coreutils-8.25-8.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-b21a847e7a Tested update, bug appears fixed. Karma added. coreutils-8.25-16.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report. coreutils-8.25-8.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report. (In reply to Scott Shambarger from comment #9) > Tested update, bug appears fixed. Karma added. Thanks for confirmation! |