rpms/coreutils/devel coreutils-7.1-cp-a-xattrs.patch, NONE, 1.1 coreutils-DIR_COLORS.lightbgcolor, NONE, 1.1 coreutils-colorls.sh, 1.12, 1.13 coreutils.spec, 1.252, 1.253 coreutils-DIR_COLORS.xterm, 1.6, NONE

Ondrej Vasik ovasik at fedoraproject.org
Thu Mar 19 14:57:19 UTC 2009


Author: ovasik

Update of /cvs/extras/rpms/coreutils/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv27785

Modified Files:
	coreutils-colorls.sh coreutils.spec 
Added Files:
	coreutils-7.1-cp-a-xattrs.patch 
	coreutils-DIR_COLORS.lightbgcolor 
Removed Files:
	coreutils-DIR_COLORS.xterm 
Log Message:
do not ship /etc/DIR_COLORS.xterm (ship /etc/DIR_COLORS.lightbgcolor instead of it, try to preserve xattrs in cp -a when possible

coreutils-7.1-cp-a-xattrs.patch:

--- NEW FILE coreutils-7.1-cp-a-xattrs.patch ---
>From 2c0ac0d7fc6bce3abdbad8529e44318f1370a948 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= <ovasik at redhat.com>
Date: Wed, 11 Mar 2009 16:08:20 +0100
Subject: [PATCH] cp: make -a option preserve xattrs with reduced diagnostics

* copy.c (copy_attr_by_fd): Reduce xattr diagnostics for 'cp -a'.
  (copy_attr_by_name): Likewise.
* cp.c (main):  preserve xattrs with -a option, when possible
* doc/coreutils.texi: document that xattrs are preserved with
  cp -a, with no added diagnostics
* tests/misc/xattr: Add tests for 'cp --preserve=all' and 'cp -a'.
---
 doc/coreutils.texi |    7 +++----
 src/copy.c         |   22 +++++++++++++---------
 src/cp.c           |    1 +
 tests/misc/xattr   |   15 +++++++++++++--
 4 files changed, 30 insertions(+), 15 deletions(-)

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 2c1fae5..0bf978a 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -7262,10 +7262,9 @@ Preserve as much as possible of the structure and attributes of the
 original files in the copy (but do not attempt to preserve internal
 directory structure; i.e., @samp{ls -U} may list the entries in a copied
 directory in a different order).
-Try to preserve SELinux security context, but ignore any failure to do that
-and print no corresponding diagnostic.
-This option does not preserve extended attributes(xattr) at the moment.
-Equivalent to @option{-dR --preserve=all} with a few exceptions.
+Try to preserve SELinux security context and extended attributes (xattr),
+but ignore any failure to do that and print no corresponding diagnostic.
+Equivalent to @option{-dR --preserve=all} with the reduced diagnostics.
 
 @item -b
 @itemx @w{@kbd{--backup}[=@var{method}]}
diff --git a/src/copy.c b/src/copy.c
index e37fead..7b4dc08 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -153,13 +153,13 @@ copy_attr_quote (struct error_context *ctx ATTRIBUTE_UNUSED, char const *str)
 
 static void
 copy_attr_free (struct error_context *ctx ATTRIBUTE_UNUSED,
-		char const *str ATTRIBUTE_UNUSED)
+                char const *str ATTRIBUTE_UNUSED)
 {
 }
 
 static bool
 copy_attr_by_fd (char const *src_path, int src_fd,
-		 char const *dst_path, int dst_fd)
+                 char const *dst_path, int dst_fd, const struct cp_options *x)
 {
   struct error_context ctx =
   {
@@ -167,11 +167,13 @@ copy_attr_by_fd (char const *src_path, int src_fd,
     .quote = copy_attr_quote,
     .quote_free = copy_attr_free
   };
-  return 0 == attr_copy_fd (src_path, src_fd, dst_path, dst_fd, 0, &ctx);
+  return 0 == attr_copy_fd (src_path, src_fd, dst_path, dst_fd, 0,
+                            x->reduce_diagnostics ? NULL : &ctx);
 }
 
 static bool
-copy_attr_by_name (char const *src_path, char const *dst_path)
+copy_attr_by_name (char const *src_path, char const *dst_path,
+                   const struct cp_options *x)
 {
   struct error_context ctx =
   {
@@ -179,19 +181,21 @@ copy_attr_by_name (char const *src_path, char const *dst_path)
     .quote = copy_attr_quote,
     .quote_free = copy_attr_free
   };
-  return 0 == attr_copy_file (src_path, dst_path, 0, &ctx);
+  return 0 == attr_copy_file (src_path, dst_path, 0,
+                              x-> reduce_diagnostics ? NULL :&ctx);
 }
 #else /* USE_XATTR */
 
 static bool
 copy_attr_by_fd (char const *src_path, int src_fd,
-		 char const *dst_path, int dst_fd)
+                 char const *dst_path, int dst_fd, const struct cp_options *x)
 {
   return true;
 }
 
 static bool
