Blame SOURCES/coreutils-selinux.patch

8d0e4d
diff --git a/man/chcon.x b/man/chcon.x
8d0e4d
index 8c1ff6f..c84fb96 100644
8d0e4d
--- a/man/chcon.x
8d0e4d
+++ b/man/chcon.x
8d0e4d
@@ -1,4 +1,4 @@
8d0e4d
 [NAME]
8d0e4d
-chcon \- change file security context
8d0e4d
+chcon \- change file SELinux security context
8d0e4d
 [DESCRIPTION]
8d0e4d
 .\" Add any additional description here
8d0e4d
diff --git a/man/runcon.x b/man/runcon.x
8d0e4d
index d2df13e..5c5f5d8 100644
8d0e4d
--- a/man/runcon.x
8d0e4d
+++ b/man/runcon.x
8d0e4d
@@ -1,5 +1,5 @@
8d0e4d
 [NAME]
8d0e4d
-runcon \- run command with specified security context
8d0e4d
+runcon \- run command with specified SELinux security context
8d0e4d
 [DESCRIPTION]
8d0e4d
 Run COMMAND with completely-specified CONTEXT, or with current or
8d0e4d
 transitioned security context modified by one or more of LEVEL,
8d0e4d
diff --git a/src/cp.c b/src/cp.c
8d0e4d
index 1b528c6..25dbb88 100644
8d0e4d
--- a/src/cp.c
8d0e4d
+++ b/src/cp.c
8d0e4d
@@ -203,6 +203,9 @@ Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n\
8d0e4d
                                  all\n\
8d0e4d
 "), stdout);
8d0e4d
       fputs (_("\
8d0e4d
+  -c                           deprecated, same as --preserve=context\n\
8d0e4d
+"), stdout);
8d0e4d
+      fputs (_("\
8d0e4d
       --no-preserve=ATTR_LIST  don't preserve the specified attributes\n\
8d0e4d
       --parents                use full source file name under DIRECTORY\n\
8d0e4d
 "), stdout);
8d0e4d
@@ -929,7 +932,7 @@ main (int argc, char **argv)
8d0e4d
   selinux_enabled = (0 < is_selinux_enabled ());
8d0e4d
   cp_option_init (&x);
8d0e4d
 
8d0e4d
-  while ((c = getopt_long (argc, argv, "abdfHilLnprst:uvxPRS:TZ",
8d0e4d
+  while ((c = getopt_long (argc, argv, "abcdfHilLnprst:uvxPRS:TZ",
8d0e4d
                            long_opts, NULL))
8d0e4d
          != -1)
8d0e4d
     {
8d0e4d
@@ -977,6 +980,17 @@ main (int argc, char **argv)
8d0e4d
           copy_contents = true;
8d0e4d
           break;
8d0e4d
 
8d0e4d
+        case 'c':
8d0e4d
+          fprintf (stderr, "%s: warning: option '-c' is deprecated, please use '--preserve=context' instead\n", argv[0]);
8d0e4d
+          if ( x.set_security_context ) {
8d0e4d
+              (void) fprintf(stderr, "%s: cannot force target context and preserve it\n", argv[0]);
8d0e4d
+             exit( 1 );
8d0e4d
+           }
8d0e4d
+           else if (selinux_enabled) {
8d0e4d
+              x.preserve_security_context = true;
8d0e4d
+              x.require_preserve_context = true;
8d0e4d
+           }
8d0e4d
+          break;
8d0e4d
         case 'd':
8d0e4d
           x.preserve_links = true;
8d0e4d
           x.dereference = DEREF_NEVER;
8d0e4d
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
8d0e4d
index 47e4480..cff2ead 100644
8d0e4d
--- a/doc/coreutils.texi
8d0e4d
+++ b/doc/coreutils.texi
8d0e4d
@@ -8083,6 +8083,11 @@ done
8d0e4d
 exit $fail
8d0e4d
 @end example
8d0e4d
 
8d0e4d
+@item -c
8d0e4d
+@cindex SELinux security context information, preserving
8d0e4d
+Preserve SELinux security context of the original files if possible.
8d0e4d
+Some file systems don't support storing of SELinux security context.
8d0e4d
+
8d0e4d
 @item --copy-contents
8d0e4d
 @cindex directories, copying recursively
8d0e4d
 @cindex copying directories recursively
8d0e4d
diff --git a/src/install.c b/src/install.c
8d0e4d
index d79d597..437889a 100644
8d0e4d
--- a/src/install.c
8d0e4d
+++ b/src/install.c
8d0e4d
@@ -673,7 +673,7 @@ In the 4th form, create all components of the given DIRECTORY(ies).\n\
8d0e4d
   -v, --verbose       print the name of each directory as it is created\n\
8d0e4d
 "), stdout);
8d0e4d
       fputs (_("\
8d0e4d
-      --preserve-context  preserve SELinux security context\n\
8d0e4d
+  -P, --preserve-context  preserve SELinux security context (-P deprecated)\n\
8d0e4d
   -Z                      set SELinux security context of destination\n\
8d0e4d
                             file and each created directory to default type\n\
8d0e4d
       --context[=CTX]     like -Z, or if CTX is specified then set the\n\
8d0e4d
@@ -824,7 +824,7 @@ main (int argc, char **argv)
8d0e4d
   dir_arg = false;
8d0e4d
   umask (0);
8d0e4d
 
8d0e4d
-  while ((optc = getopt_long (argc, argv, "bcCsDdg:m:o:pt:TvS:Z", long_options,
8d0e4d
+  while ((optc = getopt_long (argc, argv, "bcCsDdg:m:o:pPt:TvS:Z", long_options,
8d0e4d
                               NULL)) != -1)
8d0e4d
     {
8d0e4d
       switch (optc)
8d0e4d
@@ -885,6 +885,8 @@ main (int argc, char **argv)
8d0e4d
           no_target_directory = true;
8d0e4d
           break;
8d0e4d
 
8d0e4d
+        case 'P':
8d0e4d
+          fprintf (stderr, "%s: warning: option '-P' is deprecated, please use '--preserve-context' instead\n", argv[0]);
8d0e4d
         case PRESERVE_CONTEXT_OPTION:
8d0e4d
           if (! selinux_enabled)
8d0e4d
             {
8d0e4d
@@ -892,6 +894,10 @@ main (int argc, char **argv)
8d0e4d
                              "this kernel is not SELinux-enabled"));
8d0e4d
               break;
8d0e4d
             }
8d0e4d
+          if ( x.set_security_context ) {
8d0e4d
+             (void) fprintf(stderr, "%s: cannot force target context and preserve it\n", argv[0]);
8d0e4d
+             exit( 1 );
8d0e4d
+          }
8d0e4d
           x.preserve_security_context = true;
8d0e4d
           use_default_selinux_context = false;
8d0e4d
           break;