GNU bug report logs - #20616
mkdir: -p breaks -Z

Previous Next

Package: coreutils;

Reported by: Hannes Reich <hannes <at> skynet.ie>

Date: Wed, 20 May 2015 15:30:06 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Hannes Reich <hannes <at> skynet.ie>
Subject: bug#20616: closed (Re: bug#20616: mkdir: -p breaks -Z)
Date: Sat, 23 May 2015 01:08:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#20616: mkdir: -p breaks -Z

which was filed against the coreutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 20616 <at> debbugs.gnu.org.

-- 
20616: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20616
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Pádraig Brady <P <at> draigBrady.com>
To: Hannes Reich <hannes <at> skynet.ie>, 20616-done <at> debbugs.gnu.org
Subject: Re: bug#20616: mkdir: -p breaks -Z
Date: Sat, 23 May 2015 02:06:44 +0100
Fix pushed at:
http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=4ce7488

cheers,
Pádraig.

[Message part 3 (message/rfc822, inline)]
From: Hannes Reich <hannes <at> skynet.ie>
To: bug-coreutils <at> gnu.org
Subject: mkdir: -p breaks -Z
Date: Wed, 20 May 2015 14:03:03 +0200
The "-Z" (set SELinux context) option to mkdir appears to have no effect 
when "-p" (no error if existing, create parents) is also specified.

For example, on my CentOS 7 system, the correct context for 
subdirectories of "/home" is "user_home_dir_t", but when I create such a 
directory with "mkdir -p -Z", it has the "home_root_t" context:

    # rm -rf /home/with-p
    # mkdir -p -Z /home/with-p
    # ls -Zd /home/with-p
    drwxr-xr-x. root root unconfined_u:object_r:home_root_t:s0 /home/with-p
    #

That's wrong. Running restorecon(1) fixes it:

    # restorecon -v /home/with-p
    restorecon reset /home/with-p context 
unconfined_u:object_r:home_root_t:s0->unconfined_u:object_r:user_home_dir_t:s0
    #

Without the "-p" option, "-Z" works as expected:

    # mkdir -Z /home/without-p
    # ls -Zd /home/without-p
    drwxr-xr-x. root root unconfined_u:object_r:user_home_dir_t:s0 
/home/without-p
    # restorecon -v /home/without-p
    #

The coreutils version in CentOS 7 is 8.22.

coreutils-8.23 compiled from source has the same behaviour.




This bug report was last modified 10 years and 80 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.