-copy_attr_by_name (char const *src_path, char const *dst_path)
+copy_attr_by_name (char const *src_path, char const *dst_path,
+                   const struct cp_options *x)
 {
   return true;
 }
@@ -759,7 +763,7 @@ copy_reg (char const *src_name, char const *dst_name,
   set_author (dst_name, dest_desc, src_sb);
 
   if (x->preserve_xattr && ! copy_attr_by_fd (src_name, source_desc,
-					      dst_name, dest_desc)
+					      dst_name, dest_desc, x)
       && x->require_preserve_xattr)
     return false;
 
@@ -2076,7 +2080,7 @@ copy_internal (char const *src_name, char const *dst_name,
 
   set_author (dst_name, -1, &src_sb);
 
-  if (x->preserve_xattr && ! copy_attr_by_name (src_name, dst_name)
+  if (x->preserve_xattr && ! copy_attr_by_name (src_name, dst_name, x)
       && x->require_preserve_xattr)
     return false;
 
diff --git a/src/cp.c b/src/cp.c
index af4bd60..8785076 100644
--- a/src/cp.c
+++ b/src/cp.c
@@ -925,6 +925,7 @@ main (int argc, char **argv)
 	  x.require_preserve = true;
 	  if (selinux_enabled)
 	     x.preserve_security_context = true;
+	  x.preserve_xattr = true;
 	  x.reduce_diagnostics = true;
 	  x.recursive = true;
 	  break;
diff --git a/tests/misc/xattr b/tests/misc/xattr
index 4137c53..f067ff5 100755
--- a/tests/misc/xattr
+++ b/tests/misc/xattr
@@ -1,6 +1,7 @@
 #!/bin/sh
-# Ensure that cp --preserve=xattr and mv preserve extended attributes and
-# install does not preserve extended attributes.
+# Ensure that cp --preserve=xattr, cp --preserve=all and mv preserve extended
+# attributes and install does not preserve extended attributes.
+# cp -a should preserve xattr, error diagnostics should not be displayed
 
 # Copyright (C) 2009 Free Software Foundation, Inc.
 
@@ -66,6 +67,16 @@ cp --preserve=xattr a b || fail=1
 getfattr -d b >out_b || skip_test_ "failed to get xattr of file"
 grep -F "$xattr_pair" out_b >/dev/null || fail=1
 
+#test if --preserve=all option works
+cp --preserve=all a c || fail=1
+getfattr -d c >out_c || skip_test_ "failed to get xattr of file"
+grep -F "$xattr_pair" out_c >/dev/null || fail=1
+
+#test if -a option works without any diagnostics
+cp -a a d 2>err && test -s err && fail=1
+getfattr -d d >out_d || skip_test_ "failed to get xattr of file"
+grep -F "$xattr_pair" out_d >/dev/null || fail=1
+
 rm b || framework_failure
 
 # install should never preserve xattr
-- 
1.5.6.1.156.ge903b


--- NEW FILE coreutils-DIR_COLORS.lightbgcolor ---
# Configuration file for the color ls utility - modified for gray backgrounds
# Synchronized with coreutils 7.1 dircolors
# This file goes in the /etc directory, and must be world readable.
# You can copy this file to .dir_colors in your $HOME directory to override
# the system defaults.

# COLOR needs one of these arguments: 'tty' colorizes output to ttys, but not
# pipes. 'all' adds color characters to all output. 'none' shuts colorization
# off.
COLOR tty

# Extra command line options for ls go here.
# Basically these ones are:
#  -F = show '/' for dirs, '*' for executables, etc.
#  -T 0 = don't trust tab spacing when formatting ls output.
OPTIONS -F -T 0

# Below, there should be one TERM entry for each termtype that is colorizable
TERM linux
TERM console
TERM con132x25
TERM con132x30
TERM con132x43
TERM con132x60
TERM con80x25
TERM con80x28
TERM con80x30
TERM con80x43
TERM con80x50
TERM con80x60
TERM cons25
TERM xterm
TERM xterm-16color
TERM xterm-88color
TERM xterm-256color
TERM rxvt
TERM rxvt-unicode
TERM xterm-color
TERM color-xterm
TERM vt100
TERM dtterm
TERM color_xterm

# EIGHTBIT, followed by '1' for on, '0' for off. (8-bit output)
EIGHTBIT 1

# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
#NORMAL 00	# no color code at all
#FILE 00	# normal file, use no color at all
RESET 0
DIR 00;34	# directory
LINK 00;36	# symbolic link (If you set this to 'target' instead of a
		# numerical value, the color is as for the file pointed to.)
HARDLINK 44;37 # regular file with more than one link
FIFO 40;33	# pipe
SOCK 00;35	# socket
DOOR 00;35	# door
BLK 40;33;01	# block device driver
CHR 40;33;01	# character device driver
ORPHAN 40;31;01  # symlink to nonexistent file, or non-stat'able file
MISSING 01;05;37;41 # ... and the files they point to
SETUID 37;41	# file that is setuid (u+s)
SETGID 30;43	# file that is setgid (g+s)
CAPABILITY 30;41	# file with capability
STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w)
OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
STICKY 37;44	# dir with the sticky bit set (+t) and not other-writable


# This is for files with execute permission:
EXEC 00;32

# List any file extensions like '.gz' or '.tar' that you would like ls
# to colorize below. Put the extension, a space, and the color init string.
# (and any comments you want to add after a '#')
#.cmd 00;32 # executables (green)
#.exe 00;32
#.com 00;32
#.btm 00;32
#.bat 00;32
#.sh  00;32
#.csh 00;32
 # archives or compressed (red)
.tar 00;31
.tgz 00;31
.arj 00;31
.taz 00;31
.lzh 00;31
.lzma 00;31
.zip 00;31
.z   00;31
.Z   00;31
.dz  00;31
.gz  00;31
.bz2 00;31
.tbz2 00;31
.bz  00;31
.tz  00;31
.deb 00;31
.rpm 00;31
.jar 00;31
.rar 00;31
.ace 00;31
.zoo 00;31
.cpio 00;31
.7z  00;31
.rz  00;31
.xz  00;31
# image formats (magenta)
.jpg 00;35
.jpeg 00;35
.gif 00;35
.bmp 00;35
.pbm 00;35
.pgm 00;35
.ppm 00;35
.tga 00;35
.xbm 00;35
.xpm 00;35
.tif 00;35
.tiff 00;35
.png 00;35
.mng 00;35
.pcx 00;35
.mov 00;35
.mpg 00;35
.mpeg 00;35
.m2v 00;35
.mkv 00;35
.ogm 00;35
.mp4 00;35
.m4v 00;35
.mp4v 00;35
.vob 00;35
.qt  00;35
.nuv 00;35
.wmv 00;35
.asf 00;35
.rm  00;35
.rmvb 00;35
.flc 00;35
.avi 00;35
.fli 00;35
.flv 00;35
.gl 00;35
.dl 00;35
.xcf 00;35
.xwd 00;35
.yuv 00;35
.svg 00;35
.svgz 00;35
# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
.axv 00;35
.anx 00;35
.ogv 00;35
.ogx 00;35
# audio formats (cyan)
.aac 00;36
.au 00;36
.flac 00;36
.mid 00;36
.midi 00;36
.mka 00;36
.mp3 00;36
.mpc 00;36
.ogg 00;36
.ra 00;36
.wav 00;36
# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
.axa 00;36
.oga 00;36
.spx 00;36
.xspf 00;36


Index: coreutils-colorls.sh
===================================================================
RCS file: /cvs/extras/rpms/coreutils/devel/coreutils-colorls.sh,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- coreutils-colorls.sh	7 Apr 2008 20:16:00 -0000	1.12
+++ coreutils-colorls.sh	19 Mar 2009 14:56:49 -0000	1.13
@@ -2,7 +2,7 @@
 
 #when USER_LS_COLORS defined do not override user LS_COLORS, but use them.
 if [ -z "$USER_LS_COLORS" ]; then
-  
+
   alias ll='ls -l' 2>/dev/null
   alias l.='ls -d .*' 2>/dev/null
 




--- coreutils-DIR_COLORS.xterm DELETED ---




More information about the fedora-extras-commits mailing list