[coreutils] Fix cp -Z functionality if destination exists(#715557), deprecate it as non-upstream option (it is e

Ondrej Vasik ovasik at fedoraproject.org
Thu Aug 11 14:38:53 UTC 2011


commit 4afb5b057dc5e24a2cf168ca2718ef32b7cc810f
Author: Ondřej Vašík <ovasik at redhat.com>
Date:   Thu Aug 11 16:38:37 2011 +0200

    Fix cp -Z functionality if destination exists(#715557), deprecate it as non-upstream option (it is easy to achieve this functionality other way, cp should not handle changes)

 coreutils-cpZ-deprecate.patch |   24 ++++++++++++++++++++++++
 coreutils.spec                |   10 +++++++++-
 2 files changed, 33 insertions(+), 1 deletions(-)
---
diff --git a/coreutils-cpZ-deprecate.patch b/coreutils-cpZ-deprecate.patch
new file mode 100644
index 0000000..fce7b8c
--- /dev/null
+++ b/coreutils-cpZ-deprecate.patch
@@ -0,0 +1,24 @@
+diff -urNp coreutils-8.12-orig/src/copy.c coreutils-8.12/src/copy.c
+--- coreutils-8.12-orig/src/copy.c	2011-08-11 16:05:15.432485738 +0200
++++ coreutils-8.12/src/copy.c	2011-08-11 16:14:28.660360607 +0200
+@@ -850,7 +850,7 @@ copy_reg (char const *src_name, char con
+          1) the src context may prohibit writing, and
+          2) because it's more consistent to use the same context
+          that is used when the destination file doesn't already exist.  */
+-      if (x->preserve_security_context && 0 <= dest_desc)
++      if ((x->set_security_context || x->preserve_security_context) && 0 <= dest_desc)
+         {
+           bool all_errors = (!x->data_copy_required
+                              || x->require_preserve_context);
+Binary files coreutils-8.12-orig/src/.copy.c.swp and coreutils-8.12/src/.copy.c.swp differ
+diff -urNp coreutils-8.12-orig/src/cp.c coreutils-8.12/src/cp.c
+--- coreutils-8.12-orig/src/cp.c	2011-08-11 16:05:15.435486976 +0200
++++ coreutils-8.12/src/cp.c	2011-08-11 16:16:56.408644526 +0200
+@@ -1119,6 +1119,7 @@ main (int argc, char **argv)
+             exit( 1 );
+          }
+          x.set_security_context = true;
++         (void) fprintf(stderr, _("Warning, -Z/--context option is deprecated and will be removed soon!\nPlease use 'install' utility instead of cp for this functionality.\n"));
+          /* if there's a security_context given set new path 
+             components to that context, too */
+          if ( setfscreatecon(optarg) < 0 ) {
diff --git a/coreutils.spec b/coreutils.spec
index 09422e3..f69eb9a 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.12
-Release: 3%{?dist}
+Release: 4%{?dist}
 License: GPLv3+
 Group:   System Environment/Base
 Url:     http://www.gnu.org/software/coreutils/
@@ -64,6 +64,8 @@ Patch917: coreutils-8.4-su-pie.patch
 #(upstream did some SELinux implementation unlike with RedHat patch)
 Patch950: coreutils-selinux.patch
 Patch951: coreutils-selinuxmanpages.patch
+#Deprecate cp -Z/--context non-upstream option
+Patch952: coreutils-cpZ-deprecate.patch
 
 BuildRequires: libselinux-devel
 BuildRequires: libacl-devel
@@ -144,6 +146,7 @@ Libraries for coreutils package.
 #SELinux
 %patch950 -p1 -b .selinux
 %patch951 -p1 -b .selinuxman
+%patch952 -p1 -b .cpZ
 
 chmod a+x tests/misc/sort-mb-tests tests/df/direct || :
 
@@ -332,6 +335,11 @@ fi
 %{_libdir}/coreutils
 
 %changelog
+* Thu Aug 11 2011 Ondrej Vasik <ovasik at redhat.com> - 8.12-4
+- deprecate non-upstream cp -Z/--context (install should be
+  used instead of it), make it working if destination exists
+  (#715557)
+
 * Fri Jul 29 2011 Ondrej Vasik <ovasik at redhat.com> - 8.12-3
 - use acl_extended_file_nofollow() if available (#692823)
 


More information about the scm-commits mailing list