cp/mv: --no-clobber option, xattr support (#202823)

This commit is contained in:
Kamil Dudka 2009-01-28 17:29:41 +00:00
parent f7b5421d46
commit b264912790
5 changed files with 1297 additions and 172 deletions

View File

@ -1,6 +1,6 @@
diff -urNp coreutils-6.12-orig/AUTHORS coreutils-6.12/AUTHORS diff -urNp coreutils-7.0.orig/AUTHORS coreutils-7.0/AUTHORS
--- coreutils-6.12-orig/AUTHORS 2008-10-21 14:58:31.000000000 +0200 --- coreutils-7.0.orig/AUTHORS 2008-08-24 22:58:15.000000000 +0200
+++ coreutils-6.12/AUTHORS 2008-10-21 15:00:05.000000000 +0200 +++ coreutils-7.0/AUTHORS 2009-01-28 18:11:00.316247411 +0100
@@ -63,6 +63,7 @@ pwd: Jim Meyering @@ -63,6 +63,7 @@ pwd: Jim Meyering
readlink: Dmitry V. Levin readlink: Dmitry V. Levin
rm: Paul Rubin, David MacKenzie, Richard M. Stallman, Jim Meyering rm: Paul Rubin, David MacKenzie, Richard M. Stallman, Jim Meyering
@ -9,9 +9,9 @@ diff -urNp coreutils-6.12-orig/AUTHORS coreutils-6.12/AUTHORS
runcon: Russell Coker runcon: Russell Coker
seq: Ulrich Drepper seq: Ulrich Drepper
sha1sum: Ulrich Drepper, Scott Miller, David Madore sha1sum: Ulrich Drepper, Scott Miller, David Madore
diff -urNp coreutils-6.12-orig/man/Makefile.am coreutils-6.12/man/Makefile.am diff -urNp coreutils-7.0.orig/man/Makefile.am coreutils-7.0/man/Makefile.am
--- coreutils-6.12-orig/man/Makefile.am 2008-05-06 11:28:24.000000000 +0200 --- coreutils-7.0.orig/man/Makefile.am 2008-09-27 19:28:54.000000000 +0200
+++ coreutils-6.12/man/Makefile.am 2008-10-21 15:00:13.000000000 +0200 +++ coreutils-7.0/man/Makefile.am 2009-01-28 18:11:00.317247417 +0100
@@ -93,6 +93,7 @@ readlink.1: $(common_dep) $(srcdir)/read @@ -93,6 +93,7 @@ readlink.1: $(common_dep) $(srcdir)/read
rm.1: $(common_dep) $(srcdir)/rm.x ../src/rm.c rm.1: $(common_dep) $(srcdir)/rm.x ../src/rm.c
rmdir.1: $(common_dep) $(srcdir)/rmdir.x ../src/rmdir.c rmdir.1: $(common_dep) $(srcdir)/rmdir.x ../src/rmdir.c
@ -20,9 +20,25 @@ diff -urNp coreutils-6.12-orig/man/Makefile.am coreutils-6.12/man/Makefile.am
seq.1: $(common_dep) $(srcdir)/seq.x ../src/seq.c seq.1: $(common_dep) $(srcdir)/seq.x ../src/seq.c
sha1sum.1: $(common_dep) $(srcdir)/sha1sum.x ../src/md5sum.c sha1sum.1: $(common_dep) $(srcdir)/sha1sum.x ../src/md5sum.c
sha224sum.1: $(common_dep) $(srcdir)/sha224sum.x ../src/md5sum.c sha224sum.1: $(common_dep) $(srcdir)/sha224sum.x ../src/md5sum.c
diff -urNp coreutils-6.12-orig/README coreutils-6.12/README diff -urNp coreutils-7.0.orig/man/runuser.x coreutils-7.0/man/runuser.x
--- coreutils-6.12-orig/README 2008-05-15 20:44:37.000000000 +0200 --- coreutils-7.0.orig/man/runuser.x 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-6.12/README 2008-10-21 14:59:29.000000000 +0200 +++ coreutils-7.0/man/runuser.x 2009-01-28 18:11:00.321247443 +0100
@@ -0,0 +1,12 @@
+[NAME]
+runuser \- run a shell with substitute user and group IDs
+[DESCRIPTION]
+.\" Add any additional description here
+[SEE ALSO]
+.TP
+More detailed Texinfo documentation could be found by command
+.TP
+\t\fBinfo su invocation\fR\t
+.TP
+since the command \fBrunuser\fR is trimmed down version of command \fBrunuser\fR.
+.br
diff -urNp coreutils-7.0.orig/README coreutils-7.0/README
--- coreutils-7.0.orig/README 2008-08-24 22:30:10.000000000 +0200
+++ coreutils-7.0/README 2009-01-28 18:11:00.318247424 +0100
@@ -12,10 +12,10 @@ The programs that can be built with this @@ -12,10 +12,10 @@ The programs that can be built with this
factor false fmt fold groups head hostid hostname id install join kill factor false fmt fold groups head hostid hostname id install join kill
link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup
@ -38,9 +54,9 @@ diff -urNp coreutils-6.12-orig/README coreutils-6.12/README
See the file NEWS for a list of major changes in the current release. See the file NEWS for a list of major changes in the current release.
diff -urNp coreutils-6.12-orig/src/Makefile.am coreutils-6.12/src/Makefile.am diff -urNp coreutils-7.0.orig/src/Makefile.am coreutils-7.0/src/Makefile.am
--- coreutils-6.12-orig/src/Makefile.am 2008-10-21 14:58:31.000000000 +0200 --- coreutils-7.0.orig/src/Makefile.am 2009-01-28 18:10:10.756926000 +0100
+++ coreutils-6.12/src/Makefile.am 2008-10-21 14:59:58.000000000 +0200 +++ coreutils-7.0/src/Makefile.am 2009-01-28 18:11:59.658631933 +0100
@@ -38,7 +38,7 @@ EXTRA_PROGRAMS = \ @@ -38,7 +38,7 @@ EXTRA_PROGRAMS = \
shuf sort split sum tac tail tr tsort unexpand uniq wc \ shuf sort split sum tac tail tr tsort unexpand uniq wc \
basename date dirname echo env expr factor false \ basename date dirname echo env expr factor false \
@ -50,9 +66,9 @@ diff -urNp coreutils-6.12-orig/src/Makefile.am coreutils-6.12/src/Makefile.am
test timeout true truncate tty whoami yes \ test timeout true truncate tty whoami yes \
base64 base64
@@ -142,6 +142,10 @@ cp_LDADD += $(LIB_ACL) @@ -154,6 +154,10 @@ cp_LDADD += $(LIB_ACL) $(LIB_XATTR)
mv_LDADD += $(LIB_ACL) mv_LDADD += $(LIB_ACL) $(LIB_XATTR)
ginstall_LDADD += $(LIB_ACL) ginstall_LDADD += $(LIB_ACL) $(LIB_XATTR)
+runuser_SOURCES = su.c +runuser_SOURCES = su.c
+runuser_CFLAGS = -DRUNUSER -DAUTHORS="\"David MacKenzie, Dan Walsh\"" +runuser_CFLAGS = -DRUNUSER -DAUTHORS="\"David MacKenzie, Dan Walsh\""
@ -61,7 +77,7 @@ diff -urNp coreutils-6.12-orig/src/Makefile.am coreutils-6.12/src/Makefile.am
stat_LDADD = $(LDADD) $(LIB_SELINUX) stat_LDADD = $(LDADD) $(LIB_SELINUX)
# Append $(LIBICONV) to each program that uses proper_name_utf8. # Append $(LIBICONV) to each program that uses proper_name_utf8.
@@ -159,7 +163,7 @@ RELEASE_YEAR = \ @@ -173,7 +177,7 @@ RELEASE_YEAR = \
`sed -n '/.*COPYRIGHT_YEAR = \([0-9][0-9][0-9][0-9]\) };/s//\1/p' \ `sed -n '/.*COPYRIGHT_YEAR = \([0-9][0-9][0-9][0-9]\) };/s//\1/p' \
$(top_srcdir)/lib/version-etc.c` $(top_srcdir)/lib/version-etc.c`
@ -70,9 +86,9 @@ diff -urNp coreutils-6.12-orig/src/Makefile.am coreutils-6.12/src/Makefile.am
installed_su = $(DESTDIR)$(bindir)/`echo su|sed '$(transform)'` installed_su = $(DESTDIR)$(bindir)/`echo su|sed '$(transform)'`
diff -urNp coreutils-6.12-orig/src/su.c coreutils-6.12/src/su.c diff -urNp coreutils-7.0.orig/src/su.c coreutils-7.0/src/su.c
--- coreutils-6.12-orig/src/su.c 2008-10-21 14:58:31.000000000 +0200 --- coreutils-7.0.orig/src/su.c 2009-01-28 18:10:10.801926000 +0100
+++ coreutils-6.12/src/su.c 2008-10-21 15:07:05.000000000 +0200 +++ coreutils-7.0/src/su.c 2009-01-28 18:11:00.320247437 +0100
@@ -109,9 +109,15 @@ @@ -109,9 +109,15 @@
#include "error.h" #include "error.h"
@ -113,7 +129,7 @@ diff -urNp coreutils-6.12-orig/src/su.c coreutils-6.12/src/su.c
#ifdef USE_PAM #ifdef USE_PAM
; ;
#else #else
@@ -186,6 +200,10 @@ static struct option const longopts[] = @@ -183,6 +197,10 @@ static struct option const longopts[] =
{"login", no_argument, NULL, 'l'}, {"login", no_argument, NULL, 'l'},
{"preserve-environment", no_argument, NULL, 'p'}, {"preserve-environment", no_argument, NULL, 'p'},
{"shell", required_argument, NULL, 's'}, {"shell", required_argument, NULL, 's'},
@ -124,7 +140,7 @@ diff -urNp coreutils-6.12-orig/src/su.c coreutils-6.12/src/su.c
{GETOPT_HELP_OPTION_DECL}, {GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL}, {GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0} {NULL, 0, NULL, 0}
@@ -287,10 +305,12 @@ correct_password (const struct passwd *p @@ -284,10 +302,12 @@ correct_password (const struct passwd *p
retval = pam_start(PROGRAM_NAME, pw->pw_name, &conv, &pamh); retval = pam_start(PROGRAM_NAME, pw->pw_name, &conv, &pamh);
PAM_BAIL_P; PAM_BAIL_P;
@ -137,7 +153,7 @@ diff -urNp coreutils-6.12-orig/src/su.c coreutils-6.12/src/su.c
caller = getpwuid(getuid()); caller = getpwuid(getuid());
if(caller != NULL && caller->pw_name != NULL) { if(caller != NULL && caller->pw_name != NULL) {
@@ -307,6 +327,11 @@ correct_password (const struct passwd *p @@ -304,6 +324,11 @@ correct_password (const struct passwd *p
retval = pam_set_item(pamh, PAM_TTY, tty_name); retval = pam_set_item(pamh, PAM_TTY, tty_name);
PAM_BAIL_P; PAM_BAIL_P;
} }
@ -149,7 +165,7 @@ diff -urNp coreutils-6.12-orig/src/su.c coreutils-6.12/src/su.c
retval = pam_authenticate(pamh, 0); retval = pam_authenticate(pamh, 0);
PAM_BAIL_P; PAM_BAIL_P;
retval = pam_acct_mgmt(pamh, 0); retval = pam_acct_mgmt(pamh, 0);
@@ -316,6 +341,7 @@ correct_password (const struct passwd *p @@ -313,6 +338,7 @@ correct_password (const struct passwd *p
PAM_BAIL_P; PAM_BAIL_P;
} }
PAM_BAIL_P; PAM_BAIL_P;
@ -157,7 +173,7 @@ diff -urNp coreutils-6.12-orig/src/su.c coreutils-6.12/src/su.c
/* must be authenticated if this point was reached */ /* must be authenticated if this point was reached */
return 1; return 1;
#else /* !USE_PAM */ #else /* !USE_PAM */
@@ -397,11 +423,22 @@ modify_environment (const struct passwd @@ -394,11 +420,22 @@ modify_environment (const struct passwd
/* Become the user and group(s) specified by PW. */ /* Become the user and group(s) specified by PW. */
static void static void
@ -182,7 +198,7 @@ diff -urNp coreutils-6.12-orig/src/su.c coreutils-6.12/src/su.c
#ifdef USE_PAM #ifdef USE_PAM
pam_close_session(pamh, 0); pam_close_session(pamh, 0);
pam_end(pamh, PAM_ABORT); pam_end(pamh, PAM_ABORT);
@@ -448,7 +485,11 @@ pam_copyenv (pam_handle_t *pamh) @@ -445,7 +482,11 @@ pam_copyenv (pam_handle_t *pamh)
static void static void
run_shell (char const *shell, char const *command, char **additional_args, run_shell (char const *shell, char const *command, char **additional_args,
@ -195,7 +211,7 @@ diff -urNp coreutils-6.12-orig/src/su.c coreutils-6.12/src/su.c
{ {
size_t n_args = 1 + fast_startup + 2 * !!command + n_additional_args + 1; size_t n_args = 1 + fast_startup + 2 * !!command + n_additional_args + 1;
char const **args = xnmalloc (n_args, sizeof *args); char const **args = xnmalloc (n_args, sizeof *args);
@@ -479,7 +520,11 @@ run_shell (char const *shell, char const @@ -476,7 +517,11 @@ run_shell (char const *shell, char const
child = fork(); child = fork();
if (child == 0) { /* child shell */ if (child == 0) { /* child shell */
@ -208,7 +224,7 @@ diff -urNp coreutils-6.12-orig/src/su.c coreutils-6.12/src/su.c
pam_end(pamh, 0); pam_end(pamh, 0);
if (!same_session) if (!same_session)
setsid (); setsid ();
@@ -623,6 +668,26 @@ usage (int status) @@ -620,6 +665,26 @@ usage (int status)
else else
{ {
printf (_("Usage: %s [OPTION]... [-] [USER [ARG]...]\n"), program_name); printf (_("Usage: %s [OPTION]... [-] [USER [ARG]...]\n"), program_name);
@ -235,7 +251,7 @@ diff -urNp coreutils-6.12-orig/src/su.c coreutils-6.12/src/su.c
fputs (_("\ fputs (_("\
Change the effective user id and group id to that of USER.\n\ Change the effective user id and group id to that of USER.\n\
\n\ \n\
@@ -635,6 +700,7 @@ Change the effective user id and group i @@ -632,6 +697,7 @@ Change the effective user id and group i
-p same as -m\n\ -p same as -m\n\
-s, --shell=SHELL run SHELL if /etc/shells allows it\n\ -s, --shell=SHELL run SHELL if /etc/shells allows it\n\
"), stdout); "), stdout);
@ -243,7 +259,7 @@ diff -urNp coreutils-6.12-orig/src/su.c coreutils-6.12/src/su.c
fputs (HELP_OPTION_DESCRIPTION, stdout); fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout); fputs (VERSION_OPTION_DESCRIPTION, stdout);
fputs (_("\ fputs (_("\
@@ -656,6 +722,12 @@ main (int argc, char **argv) @@ -653,6 +719,12 @@ main (int argc, char **argv)
char *shell = NULL; char *shell = NULL;
struct passwd *pw; struct passwd *pw;
struct passwd pw_copy; struct passwd pw_copy;
@ -256,7 +272,7 @@ diff -urNp coreutils-6.12-orig/src/su.c coreutils-6.12/src/su.c
initialize_main (&argc, &argv); initialize_main (&argc, &argv);
set_program_name (argv[0]); set_program_name (argv[0]);
@@ -670,7 +742,11 @@ main (int argc, char **argv) @@ -667,7 +739,11 @@ main (int argc, char **argv)
simulate_login = false; simulate_login = false;
change_environment = true; change_environment = true;
@ -269,7 +285,7 @@ diff -urNp coreutils-6.12-orig/src/su.c coreutils-6.12/src/su.c
{ {
switch (optc) switch (optc)
{ {
@@ -700,6 +776,28 @@ main (int argc, char **argv) @@ -697,6 +773,28 @@ main (int argc, char **argv)
shell = optarg; shell = optarg;
break; break;
@ -298,7 +314,7 @@ diff -urNp coreutils-6.12-orig/src/su.c coreutils-6.12/src/su.c
case_GETOPT_HELP_CHAR; case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS); case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
@@ -738,7 +836,20 @@ main (int argc, char **argv) @@ -735,7 +833,20 @@ main (int argc, char **argv)
: DEFAULT_SHELL); : DEFAULT_SHELL);
endpwent (); endpwent ();
@ -320,7 +336,7 @@ diff -urNp coreutils-6.12-orig/src/su.c coreutils-6.12/src/su.c
{ {
#ifdef SYSLOG_FAILURE #ifdef SYSLOG_FAILURE
log_su (pw, false); log_su (pw, false);
@@ -770,8 +881,16 @@ main (int argc, char **argv) @@ -767,8 +878,16 @@ main (int argc, char **argv)
modify_environment (pw, shell); modify_environment (pw, shell);
#ifndef USE_PAM #ifndef USE_PAM
@ -339,10 +355,10 @@ diff -urNp coreutils-6.12-orig/src/su.c coreutils-6.12/src/su.c
+#endif +#endif
+ ); + );
} }
diff -urNp coreutils-6.12-orig/tests/misc/help-version coreutils-6.12/tests/misc/help-version diff -urNp coreutils-7.0.orig/tests/misc/help-version coreutils-7.0/tests/misc/help-version
--- coreutils-6.12-orig/tests/misc/help-version 2008-05-27 13:39:18.000000000 +0200 --- coreutils-7.0.orig/tests/misc/help-version 2008-09-27 19:28:54.000000000 +0200
+++ coreutils-6.12/tests/misc/help-version 2008-10-21 14:59:16.000000000 +0200 +++ coreutils-7.0/tests/misc/help-version 2009-01-28 18:11:00.321247443 +0100
@@ -146,6 +146,7 @@ printf_args=foo @@ -148,6 +148,7 @@ printf_args=foo
seq_args=10 seq_args=10
sleep_args=0 sleep_args=0
su_args=--version su_args=--version
@ -350,18 +366,3 @@ diff -urNp coreutils-6.12-orig/tests/misc/help-version coreutils-6.12/tests/misc
timeout_args=--version timeout_args=--version
# I'd rather not run sync, since it spins up disks that I've # I'd rather not run sync, since it spins up disks that I've
--- /dev/null 2007-01-09 09:38:07.860075128 +0000
+++ coreutils-6.7/man/runuser.x 2007-01-09 17:27:56.000000000 +0000
@@ -0,0 +1,12 @@
+[NAME]
+runuser \- run a shell with substitute user and group IDs
+[DESCRIPTION]
+.\" Add any additional description here
+[SEE ALSO]
+.TP
+More detailed Texinfo documentation could be found by command
+.TP
+\t\fBinfo su invocation\fR\t
+.TP
+since the command \fBrunuser\fR is trimmed down version of command \fBrunuser\fR.
+.br

322
coreutils-7.0-cp-mv-n.patch Normal file
View File

@ -0,0 +1,322 @@
diff -ruNp coreutils-7.0.orig/doc/coreutils.texi coreutils-7.0/doc/coreutils.texi
--- coreutils-7.0.orig/doc/coreutils.texi 2009-01-28 15:28:14.724301000 +0100
+++ coreutils-7.0/doc/coreutils.texi 2009-01-28 16:42:36.319138655 +0100
@@ -7295,6 +7295,9 @@ description of @option{--remove-destinat
This option is independent of the @option{--interactive} or
@option{-i} option: neither cancels the effect of the other.
+This option is redundant if the @option{--no-clobber} or @option{-n} option is
+used.
+
@item -H
@opindex -H
If a command line argument specifies a symbolic link, then copy the
@@ -7307,7 +7310,8 @@ via recursive traversal.
@opindex -i
@opindex --interactive
When copying a file other than a directory, prompt whether to
-overwrite an existing destination file.
+overwrite an existing destination file. The @option{-i} option overrides
+a previous @option{-n} option.
@item -l
@itemx --link
@@ -7321,6 +7325,14 @@ Make hard links instead of copies of non
@opindex --dereference
Follow symbolic links when copying from them.
+@item -n
+@itemx --no-clobber
+@opindex -n
+@opindex --no-clobber
+Do not overwrite an existing file. The @option{-n} option overrides a previous
+@option{-i} option. This option is mutually exclusive with @option{-b} or
+@option{--backup} option.
+
@item -P
@itemx --no-dereference
@opindex -P
@@ -8076,6 +8088,11 @@ The program accepts the following option
@opindex --force
@cindex prompts, omitting
Do not prompt the user before removing a destination file.
+@macro mvOptsIfn
+If you specify more than one of the @option{-i}, @option{-f}, @option{-n}
+options, only the final one takes effect.
+@end macro
+@mvOptsIfn
@item -i
@itemx --interactive
@@ -8085,6 +8102,16 @@ Do not prompt the user before removing a
Prompt whether to overwrite each existing destination file, regardless
of its permissions.
If the response is not affirmative, the file is skipped.
+@mvOptsIfn
+
+@item -n
+@itemx --no-clobber
+@opindex -n
+@opindex --no-clobber
+@cindex prompts, omitting
+Do not overwrite an existing file.
+@mvOptsIfn
+This option is mutually exclusive with @option{-b} or @option{--backup} option.
@itemx @w{@kbd{--reply}=@var{how}}
@opindex --reply
diff -ruNp coreutils-7.0.orig/src/cp.c coreutils-7.0/src/cp.c
--- coreutils-7.0.orig/src/cp.c 2008-09-27 19:28:54.000000000 +0200
+++ coreutils-7.0/src/cp.c 2009-01-28 16:43:08.501394935 +0100
@@ -1,5 +1,5 @@
/* cp.c -- file copying (main routines)
- Copyright (C) 89, 90, 91, 1995-2008 Free Software Foundation, Inc.
+ Copyright (C) 89, 90, 91, 1995-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -129,6 +129,7 @@ static struct option const long_opts[] =
{"force", no_argument, NULL, 'f'},
{"interactive", no_argument, NULL, 'i'},
{"link", no_argument, NULL, 'l'},
+ {"no-clobber", no_argument, NULL, 'n'},
{"no-dereference", no_argument, NULL, 'P'},
{"no-preserve", required_argument, NULL, NO_PRESERVE_ATTRIBUTES_OPTION},
{"no-target-directory", no_argument, NULL, 'T'},
@@ -182,8 +183,10 @@ Mandatory arguments to long options are
"), stdout);
fputs (_("\
-f, --force if an existing destination file cannot be\n\
- opened, remove it and try again\n\
- -i, --interactive prompt before overwrite\n\
+ opened, remove it and try again (redundant if\n\
+ the -n option is used)\n\
+ -i, --interactive prompt before overwrite (overrides a previous -n\n\
+ option)\n\
-H follow command-line symbolic links in SOURCE\n\
"), stdout);
fputs (_("\
@@ -191,6 +194,8 @@ Mandatory arguments to long options are
-L, --dereference always follow symbolic links in SOURCE\n\
"), stdout);
fputs (_("\
+ -n, --no-clobber do not overwrite an existing file (overrides\n\
+ a previous -i option)\n\
-P, --no-dereference never follow symbolic links in SOURCE\n\
"), stdout);
fputs (_("\
@@ -909,7 +914,7 @@ main (int argc, char **argv)
we'll actually use backup_suffix_string. */
backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
- while ((c = getopt_long (argc, argv, "abdfHilLprst:uvxPRS:T",
+ while ((c = getopt_long (argc, argv, "abdfHilLnprst:uvxPRS:T",
long_opts, NULL))
!= -1)
{
@@ -965,6 +970,10 @@ main (int argc, char **argv)
x.dereference = DEREF_ALWAYS;
break;
+ case 'n':
+ x.interactive = I_ALWAYS_NO;
+ break;
+
case 'P':
x.dereference = DEREF_NEVER;
break;
@@ -1072,6 +1081,13 @@ main (int argc, char **argv)
usage (EXIT_FAILURE);
}
+ if (make_backups && x.interactive == I_ALWAYS_NO)
+ {
+ error (0, 0,
+ _("options --backup and --no-clobber are mutually exclusive"));
+ usage (EXIT_FAILURE);
+ }
+
if (backup_suffix_string)
simple_backup_suffix = xstrdup (backup_suffix_string);
diff -ruNp coreutils-7.0.orig/src/mv.c coreutils-7.0/src/mv.c
--- coreutils-7.0.orig/src/mv.c 2008-08-24 22:30:10.000000000 +0200
+++ coreutils-7.0/src/mv.c 2009-01-28 16:42:36.906143329 +0100
@@ -1,5 +1,5 @@
/* mv -- move or rename files
- Copyright (C) 86, 89, 90, 91, 1995-2008 Free Software Foundation, Inc.
+ Copyright (C) 86, 89, 90, 91, 1995-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -76,6 +76,7 @@ static struct option const long_options[
{"backup", optional_argument, NULL, 'b'},
{"force", no_argument, NULL, 'f'},
{"interactive", no_argument, NULL, 'i'},
+ {"no-clobber", no_argument, NULL, 'n'},
{"no-target-directory", no_argument, NULL, 'T'},
{"reply", required_argument, NULL, REPLY_OPTION}, /* Deprecated 2005-07-03,
remove in 2008. */
@@ -312,6 +313,8 @@ Mandatory arguments to long options are
-b like --backup but does not accept an argument\n\
-f, --force do not prompt before overwriting\n\
-i, --interactive prompt before overwrite\n\
+ -n, --no-clobber do not overwrite an existing file\n\
+If you specify more than one of -i, -f, -n, only the final one takes effect.\n\
"), stdout);
fputs (_("\
--strip-trailing-slashes remove any trailing slashes from each SOURCE\n\
@@ -374,7 +377,7 @@ main (int argc, char **argv)
we'll actually use backup_suffix_string. */
backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
- while ((c = getopt_long (argc, argv, "bfit:uvS:T", long_options, NULL))
+ while ((c = getopt_long (argc, argv, "bfint:uvS:T", long_options, NULL))
!= -1)
{
switch (c)
@@ -396,6 +399,9 @@ main (int argc, char **argv)
error (0, 0,
_("the --reply option is deprecated; use -i or -f instead"));
break;
+ case 'n':
+ x.interactive = I_ALWAYS_NO;
+ break;
case STRIP_TRAILING_SLASHES_OPTION:
remove_trailing_slashes = true;
break;
@@ -468,6 +474,13 @@ main (int argc, char **argv)
quote (file[n_files - 1]));
}
+ if (make_backups && x.interactive == I_ALWAYS_NO)
+ {
+ error (0, 0,
+ _("options --backup and --no-clobber are mutually exclusive"));
+ usage (EXIT_FAILURE);
+ }
+
if (backup_suffix_string)
simple_backup_suffix = xstrdup (backup_suffix_string);
diff -ruNp coreutils-7.0.orig/tests/cp/cp-i coreutils-7.0/tests/cp/cp-i
--- coreutils-7.0.orig/tests/cp/cp-i 2008-09-27 19:28:54.000000000 +0200
+++ coreutils-7.0/tests/cp/cp-i 2009-01-28 16:42:37.092144811 +0100
@@ -31,4 +31,40 @@ fail=0
# coreutils 6.2 cp would neglect to prompt in this case.
echo n | cp -iR a b 2>/dev/null || fail=1
+# test miscellaneous combinations of -f -i -n parameters
+touch c d || framework_failure
+echo "\`c' -> \`d'" > out_copy
+> out_empty
+
+# ask for overwrite, answer no
+echo n | cp -vi c d 2>/dev/null > out1 || fail=1
+compare out1 out_empty || fail=1
+
+# ask for overwrite, answer yes
+echo y | cp -vi c d 2>/dev/null > out2 || fail=1
+compare out2 out_copy || fail=1
+
+# -i wins over -n
+echo y | cp -vni c d 2>/dev/null > out3 || fail=1
+compare out3 out_copy || fail=1
+
+# -n wins over -i
+echo y | cp -vin c d 2>/dev/null > out4 || fail=1
+compare out4 out_empty || fail=1
+
+# ask for overwrite, answer yes
+echo y | cp -vfi c d 2>/dev/null > out5 || fail=1
+compare out5 out_copy || fail=1
+
+# do not ask, prevent from overwrite
+echo n | cp -vfn c d 2>/dev/null > out6 || fail=1
+compare out6 out_empty || fail=1
+
+# do not ask, prevent from overwrite
+echo n | cp -vnf c d 2>/dev/null > out7 || fail=1
+compare out7 out_empty || fail=1
+
+# options --backup and --no-clobber are mutually exclusive
+cp -bn c d 2>/dev/null && fail=1
+
Exit $fail
diff -ruNp coreutils-7.0.orig/tests/Makefile.am coreutils-7.0/tests/Makefile.am
--- coreutils-7.0.orig/tests/Makefile.am 2008-09-27 19:28:54.000000000 +0200
+++ coreutils-7.0/tests/Makefile.am 2009-01-28 16:42:37.596148824 +0100
@@ -374,6 +374,7 @@ TESTS = \
mv/into-self-3 \
mv/into-self-4 \
mv/leak-fd \
+ mv/mv-n \
mv/mv-special-1 \
mv/no-target-dir \
mv/part-fail \
diff -ruNp coreutils-7.0.orig/tests/mv/mv-n coreutils-7.0/tests/mv/mv-n
--- coreutils-7.0.orig/tests/mv/mv-n 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-7.0/tests/mv/mv-n 2009-01-28 16:42:37.596148824 +0100
@@ -0,0 +1,62 @@
+#!/bin/sh
+# Test whether mv -n works as documented (not overwrite target).
+
+# Copyright (C) 2006-2008 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if test "$VERBOSE" = yes; then
+ set -x
+ mv --version
+fi
+
+. $srcdir/test-lib.sh
+
+fail=0
+
+# test miscellaneous combinations of -f -i -n parameters
+touch a b || framework_failure
+echo "\`a' -> \`b'" > out_move
+> out_empty
+
+# ask for overwrite, answer no
+touch a b || framework_failure
+echo n | mv -vi a b 2>/dev/null > out1 || fail=1
+compare out1 out_empty || fail=1
+
+# ask for overwrite, answer yes
+touch a b || framework_failure
+echo y | mv -vi a b 2>/dev/null > out2 || fail=1
+compare out2 out_move || fail=1
+
+# -n wins (as the last option)
+touch a b || framework_failure
+echo y | mv -vin a b 2>/dev/null > out3 || fail=1
+compare out3 out_empty || fail=1
+
+# -n wins (as the last option)
+touch a b || framework_failure
+echo y | mv -vfn a b 2>/dev/null > out4 || fail=1
+compare out4 out_empty || fail=1
+
+# -n wins (as the last option)
+touch a b || framework_failure
+echo y | mv -vifn a b 2>/dev/null > out5 || fail=1
+compare out5 out_empty || fail=1
+
+# options --backup and --no-clobber are mutually exclusive
+touch a || framework_failure
+mv -bn a b 2>/dev/null && fail=1
+
+Exit $fail

792
coreutils-7.0-xattr.patch Normal file
View File

@ -0,0 +1,792 @@
diff -ruNp coreutils-7.0.orig/doc/coreutils.texi coreutils-7.0/doc/coreutils.texi
--- coreutils-7.0.orig/doc/coreutils.texi 2009-01-28 17:10:24.453415000 +0100
+++ coreutils-7.0/doc/coreutils.texi 2009-01-28 17:12:04.986109287 +0100
@@ -7346,7 +7346,7 @@ symbolic links in the destination are al
@itemx @w{@kbd{--preserve}[=@var{attribute_list}]}
@opindex -p
@opindex --preserve
-@cindex file information, preserving
+@cindex file information, preserving, extended attributes, xattr
Preserve the specified attributes of the original files.
If specified, the @var{attribute_list} must be a comma-separated list
of one or more of the following strings:
@@ -7373,6 +7373,11 @@ Preserve in the destination files
any links between corresponding source files.
@c Give examples illustrating how hard links are preserved.
@c Also, show how soft links map to hard links with -L and -H.
+@itemx xattr
+Preserve extended attributes if @command{cp} is built with xattr support,
+and xattrs are supported and enabled on your file system. If SELinux context
+and/or ACLs are implemented using xattrs, they are preserved as well by this
+option.
@itemx all
Preserve all file attributes.
Equivalent to specifying all of the above.
@@ -7912,6 +7917,9 @@ attributes of destination files. It is
copy programs into their destination directories. It refuses to copy
files onto themselves.
+@cindex extended attributes, xattr
+@command{install} never preserves extended attributes (xattr).
+
The program accepts the following options. Also see @ref{Common options}.
@table @samp
@@ -8060,6 +8068,9 @@ directory succeeded, but the second didn
the destination partition and the second and third would be left on the
original partition.
+@cindex extended attributes, xattr
+@command{mv} always tries to copy extended attributes (xattr).
+
@cindex prompting, and @command{mv}
If a destination file exists but is normally unwritable, standard input
is a terminal, and the @option{-f} or @option{--force} option is not given,
diff -ruNp coreutils-7.0.orig/m4/prereq.m4 coreutils-7.0/m4/prereq.m4
--- coreutils-7.0.orig/m4/prereq.m4 2008-06-21 19:04:15.000000000 +0200
+++ coreutils-7.0/m4/prereq.m4 2009-01-28 17:12:04.987109294 +0100
@@ -38,6 +38,7 @@ AC_DEFUN([gl_PREREQ],
# handles that; see ../bootstrap.conf.
AC_REQUIRE([gl_EUIDACCESS_STAT])
AC_REQUIRE([gl_FD_REOPEN])
+ AC_REQUIRE([gl_FUNC_XATTR])
AC_REQUIRE([gl_FUNC_XFTS])
AC_REQUIRE([gl_MEMXFRM])
AC_REQUIRE([gl_STRINTCMP])
diff -ruNp coreutils-7.0.orig/m4/xattr.m4 coreutils-7.0/m4/xattr.m4
--- coreutils-7.0.orig/m4/xattr.m4 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-7.0/m4/xattr.m4 2009-01-28 17:12:04.988109301 +0100
@@ -0,0 +1,36 @@
+# xattr.m4 - check for Extended Attributes (Linux)
+
+# Copyright (C) 2003, 2008 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# Originally written by Andreas Gruenbacher.
+# http://www.suse.de/~agruen/coreutils/5.91/coreutils-xattr.diff
+
+AC_DEFUN([gl_FUNC_XATTR],
+[
+ AC_ARG_ENABLE([xattr],
+ AC_HELP_STRING([--disable-xattr],
+ [do not support extended attributes]),
+ [use_xattr=$enableval], [use_xattr=yes])
+
+ if test "$use_xattr" = "yes"; then
+ AC_CHECK_HEADERS([attr/error_context.h attr/libattr.h])
+ if test $ac_cv_header_attr_libattr_h = yes \
+ && test $ac_cv_header_attr_error_context_h = yes; then
+ use_xattr=1
+ else
+ use_xattr=0
+ fi
+ AC_DEFINE_UNQUOTED([USE_XATTR], [$use_xattr],
+ [Define if you want extended attribute support.])
+ xattr_saved_LIBS=$LIBS
+ AC_SEARCH_LIBS([attr_copy_file], [attr],
+ [test "$ac_cv_search_attr_copy_file" = "none required" ||
+ LIB_XATTR=$ac_cv_search_attr_copy_file])
+ AC_CHECK_FUNCS([attr_copy_file])
+ LIBS=$xattr_saved_LIBS
+ AC_SUBST([LIB_XATTR])
+ fi
+])
diff -ruNp coreutils-7.0.orig/src/copy.c coreutils-7.0/src/copy.c
--- coreutils-7.0.orig/src/copy.c 2008-08-24 22:30:10.000000000 +0200
+++ coreutils-7.0/src/copy.c 2009-01-28 17:12:04.990109315 +0100
@@ -55,6 +55,13 @@
#include "areadlink.h"
#include "yesno.h"
+#if USE_XATTR
+# include <attr/error_context.h>
+# include <attr/libattr.h>
+# include <stdarg.h>
+# include "verror.h"
+#endif
+
#ifndef HAVE_FCHOWN
# define HAVE_FCHOWN false
# define fchown(fd, uid, gid) (-1)
@@ -124,6 +131,70 @@ is_ancestor (const struct stat *sb, cons
return false;
}
+#if USE_XATTR
+static void
+copy_attr_error (struct error_context *ctx, char const *fmt, ...)
+{
+ int err = errno;
+ va_list ap;
+
+ /* use verror module to print error message */
+ va_start (ap, fmt);
+ verror (0, err, fmt, ap);
+ va_end (ap);
+}
+
+static char const *
+copy_attr_quote (struct error_context *ctx, char const *str)
+{
+ return quote (str);
+}
+
+static void
+copy_attr_free (struct error_context *ctx, char const *str)
+{
+}
+
+static bool
+copy_attr_by_fd (char const *src_path, int src_fd,
+ char const *dst_path, int dst_fd)
+{
+ struct error_context ctx =
+ {
+ .error = copy_attr_error,
+ .quote = copy_attr_quote,
+ .quote_free = copy_attr_free
+ };
+ return 0 == attr_copy_fd (src_path, src_fd, dst_path, dst_fd, 0, &ctx);
+}
+
+static bool
+copy_attr_by_name (char const *src_path, char const *dst_path)
+{
+ struct error_context ctx =
+ {
+ .error = copy_attr_error,
+ .quote = copy_attr_quote,
+ .quote_free = copy_attr_free
+ };
+ return 0 == attr_copy_file (src_path, dst_path, 0, &ctx);
+}
+#else /* USE_XATTR */
+
+static bool
+copy_attr_by_fd (char const *src_path, int src_fd,
+ char const *dst_path, int dst_fd)
+{
+ return true;
+}
+
+static bool
+copy_attr_by_name (char const *src_path, char const *dst_path)
+{
+ return true;
+}
+#endif /* USE_XATTR */
+
/* Read the contents of the directory SRC_NAME_IN, and recursively
copy the contents to DST_NAME_IN. NEW_DST is true if
DST_NAME_IN is a directory that was created previously in the
@@ -682,6 +753,11 @@ copy_reg (char const *src_name, char con
set_author (dst_name, dest_desc, src_sb);
+ if (x->preserve_xattr && ! copy_attr_by_fd (src_name, source_desc,
+ dst_name, dest_desc)
+ && x->require_preserve_xattr)
+ return false;
+
if (x->preserve_mode || x->move_mode)
{
if (copy_acl (src_name, source_desc, dst_name, dest_desc, src_mode) != 0
@@ -1980,6 +2056,10 @@ copy_internal (char const *src_name, cha
set_author (dst_name, -1, &src_sb);
+ if (x->preserve_xattr && ! copy_attr_by_name (src_name, dst_name)
+ && x->require_preserve_xattr)
+ return false;
+
if (x->preserve_mode || x->move_mode)
{
if (copy_acl (src_name, -1, dst_name, -1, src_mode) != 0
diff -ruNp coreutils-7.0.orig/src/copy.h coreutils-7.0/src/copy.h
--- coreutils-7.0.orig/src/copy.h 2008-06-21 17:20:29.000000000 +0200
+++ coreutils-7.0/src/copy.h 2009-01-28 17:12:04.991109322 +0100
@@ -174,6 +174,19 @@ struct cp_options
fail if it is unable to do so. */
bool require_preserve_context;
+ /* If true, attempt to preserve extended attributes using libattr.
+ Ignored if coreutils are compiled without xattr support. */
+ bool preserve_xattr;
+
+ /* Useful only when preserve_xattr is true.
+ If true, a failed attempt to preserve file's extended attributes
+ propagates failure "out" to the caller. If false, a failure to
+ preserve file's extended attributes does not change the invoking
+ application's exit status. Give diagnostics for failed syscalls
+ regardless of this setting. For example, with "cp --preserve=xattr"
+ this flag is "true", while with "cp --preserve=all", it is false. */
+ bool require_preserve_xattr;
+
/* If true, copy directories recursively and copy special files
as themselves rather than copying their contents. */
bool recursive;
diff -ruNp coreutils-7.0.orig/src/cp.c coreutils-7.0/src/cp.c
--- coreutils-7.0.orig/src/cp.c 2009-01-28 17:10:24.455415000 +0100
+++ coreutils-7.0/src/cp.c 2009-01-28 17:12:04.992109329 +0100
@@ -202,7 +202,8 @@ Mandatory arguments to long options are
-p same as --preserve=mode,ownership,timestamps\n\
--preserve[=ATTR_LIST] preserve the specified attributes (default:\n\
mode,ownership,timestamps), if possible\n\
- additional attributes: context, links, all\n\
+ additional attributes: context, links, xattr,\n\
+ all\n\
"), stdout);
fputs (_("\
--no-preserve=ATTR_LIST don't preserve the specified attributes\n\
@@ -779,6 +780,8 @@ cp_option_init (struct cp_options *x)
x->preserve_timestamps = false;
x->preserve_security_context = false;
x->require_preserve_context = false;
+ x->preserve_xattr = false;
+ x->require_preserve_xattr = false;
x->require_preserve = false;
x->recursive = false;
@@ -815,18 +818,20 @@ decode_preserve_arg (char const *arg, st
PRESERVE_OWNERSHIP,
PRESERVE_LINK,
PRESERVE_CONTEXT,
+ PRESERVE_XATTR,
PRESERVE_ALL
};
static enum File_attribute const preserve_vals[] =
{
PRESERVE_MODE, PRESERVE_TIMESTAMPS,
- PRESERVE_OWNERSHIP, PRESERVE_LINK, PRESERVE_CONTEXT, PRESERVE_ALL
+ PRESERVE_OWNERSHIP, PRESERVE_LINK, PRESERVE_CONTEXT, PRESERVE_XATTR,
+ PRESERVE_ALL
};
/* Valid arguments to the `--preserve' option. */
static char const* const preserve_args[] =
{
"mode", "timestamps",
- "ownership", "links", "context", "all", NULL
+ "ownership", "links", "context", "xattr", "all", NULL
};
ARGMATCH_VERIFY (preserve_args, preserve_vals);
@@ -867,6 +872,11 @@ decode_preserve_arg (char const *arg, st
x->require_preserve_context = on_off;
break;
+ case PRESERVE_XATTR:
+ x->preserve_xattr = on_off;
+ x->require_preserve_xattr = on_off;
+ break;
+
case PRESERVE_ALL:
x->preserve_mode = on_off;
x->preserve_timestamps = on_off;
@@ -874,6 +884,7 @@ decode_preserve_arg (char const *arg, st
x->preserve_links = on_off;
if (selinux_enabled)
x->preserve_security_context = on_off;
+ x->preserve_xattr = on_off;
break;
default:
@@ -1121,6 +1132,12 @@ main (int argc, char **argv)
"without an SELinux-enabled kernel"));
}
+#if !USE_XATTR
+ if (x.require_preserve_xattr)
+ error (EXIT_FAILURE, 0, _("cannot preserve extended attributes, cp is "
+ "built without xattr support"));
+#endif
+
/* Allocate space for remembering copied and created files. */
hash_init ();
diff -ruNp coreutils-7.0.orig/src/install.c coreutils-7.0/src/install.c
--- coreutils-7.0.orig/src/install.c 2008-09-27 19:28:41.000000000 +0200
+++ coreutils-7.0/src/install.c 2009-01-28 17:12:04.993109336 +0100
@@ -200,6 +200,7 @@ cp_option_init (struct cp_options *x)
x->open_dangling_dest_symlink = false;
x->update = false;
x->preserve_security_context = false;
+ x->preserve_xattr = false;
x->verbose = false;
x->dest_info = NULL;
x->src_info = NULL;
diff -ruNp coreutils-7.0.orig/src/Makefile.am coreutils-7.0/src/Makefile.am
--- coreutils-7.0.orig/src/Makefile.am 2008-09-27 19:28:54.000000000 +0200
+++ coreutils-7.0/src/Makefile.am 2009-01-28 17:15:23.106476067 +0100
@@ -149,9 +149,9 @@ su_LDADD = $(LDADD) $(LIB_CRYPT)
dir_LDADD += $(LIB_ACL)
ls_LDADD += $(LIB_ACL)
vdir_LDADD += $(LIB_ACL)
-cp_LDADD += $(LIB_ACL)
-mv_LDADD += $(LIB_ACL)
-ginstall_LDADD += $(LIB_ACL)
+cp_LDADD += $(LIB_ACL) $(LIB_XATTR)
+mv_LDADD += $(LIB_ACL) $(LIB_XATTR)
+ginstall_LDADD += $(LIB_ACL) $(LIB_XATTR)
stat_LDADD = $(LDADD) $(LIB_SELINUX)
@@ -226,7 +226,7 @@ uninstall-local:
fi; \
fi
-copy_sources = copy.c cp-hash.c
+copy_sources = copy.c cp-hash.c verror.c xvasprintf.c
# Use `ginstall' in the definition of PROGRAMS and in dependencies to avoid
# confusion with the `install' target. The install rule transforms `ginstall'
diff -ruNp coreutils-7.0.orig/src/mv.c coreutils-7.0/src/mv.c
--- coreutils-7.0.orig/src/mv.c 2009-01-28 17:10:24.456415000 +0100
+++ coreutils-7.0/src/mv.c 2009-01-28 17:12:04.994109343 +0100
@@ -140,6 +140,7 @@ cp_option_init (struct cp_options *x)
x->preserve_security_context = selinux_enabled;
x->require_preserve = false; /* FIXME: maybe make this an option */
x->require_preserve_context = false;
+ x->preserve_xattr = true;
x->recursive = true;
x->sparse_mode = SPARSE_AUTO; /* FIXME: maybe make this an option */
x->symbolic_link = false;
diff -ruNp coreutils-7.0.orig/tests/Makefile.am coreutils-7.0/tests/Makefile.am
--- coreutils-7.0.orig/tests/Makefile.am 2009-01-28 17:10:24.457415000 +0100
+++ coreutils-7.0/tests/Makefile.am 2009-01-28 17:12:04.994109343 +0100
@@ -230,6 +230,7 @@ TESTS = \
misc/tty-eof \
misc/unexpand \
misc/uniq \
+ misc/xattr \
chmod/c-option \
chmod/equal-x \
chmod/equals \
diff -ruNp coreutils-7.0.orig/tests/misc/xattr coreutils-7.0/tests/misc/xattr
--- coreutils-7.0.orig/tests/misc/xattr 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-7.0/tests/misc/xattr 2009-01-28 17:12:04.995109350 +0100
@@ -0,0 +1,111 @@
+#!/bin/sh
+# Ensure that cp --preserve=xattr and mv preserve extended attributes and
+# install does not preserve extended attributes.
+
+# Copyright (C) 2009 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if test "$VERBOSE" = yes; then
+ set -x
+ cp --version
+ mv --version
+ ginstall --version
+fi
+
+. $srcdir/test-lib.sh
+
+# Skip this test if cp was built without xattr support:
+touch src dest || framework_failure
+cp --preserve=xattr -n src dest 2>/dev/null \
+ || skip_test_ "coreutils built without xattr support"
+
+# this code was taken from test mv/backup-is-src
+cleanup_() { rm -rf "$other_partition_tmpdir"; }
+. "$abs_srcdir/other-fs-tmpdir"
+b_other="$other_partition_tmpdir/b"
+rm -f $b_other || framework_failure
+
+# testing xattr name-value pair
+xattr_name="user.foo"
+xattr_value="bar"
+xattr_pair="$xattr_name=\"$xattr_value\""
+
+# create new file and check its xattrs
+touch a || framework_failure
+getfattr -d a >out_a || skip_test_ "failed to get xattr of file"
+grep -F "$xattr_pair" out_a >/dev/null && framework_failure
+
+# try to set user xattr on file
+setfattr -n "$xattr_name" -v "$xattr_value" a >out_a \
+ || skip_test_ "failed to set xattr of file"
+getfattr -d a >out_a || skip_test_ "failed to get xattr of file"
+grep -F "$xattr_pair" out_a >/dev/null \
+ || skip_test_ "failed to set xattr of file"
+
+fail=0
+
+# cp should not preserve xattr by default
+cp 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=xattr option works
+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
+
+rm b || framework_failure
+
+# install should never preserve xattr
+ginstall 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
+
+# mv should preserve xattr when renaming within a filesystem.
+# This is implicitly done by rename () and doesn't need explicit
+# xattr support in mv.
+mv 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 || cat >&2 <<EOF
+=================================================================
+$0: WARNING!!!
+rename () does not preserve extended attributes
+=================================================================
+EOF
+
+# try to set user xattr on file on other partition
+test_mv=1
+touch $b_other || framework_failure
+setfattr -n "$xattr_name" -v "$xattr_value" $b_other >out_a 2>/dev/null \
+ || test_mv=0
+getfattr -d $b_other >out_b 2>/dev/null || test_mv=0
+grep -F "$xattr_pair" out_b >/dev/null || test_mv=0
+rm -f $b_other || framework_failure
+
+if test $test_mv -eq 1; then
+ # mv should preserve xattr when copying content from one partition to another
+ mv b $b_other || fail=1
+ getfattr -d $b_other >out_b 2>/dev/null || skip_test_ "failed to get xattr of file"
+ grep -F "$xattr_pair" out_b >/dev/null || fail=1
+else
+ cat >&2 <<EOF
+=================================================================
+$0: WARNING!!!
+failed to set xattr of file $b_other
+=================================================================
+EOF
+fi
+
+Exit $fail
diff -ruNp coreutils-7.0.orig/src/verror.c coreutils-7.0/src/verror.c
--- coreutils-7.0.orig/src/verror.c 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-7.0/src/verror.c 2009-01-28 17:14:58.399305619 +0100
@@ -0,0 +1,77 @@
+/* va_list error handler for noninteractive utilities
+ Copyright (C) 2006-2007 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Eric Blake. */
+
+#include <config.h>
+
+#include "verror.h"
+#include "xvasprintf.h"
+
+#include <errno.h>
+#include <stdarg.h>
+#include <stdlib.h>
+
+#if ENABLE_NLS
+# include "gettext.h"
+# define _(msgid) gettext (msgid)
+#endif
+
+#ifndef _
+# define _(String) String
+#endif
+
+/* Print a message with `vfprintf (stderr, FORMAT, ARGS)';
+ if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
+ If STATUS is nonzero, terminate the program with `exit (STATUS)'.
+ Use the globals error_print_progname and error_message_count similarly
+ to error(). */
+void
+verror (int status, int errnum, const char *format, va_list args)
+{
+ verror_at_line (status, errnum, NULL, 0, format, args);
+}
+
+/* Print a message with `vfprintf (stderr, FORMAT, ARGS)';
+ if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
+ If STATUS is nonzero, terminate the program with `exit (STATUS)'.
+ If FNAME is not NULL, prepend the message with `FNAME:LINENO:'.
+ Use the globals error_print_progname, error_message_count, and
+ error_one_per_line similarly to error_at_line(). */
+void
+verror_at_line (int status, int errnum, const char *file,
+ unsigned int line_number, const char *format, va_list args)
+{
+ char *message = xvasprintf (format, args);
+ if (message)
+ {
+ /* Until http://sourceware.org/bugzilla/show_bug.cgi?id=2997 is fixed,
+ glibc violates GNU Coding Standards when the file argument to
+ error_at_line is NULL. */
+ if (file)
+ error_at_line (status, errnum, file, line_number, "%s", message);
+ else
+ error (status, errnum, "%s", message);
+ }
+ else
+ {
+ /* EOVERFLOW, EINVAL, and EILSEQ from xvasprintf are signs of
+ serious programmer errors. */
+ error (0, errno, _("unable to display error message"));
+ abort ();
+ }
+ free (message);
+}
diff -ruNp coreutils-7.0.orig/src/verror.h coreutils-7.0/src/verror.h
--- coreutils-7.0.orig/src/verror.h 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-7.0/src/verror.h 2009-01-28 17:14:54.039275540 +0100
@@ -0,0 +1,53 @@
+/* Declaration for va_list error-reporting function
+ Copyright (C) 2006-2007 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef _VERROR_H
+#define _VERROR_H 1
+
+#include "error.h"
+#include <stdarg.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Print a message with `vfprintf (stderr, FORMAT, ARGS)';
+ if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
+ If STATUS is nonzero, terminate the program with `exit (STATUS)'.
+ Use the globals error_print_progname and error_message_count similarly
+ to error(). */
+
+extern void verror (int __status, int __errnum, const char *__format,
+ va_list __args)
+ __attribute__ ((__format__ (__printf__, 3, 0)));
+
+/* Print a message with `vfprintf (stderr, FORMAT, ARGS)';
+ if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
+ If STATUS is nonzero, terminate the program with `exit (STATUS)'.
+ If FNAME is not NULL, prepend the message with `FNAME:LINENO:'.
+ Use the globals error_print_progname, error_message_count, and
+ error_one_per_line similarly to error_at_line(). */
+
+extern void verror_at_line (int __status, int __errnum, const char *__fname,
+ unsigned int __lineno, const char *__format,
+ va_list __args)
+ __attribute__ ((__format__ (__printf__, 5, 0)));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* verror.h */
diff -ruNp coreutils-7.0.orig/src/xvasprintf.c coreutils-7.0/src/xvasprintf.c
--- coreutils-7.0.orig/src/xvasprintf.c 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-7.0/src/xvasprintf.c 2009-01-28 17:15:06.809363638 +0100
@@ -0,0 +1,110 @@
+/* vasprintf and asprintf with out-of-memory checking.
+ Copyright (C) 1999, 2002-2004, 2006-2008 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include "xvasprintf.h"
+
+#include <errno.h>
+#include <limits.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "xalloc.h"
+
+/* Checked size_t computations. */
+#include "xsize.h"
+
+static inline char *
+xstrcat (size_t argcount, va_list args)
+{
+ char *result;
+ va_list ap;
+ size_t totalsize;
+ size_t i;
+ char *p;
+
+ /* Determine the total size. */
+ totalsize = 0;
+ va_copy (ap, args);
+ for (i = argcount; i > 0; i--)
+ {
+ const char *next = va_arg (ap, const char *);
+ totalsize = xsum (totalsize, strlen (next));
+ }
+ va_end (ap);
+
+ /* Test for overflow in the summing pass above or in (totalsize + 1) below.
+ Also, don't return a string longer than INT_MAX, for consistency with
+ vasprintf(). */
+ if (totalsize == SIZE_MAX || totalsize > INT_MAX)
+ {
+ errno = EOVERFLOW;
+ return NULL;
+ }
+
+ /* Allocate and fill the result string. */
+ result = XNMALLOC (totalsize + 1, char);
+ p = result;
+ for (i = argcount; i > 0; i--)
+ {
+ const char *next = va_arg (args, const char *);
+ size_t len = strlen (next);
+ memcpy (p, next, len);
+ p += len;
+ }
+ *p = '\0';
+
+ return result;
+}
+
+char *
+xvasprintf (const char *format, va_list args)
+{
+ char *result;
+
+ /* Recognize the special case format = "%s...%s". It is a frequently used
+ idiom for string concatenation and needs to be fast. We don't want to
+ have a separate function xstrcat() for this purpose. */
+ {
+ size_t argcount = 0;
+ const char *f;
+
+ for (f = format;;)
+ {
+ if (*f == '\0')
+ /* Recognized the special case of string concatenation. */
+ return xstrcat (argcount, args);
+ if (*f != '%')
+ break;
+ f++;
+ if (*f != 's')
+ break;
+ f++;
+ argcount++;
+ }
+ }
+
+ if (vasprintf (&result, format, args) < 0)
+ {
+ if (errno == ENOMEM)
+ xalloc_die ();
+ return NULL;
+ }
+
+ return result;
+}
diff -ruNp coreutils-7.0.orig/src/xvasprintf.h coreutils-7.0/src/xvasprintf.h
--- coreutils-7.0.orig/src/xvasprintf.h 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-7.0/src/xvasprintf.h 2009-01-28 17:15:06.809363638 +0100
@@ -0,0 +1,56 @@
+/* vasprintf and asprintf with out-of-memory checking.
+ Copyright (C) 2002-2004, 2006-2008 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef _XVASPRINTF_H
+#define _XVASPRINTF_H
+
+/* Get va_list. */
+#include <stdarg.h>
+
+#ifndef __attribute__
+/* This feature is available in gcc versions 2.5 and later. */
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
+# define __attribute__(Spec) /* empty */
+# endif
+/* The __-protected variants of `format' and `printf' attributes
+ are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
+# define __format__ format
+# define __printf__ printf
+# endif
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Write formatted output to a string dynamically allocated with malloc(),
+ and return it. Upon [ENOMEM] memory allocation error, call xalloc_die.
+ On some other error
+ - [EOVERFLOW] resulting string length is > INT_MAX,
+ - [EINVAL] invalid format string,
+ - [EILSEQ] error during conversion between wide and multibyte characters,
+ return NULL. */
+extern char *xasprintf (const char *format, ...)
+ __attribute__ ((__format__ (__printf__, 1, 2)));
+extern char *xvasprintf (const char *format, va_list args)
+ __attribute__ ((__format__ (__printf__, 1, 0)));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _XVASPRINTF_H */

View File

@ -1,6 +1,6 @@
diff -urp coreutils-6.10-orig/configure.ac coreutils-6.10/configure.ac diff -urp coreutils-7.0.orig/configure.ac coreutils-7.0/configure.ac
--- coreutils-6.10-orig/configure.ac 2008-01-25 12:32:33.000000000 +0100 --- coreutils-7.0.orig/configure.ac 2009-01-28 17:18:16.790672000 +0100
+++ coreutils-6.10/configure.ac 2008-01-25 14:10:34.000000000 +0100 +++ coreutils-7.0/configure.ac 2009-01-28 17:18:52.757913913 +0100
@@ -51,6 +51,13 @@ AC_ARG_ENABLE(pam, dnl @@ -51,6 +51,13 @@ AC_ARG_ENABLE(pam, dnl
LIB_PAM="-ldl -lpam -lpam_misc" LIB_PAM="-ldl -lpam -lpam_misc"
AC_SUBST(LIB_PAM)]) AC_SUBST(LIB_PAM)])
@ -15,18 +15,18 @@ diff -urp coreutils-6.10-orig/configure.ac coreutils-6.10/configure.ac
AC_FUNC_FORK AC_FUNC_FORK
optional_bin_progs= optional_bin_progs=
diff -urNp coreutils-6.12-orig/man/chcon.x coreutils-6.12/man/chcon.x diff -urp coreutils-7.0.orig/man/chcon.x coreutils-7.0/man/chcon.x
--- coreutils-6.12-orig/man/chcon.x 2008-03-07 17:05:53.000000000 +0100 --- coreutils-7.0.orig/man/chcon.x 2008-03-07 17:05:53.000000000 +0100
+++ coreutils-6.12/man/chcon.x 2008-10-21 15:53:43.000000000 +0200 +++ coreutils-7.0/man/chcon.x 2009-01-28 17:18:52.759913926 +0100
@@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
[NAME] [NAME]
-chcon \- change file security context -chcon \- change file security context
+chcon \- change file SELinux security context +chcon \- change file SELinux security context
[DESCRIPTION] [DESCRIPTION]
.\" Add any additional description here .\" Add any additional description here
diff -urNp coreutils-6.12-orig/man/runcon.x coreutils-6.12/man/runcon.x diff -urp coreutils-7.0.orig/man/runcon.x coreutils-7.0/man/runcon.x
--- coreutils-6.12-orig/man/runcon.x 2008-03-07 17:05:53.000000000 +0100 --- coreutils-7.0.orig/man/runcon.x 2008-03-07 17:05:53.000000000 +0100
+++ coreutils-6.12/man/runcon.x 2008-10-21 15:54:01.000000000 +0200 +++ coreutils-7.0/man/runcon.x 2009-01-28 17:18:52.760913933 +0100
@@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
[NAME] [NAME]
-runcon \- run command with specified security context -runcon \- run command with specified security context
@ -34,10 +34,10 @@ diff -urNp coreutils-6.12-orig/man/runcon.x coreutils-6.12/man/runcon.x
[DESCRIPTION] [DESCRIPTION]
Run COMMAND with completely-specified CONTEXT, or with current or Run COMMAND with completely-specified CONTEXT, or with current or
transitioned security context modified by one or more of LEVEL, transitioned security context modified by one or more of LEVEL,
diff -urNp coreutils-6.12-orig/src/chcon.c coreutils-6.12/src/chcon.c diff -urp coreutils-7.0.orig/src/chcon.c coreutils-7.0/src/chcon.c
--- coreutils-6.12-orig/src/chcon.c 2008-05-26 08:40:32.000000000 +0200 --- coreutils-7.0.orig/src/chcon.c 2008-08-24 22:30:10.000000000 +0200
+++ coreutils-6.12/src/chcon.c 2008-06-16 14:43:24.000000000 +0200 +++ coreutils-7.0/src/chcon.c 2009-01-28 17:18:52.761913940 +0100
@@ -352,7 +352,7 @@ Usage: %s [OPTION]... CONTEXT FILE...\n\ @@ -366,7 +366,7 @@ Usage: %s [OPTION]... CONTEXT FILE...\n\
"), "),
program_name, program_name, program_name); program_name, program_name, program_name);
fputs (_("\ fputs (_("\
@ -46,10 +46,10 @@ diff -urNp coreutils-6.12-orig/src/chcon.c coreutils-6.12/src/chcon.c
With --reference, change the security context of each FILE to that of RFILE.\n\ With --reference, change the security context of each FILE to that of RFILE.\n\
\n\ \n\
-c, --changes like verbose but report only when a change is made\n\ -c, --changes like verbose but report only when a change is made\n\
diff -urp coreutils-6.10-orig/src/copy.c coreutils-6.10/src/copy.c diff -urp coreutils-7.0.orig/src/copy.c coreutils-7.0/src/copy.c
--- coreutils-6.10-orig/src/copy.c 2008-01-05 23:59:11.000000000 +0100 --- coreutils-7.0.orig/src/copy.c 2009-01-28 17:18:16.748671000 +0100
+++ coreutils-6.10/src/copy.c 2008-01-25 17:23:17.000000000 +0100 +++ coreutils-7.0/src/copy.c 2009-01-28 17:18:52.762913947 +0100
@@ -371,9 +371,10 @@ copy_reg (char const *src_name, char con @@ -449,9 +449,10 @@ copy_reg (char const *src_name, char con
security_context_t con = NULL; security_context_t con = NULL;
if (getfscreatecon (&con) < 0) if (getfscreatecon (&con) < 0)
{ {
@ -61,7 +61,7 @@ diff -urp coreutils-6.10-orig/src/copy.c coreutils-6.10/src/copy.c
return_val = false; return_val = false;
goto close_src_and_dst_desc; goto close_src_and_dst_desc;
} }
@@ -383,11 +384,12 @@ copy_reg (char const *src_name, char con @@ -461,11 +462,12 @@ copy_reg (char const *src_name, char con
{ {
if (fsetfilecon (dest_desc, con) < 0) if (fsetfilecon (dest_desc, con) < 0)
{ {
@ -77,7 +77,7 @@ diff -urp coreutils-6.10-orig/src/copy.c coreutils-6.10/src/copy.c
return_val = false; return_val = false;
freecon (con); freecon (con);
goto close_src_and_dst_desc; goto close_src_and_dst_desc;
@@ -1630,11 +1632,12 @@ copy_internal (char const *src_name, cha @@ -1714,11 +1716,12 @@ copy_internal (char const *src_name, cha
{ {
if (setfscreatecon (con) < 0) if (setfscreatecon (con) < 0)
{ {
@ -93,7 +93,7 @@ diff -urp coreutils-6.10-orig/src/copy.c coreutils-6.10/src/copy.c
freecon (con); freecon (con);
return false; return false;
} }
@@ -1644,12 +1647,14 @@ copy_internal (char const *src_name, cha @@ -1728,12 +1731,14 @@ copy_internal (char const *src_name, cha
else else
{ {
if (errno != ENOTSUP && errno != ENODATA) if (errno != ENOTSUP && errno != ENODATA)
@ -114,7 +114,7 @@ diff -urp coreutils-6.10-orig/src/copy.c coreutils-6.10/src/copy.c
} }
} }
} }
@@ -1735,6 +1740,8 @@ copy_internal (char const *src_name, cha @@ -1819,6 +1824,8 @@ copy_internal (char const *src_name, cha
{ {
/* Here, we are crossing a file system boundary and cp's -x option /* Here, we are crossing a file system boundary and cp's -x option
is in effect: so don't copy the contents of this directory. */ is in effect: so don't copy the contents of this directory. */
@ -123,9 +123,9 @@ diff -urp coreutils-6.10-orig/src/copy.c coreutils-6.10/src/copy.c
} }
else else
{ {
diff -urp coreutils-6.10-orig/src/copy.h coreutils-6.10/src/copy.h diff -urp coreutils-7.0.orig/src/copy.h coreutils-7.0/src/copy.h
--- coreutils-6.10-orig/src/copy.h 2008-01-05 23:58:25.000000000 +0100 --- coreutils-7.0.orig/src/copy.h 2009-01-28 17:18:16.748671000 +0100
+++ coreutils-6.10/src/copy.h 2008-01-25 16:29:21.000000000 +0100 +++ coreutils-7.0/src/copy.h 2009-01-28 17:18:52.763913953 +0100
@@ -141,6 +141,9 @@ struct cp_options @@ -141,6 +141,9 @@ struct cp_options
bool preserve_mode; bool preserve_mode;
bool preserve_timestamps; bool preserve_timestamps;
@ -136,10 +136,10 @@ diff -urp coreutils-6.10-orig/src/copy.h coreutils-6.10/src/copy.h
/* Enabled for mv, and for cp by the --preserve=links option. /* Enabled for mv, and for cp by the --preserve=links option.
If true, attempt to preserve in the destination files any If true, attempt to preserve in the destination files any
logical hard links between the source files. If used with cp's logical hard links between the source files. If used with cp's
diff -urp coreutils-6.10-orig/src/cp.c coreutils-6.10/src/cp.c diff -urp coreutils-7.0.orig/src/cp.c coreutils-7.0/src/cp.c
--- coreutils-6.10-orig/src/cp.c 2008-01-11 12:19:53.000000000 +0100 --- coreutils-7.0.orig/src/cp.c 2009-01-28 17:18:16.750671000 +0100
+++ coreutils-6.10/src/cp.c 2008-01-25 16:26:22.000000000 +0100 +++ coreutils-7.0/src/cp.c 2009-01-28 17:20:29.109561384 +0100
@@ -147,6 +147,7 @@ static struct option const long_opts[] = @@ -148,6 +148,7 @@ static struct option const long_opts[] =
{"target-directory", required_argument, NULL, 't'}, {"target-directory", required_argument, NULL, 't'},
{"update", no_argument, NULL, 'u'}, {"update", no_argument, NULL, 'u'},
{"verbose", no_argument, NULL, 'v'}, {"verbose", no_argument, NULL, 'v'},
@ -147,7 +147,7 @@ diff -urp coreutils-6.10-orig/src/cp.c coreutils-6.10/src/cp.c
{GETOPT_HELP_OPTION_DECL}, {GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL}, {GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0} {NULL, 0, NULL, 0}
@@ -175,7 +175,7 @@ Copy SOURCE to DEST, or multiple SOURCE( @@ -175,7 +176,7 @@ Copy SOURCE to DEST, or multiple SOURCE(
Mandatory arguments to long options are mandatory for short options too.\n\ Mandatory arguments to long options are mandatory for short options too.\n\
"), stdout); "), stdout);
fputs (_("\ fputs (_("\
@ -156,8 +156,8 @@ diff -urp coreutils-6.10-orig/src/cp.c coreutils-6.10/src/cp.c
--backup[=CONTROL] make a backup of each existing destination file\n\ --backup[=CONTROL] make a backup of each existing destination file\n\
-b like --backup but does not accept an argument\n\ -b like --backup but does not accept an argument\n\
--copy-contents copy contents of special files when recursive\n\ --copy-contents copy contents of special files when recursive\n\
@@ -200,6 +201,9 @@ Mandatory arguments to long options are @@ -206,6 +207,9 @@ Mandatory arguments to long options are
additional attributes: context, links, all\n\ all\n\
"), stdout); "), stdout);
fputs (_("\ fputs (_("\
+ -c same as --preserve=context\n\ + -c same as --preserve=context\n\
@ -166,7 +166,7 @@ diff -urp coreutils-6.10-orig/src/cp.c coreutils-6.10/src/cp.c
--no-preserve=ATTR_LIST don't preserve the specified attributes\n\ --no-preserve=ATTR_LIST don't preserve the specified attributes\n\
--parents use full source file name under DIRECTORY\n\ --parents use full source file name under DIRECTORY\n\
"), stdout); "), stdout);
@@ -225,6 +229,7 @@ Mandatory arguments to long options are @@ -231,6 +235,7 @@ Mandatory arguments to long options are
destination file is missing\n\ destination file is missing\n\
-v, --verbose explain what is being done\n\ -v, --verbose explain what is being done\n\
-x, --one-file-system stay on this file system\n\ -x, --one-file-system stay on this file system\n\
@ -174,24 +174,24 @@ diff -urp coreutils-6.10-orig/src/cp.c coreutils-6.10/src/cp.c
"), stdout); "), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout); fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout); fputs (VERSION_OPTION_DESCRIPTION, stdout);
@@ -774,6 +779,7 @@ cp_option_init (struct cp_options *x) @@ -780,6 +785,7 @@ cp_option_init (struct cp_options *x)
x->preserve_timestamps = false; x->preserve_timestamps = false;
x->preserve_security_context = false; x->preserve_security_context = false;
x->require_preserve_context = false; x->require_preserve_context = false;
+ x->set_security_context = false; + x->set_security_context = false;
x->preserve_xattr = false;
x->require_preserve_xattr = false;
x->require_preserve = false; @@ -925,7 +931,7 @@ main (int argc, char **argv)
x->recursive = false;
@@ -909,7 +917,7 @@ main (int argc, char **argv)
we'll actually use backup_suffix_string. */ we'll actually use backup_suffix_string. */
backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX"); backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
- while ((c = getopt_long (argc, argv, "abdfHilLprst:uvxPRS:T", - while ((c = getopt_long (argc, argv, "abdfHilLnprst:uvxPRS:T",
+ while ((c = getopt_long (argc, argv, "abcdfHilLprst:uvxPRS:TZ:", + while ((c = getopt_long (argc, argv, "abcdfHilLnprst:uvxPRS:TZ:",
long_opts, NULL)) long_opts, NULL))
!= -1) != -1)
{ {
@@ -920,13 +928,15 @@ main (int argc, char **argv) @@ -936,13 +942,15 @@ main (int argc, char **argv)
sparse_type_string, sparse_type); sparse_type_string, sparse_type);
break; break;
@ -209,7 +209,7 @@ diff -urp coreutils-6.10-orig/src/cp.c coreutils-6.10/src/cp.c
x.recursive = true; x.recursive = true;
break; break;
@@ -940,6 +950,16 @@ main (int argc, char **argv) @@ -956,6 +964,16 @@ main (int argc, char **argv)
copy_contents = true; copy_contents = true;
break; break;
@ -226,7 +226,7 @@ diff -urp coreutils-6.10-orig/src/cp.c coreutils-6.10/src/cp.c
case 'd': case 'd':
x.preserve_links = true; x.preserve_links = true;
x.dereference = DEREF_NEVER; x.dereference = DEREF_NEVER;
@@ -1052,6 +1072,27 @@ main (int argc, char **argv) @@ -1072,6 +1090,27 @@ main (int argc, char **argv)
x.one_file_system = true; x.one_file_system = true;
break; break;
@ -254,10 +254,10 @@ diff -urp coreutils-6.10-orig/src/cp.c coreutils-6.10/src/cp.c
case 'S': case 'S':
make_backups = true; make_backups = true;
backup_suffix_string = optarg; backup_suffix_string = optarg;
diff -urp coreutils-6.10-orig/src/id.c coreutils-6.10/src/id.c diff -urp coreutils-7.0.orig/src/id.c coreutils-7.0/src/id.c
--- coreutils-6.10-orig/src/id.c 2008-01-05 23:59:11.000000000 +0100 --- coreutils-7.0.orig/src/id.c 2008-08-24 22:58:15.000000000 +0200
+++ coreutils-6.10/src/id.c 2008-01-25 17:13:53.000000000 +0100 +++ coreutils-7.0/src/id.c 2009-01-28 17:18:52.766913973 +0100
@@ -110,7 +110,7 @@ int @@ -106,7 +106,7 @@ int
main (int argc, char **argv) main (int argc, char **argv)
{ {
int optc; int optc;
@ -266,11 +266,10 @@ diff -urp coreutils-6.10-orig/src/id.c coreutils-6.10/src/id.c
/* If true, output the list of all group IDs. -G */ /* If true, output the list of all group IDs. -G */
bool just_group_list = false; bool just_group_list = false;
diff -urp coreutils-6.10-orig/src/install.c coreutils-6.10/src/install.c diff -urp coreutils-7.0.orig/src/install.c coreutils-7.0/src/install.c
--- coreutils-6.10-orig/src/install.c 2008-01-05 23:59:11.000000000 +0100 --- coreutils-7.0.orig/src/install.c 2009-01-28 17:18:16.751671000 +0100
+++ coreutils-6.10/src/install.c 2008-01-25 17:32:42.000000000 +0100 +++ coreutils-7.0/src/install.c 2009-01-28 17:18:52.767913980 +0100
@@ -152,11 +152,11 @@ static struct option const long_options[
@@ -146,11 +146,11 @@ static struct option const long_options[
{"no-target-directory", no_argument, NULL, 'T'}, {"no-target-directory", no_argument, NULL, 'T'},
{"owner", required_argument, NULL, 'o'}, {"owner", required_argument, NULL, 'o'},
{"preserve-timestamps", no_argument, NULL, 'p'}, {"preserve-timestamps", no_argument, NULL, 'p'},
@ -284,7 +283,7 @@ diff -urp coreutils-6.10-orig/src/install.c coreutils-6.10/src/install.c
{"strip", no_argument, NULL, 's'}, {"strip", no_argument, NULL, 's'},
{"strip-program", required_argument, NULL, STRIP_PROGRAM_OPTION}, {"strip-program", required_argument, NULL, STRIP_PROGRAM_OPTION},
{"suffix", required_argument, NULL, 'S'}, {"suffix", required_argument, NULL, 'S'},
@@ -178,6 +178,7 @@ cp_option_init (struct cp_options *x) @@ -185,6 +185,7 @@ cp_option_init (struct cp_options *x)
x->preserve_timestamps = false; x->preserve_timestamps = false;
x->require_preserve = false; x->require_preserve = false;
x->require_preserve_context = false; x->require_preserve_context = false;
@ -292,7 +291,7 @@ diff -urp coreutils-6.10-orig/src/install.c coreutils-6.10/src/install.c
x->recursive = false; x->recursive = false;
x->sparse_mode = SPARSE_AUTO; x->sparse_mode = SPARSE_AUTO;
x->symbolic_link = false; x->symbolic_link = false;
@@ -346,7 +338,7 @@ main (int argc, char **argv) @@ -361,7 +362,7 @@ main (int argc, char **argv)
we'll actually use backup_suffix_string. */ we'll actually use backup_suffix_string. */
backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX"); backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
@ -301,7 +300,7 @@ diff -urp coreutils-6.10-orig/src/install.c coreutils-6.10/src/install.c
NULL)) != -1) NULL)) != -1)
{ {
switch (optc) switch (optc)
@@ -408,6 +409,7 @@ main (int argc, char **argv) @@ -428,6 +429,7 @@ main (int argc, char **argv)
no_target_directory = true; no_target_directory = true;
break; break;
@ -309,7 +308,7 @@ diff -urp coreutils-6.10-orig/src/install.c coreutils-6.10/src/install.c
case PRESERVE_CONTEXT_OPTION: case PRESERVE_CONTEXT_OPTION:
if ( ! selinux_enabled) if ( ! selinux_enabled)
{ {
@@ -415,6 +417,10 @@ main (int argc, char **argv) @@ -435,6 +437,10 @@ main (int argc, char **argv)
"this kernel is not SELinux-enabled")); "this kernel is not SELinux-enabled"));
break; break;
} }
@ -320,7 +319,7 @@ diff -urp coreutils-6.10-orig/src/install.c coreutils-6.10/src/install.c
x.preserve_security_context = true; x.preserve_security_context = true;
use_default_selinux_context = false; use_default_selinux_context = false;
break; break;
@@ -432,6 +432,7 @@ main (int argc, char **argv) @@ -446,6 +452,7 @@ main (int argc, char **argv)
break; break;
} }
scontext = optarg; scontext = optarg;
@ -328,7 +327,7 @@ diff -urp coreutils-6.10-orig/src/install.c coreutils-6.10/src/install.c
use_default_selinux_context = false; use_default_selinux_context = false;
break; break;
case_GETOPT_HELP_CHAR; case_GETOPT_HELP_CHAR;
@@ -825,8 +831,8 @@ Mandatory arguments to long options are @@ -850,8 +857,8 @@ Mandatory arguments to long options are
-v, --verbose print the name of each directory as it is created\n\ -v, --verbose print the name of each directory as it is created\n\
"), stdout); "), stdout);
fputs (_("\ fputs (_("\
@ -339,10 +338,10 @@ diff -urp coreutils-6.10-orig/src/install.c coreutils-6.10/src/install.c
"), stdout); "), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout); fputs (HELP_OPTION_DESCRIPTION, stdout);
diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c diff -urp coreutils-7.0.orig/src/ls.c coreutils-7.0/src/ls.c
--- coreutils-6.10-orig/src/ls.c 2008-01-11 11:34:22.000000000 +0100 --- coreutils-7.0.orig/src/ls.c 2009-01-28 17:18:16.705671000 +0100
+++ coreutils-6.10/src/ls.c 2008-01-25 15:34:49.000000000 +0100 +++ coreutils-7.0/src/ls.c 2009-01-28 17:18:52.770914000 +0100
@@ -134,7 +134,8 @@ enum filetype @@ -139,7 +139,8 @@ enum filetype
symbolic_link, symbolic_link,
sock, sock,
whiteout, whiteout,
@ -352,7 +351,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
}; };
/* Display letters and indicators for each filetype. /* Display letters and indicators for each filetype.
@@ -177,8 +178,9 @@ struct fileinfo @@ -182,8 +183,9 @@ struct fileinfo
exists, otherwise false. */ exists, otherwise false. */
bool linkok; bool linkok;
@ -364,7 +363,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
bool have_acl; bool have_acl;
}; };
@@ -241,6 +242,7 @@ static void queue_directory (char const @@ -246,6 +248,7 @@ static void queue_directory (char const
static void sort_files (void); static void sort_files (void);
static void parse_ls_color (void); static void parse_ls_color (void);
void usage (int status); void usage (int status);
@ -372,7 +371,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
/* Initial size of hash table. /* Initial size of hash table.
Most hierarchies are likely to be shallower than this. */ Most hierarchies are likely to be shallower than this. */
@@ -314,7 +316,7 @@ static struct pending *pending_dirs; @@ -315,7 +318,7 @@ static struct pending *pending_dirs;
static struct timespec current_time; static struct timespec current_time;
@ -381,7 +380,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
static char UNKNOWN_SECURITY_CONTEXT[] = "?"; static char UNKNOWN_SECURITY_CONTEXT[] = "?";
/* Whether any of the files has an ACL. This affects the width of the /* Whether any of the files has an ACL. This affects the width of the
@@ -354,7 +356,9 @@ enum format @@ -355,7 +358,9 @@ enum format
one_per_line, /* -1 */ one_per_line, /* -1 */
many_per_line, /* -C */ many_per_line, /* -C */
horizontal, /* -x */ horizontal, /* -x */
@ -392,7 +391,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
}; };
static enum format format; static enum format format;
@@ -731,6 +735,9 @@ enum @@ -744,6 +749,9 @@ enum
SHOW_CONTROL_CHARS_OPTION, SHOW_CONTROL_CHARS_OPTION,
SI_OPTION, SI_OPTION,
SORT_OPTION, SORT_OPTION,
@ -402,7 +401,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
TIME_OPTION, TIME_OPTION,
TIME_STYLE_OPTION TIME_STYLE_OPTION
}; };
@@ -776,7 +783,9 @@ static struct option const long_options[ @@ -789,7 +797,9 @@ static struct option const long_options[
{"time-style", required_argument, NULL, TIME_STYLE_OPTION}, {"time-style", required_argument, NULL, TIME_STYLE_OPTION},
{"color", optional_argument, NULL, COLOR_OPTION}, {"color", optional_argument, NULL, COLOR_OPTION},
{"block-size", required_argument, NULL, BLOCK_SIZE_OPTION}, {"block-size", required_argument, NULL, BLOCK_SIZE_OPTION},
@ -413,7 +412,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
{"author", no_argument, NULL, AUTHOR_OPTION}, {"author", no_argument, NULL, AUTHOR_OPTION},
{GETOPT_HELP_OPTION_DECL}, {GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL}, {GETOPT_VERSION_OPTION_DECL},
@@ -786,12 +795,12 @@ static struct option const long_options[ @@ -799,12 +809,12 @@ static struct option const long_options[
static char const *const format_args[] = static char const *const format_args[] =
{ {
"verbose", "long", "commas", "horizontal", "across", "verbose", "long", "commas", "horizontal", "across",
@ -428,7 +427,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
}; };
ARGMATCH_VERIFY (format_args, format_types); ARGMATCH_VERIFY (format_args, format_types);
@@ -1236,7 +1245,7 @@ main (int argc, char **argv) @@ -1251,7 +1261,7 @@ main (int argc, char **argv)
format_needs_stat = sort_type == sort_time || sort_type == sort_size format_needs_stat = sort_type == sort_time || sort_type == sort_size
|| format == long_format || format == long_format
@ -437,7 +436,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
|| print_block_size; || print_block_size;
format_needs_type = (! format_needs_stat format_needs_type = (! format_needs_stat
&& (recursive && (recursive
@@ -1267,7 +1276,7 @@ main (int argc, char **argv) @@ -1282,7 +1292,7 @@ main (int argc, char **argv)
} }
else else
do do
@ -446,7 +445,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
while (i < argc); while (i < argc);
if (cwd_n_used) if (cwd_n_used)
@@ -1429,7 +1438,7 @@ decode_switches (int argc, char **argv) @@ -1445,7 +1455,7 @@ decode_switches (int argc, char **argv)
ignore_mode = IGNORE_DEFAULT; ignore_mode = IGNORE_DEFAULT;
ignore_patterns = NULL; ignore_patterns = NULL;
hide_patterns = NULL; hide_patterns = NULL;
@ -455,7 +454,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
/* FIXME: put this in a function. */ /* FIXME: put this in a function. */
{ {
@@ -1811,13 +1820,27 @@ decode_switches (int argc, char **argv) @@ -1827,13 +1837,27 @@ decode_switches (int argc, char **argv)
break; break;
case 'Z': case 'Z':
@ -484,7 +483,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
default: default:
usage (LS_FAILURE); usage (LS_FAILURE);
} }
@@ -2517,8 +2540,10 @@ clear_files (void) @@ -2547,8 +2571,10 @@ clear_files (void)
struct fileinfo *f = sorted_file[i]; struct fileinfo *f = sorted_file[i];
free (f->name); free (f->name);
free (f->linkname); free (f->linkname);
@ -497,7 +496,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
} }
cwd_n_used = 0; cwd_n_used = 0;
@@ -2560,6 +2585,7 @@ gobble_file (char const *name, enum file @@ -2590,6 +2616,7 @@ gobble_file (char const *name, enum file
memset (f, '\0', sizeof *f); memset (f, '\0', sizeof *f);
f->stat.st_ino = inode; f->stat.st_ino = inode;
f->filetype = type; f->filetype = type;
@ -505,7 +504,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
if (command_line_arg if (command_line_arg
|| format_needs_stat || format_needs_stat
@@ -2659,7 +2685,7 @@ gobble_file (char const *name, enum file @@ -2689,7 +2716,7 @@ gobble_file (char const *name, enum file
f->stat_ok = true; f->stat_ok = true;
@ -514,7 +513,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
{ {
bool have_acl = false; bool have_acl = false;
int attr_len = (do_deref int attr_len = (do_deref
@@ -2667,9 +2694,7 @@ gobble_file (char const *name, enum file @@ -2708,9 +2735,7 @@ gobble_file (char const *name, enum file
f->scontext = xstrdup ("unlabeled"); f->scontext = xstrdup ("unlabeled");
} }
@ -525,7 +524,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
{ {
f->scontext = UNKNOWN_SECURITY_CONTEXT; f->scontext = UNKNOWN_SECURITY_CONTEXT;
@@ -2681,7 +2706,7 @@ gobble_file (char const *name, enum file @@ -2722,7 +2747,7 @@ gobble_file (char const *name, enum file
err = 0; err = 0;
} }
@ -534,7 +533,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
{ {
int n = file_has_acl (absolute_name, &f->stat); int n = file_has_acl (absolute_name, &f->stat);
err = (n < 0); err = (n < 0);
@@ -3255,6 +3281,13 @@ print_current_files (void) @@ -3297,6 +3322,13 @@ print_current_files (void)
print_long_format (sorted_file[i]); print_long_format (sorted_file[i]);
DIRED_PUTCHAR ('\n'); DIRED_PUTCHAR ('\n');
} }
@ -548,7 +547,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
break; break;
} }
} }
@@ -3481,7 +3514,7 @@ print_long_format (const struct fileinfo @@ -3482,7 +3514,7 @@ print_long_format (const struct fileinfo
The latter is wrong when inode_number_width is zero. */ The latter is wrong when inode_number_width is zero. */
p += strlen (p); p += strlen (p);
} }
@ -557,7 +556,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
if (print_block_size) if (print_block_size)
{ {
char hbuf[LONGEST_HUMAN_READABLE + 1]; char hbuf[LONGEST_HUMAN_READABLE + 1];
@@ -3510,9 +3543,15 @@ print_long_format (const struct fileinfo @@ -3511,9 +3543,15 @@ print_long_format (const struct fileinfo
The latter is wrong when nlink_width is zero. */ The latter is wrong when nlink_width is zero. */
p += strlen (p); p += strlen (p);
@ -574,7 +573,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
{ {
DIRED_FPUTS (buf, stdout, p - buf); DIRED_FPUTS (buf, stdout, p - buf);
@@ -3525,9 +3564,6 @@ print_long_format (const struct fileinfo @@ -3526,9 +3564,6 @@ print_long_format (const struct fileinfo
if (print_author) if (print_author)
format_user (f->stat.st_author, author_width, f->stat_ok); format_user (f->stat.st_author, author_width, f->stat_ok);
@ -584,7 +583,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
p = buf; p = buf;
} }
@@ -3864,9 +3900,6 @@ print_file_name_and_frills (const struct @@ -3867,9 +3902,6 @@ print_file_name_and_frills (const struct
human_readable (ST_NBLOCKS (f->stat), buf, human_output_opts, human_readable (ST_NBLOCKS (f->stat), buf, human_output_opts,
ST_NBLOCKSIZE, output_block_size)); ST_NBLOCKSIZE, output_block_size));
@ -594,7 +593,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
print_name_with_quoting (f->name, FILE_OR_LINK_MODE (f), f->linkok, print_name_with_quoting (f->name, FILE_OR_LINK_MODE (f), f->linkok,
f->stat_ok, f->filetype, NULL); f->stat_ok, f->filetype, NULL);
@@ -4030,9 +4063,6 @@ length_of_file_name_and_frills (const st @@ -4077,9 +4109,6 @@ length_of_file_name_and_frills (const st
output_block_size)) output_block_size))
: block_size_width); : block_size_width);
@ -604,7 +603,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
quote_name (NULL, f->name, filename_quoting_options, &name_width); quote_name (NULL, f->name, filename_quoting_options, &name_width);
len += name_width; len += name_width;
@@ -4461,9 +4491,16 @@ Mandatory arguments to long options are @@ -4510,9 +4539,16 @@ Mandatory arguments to long options are
-w, --width=COLS assume screen width instead of current value\n\ -w, --width=COLS assume screen width instead of current value\n\
-x list entries by lines instead of by columns\n\ -x list entries by lines instead of by columns\n\
-X sort alphabetically by entry extension\n\ -X sort alphabetically by entry extension\n\
@ -622,7 +621,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
fputs (HELP_OPTION_DESCRIPTION, stdout); fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout); fputs (VERSION_OPTION_DESCRIPTION, stdout);
fputs (_("\n\ fputs (_("\n\
@@ -4487,3 +4524,67 @@ Exit status is 0 if OK, 1 if minor probl @@ -4541,3 +4577,67 @@ Exit status:\n\
} }
exit (status); exit (status);
} }
@ -690,10 +689,10 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
+ print_type_indicator (f->stat_ok, f->stat.st_mode, f->filetype); + print_type_indicator (f->stat_ok, f->stat.st_mode, f->filetype);
+ } + }
+} +}
diff -urp coreutils-6.10-orig/src/mkdir.c coreutils-6.10/src/mkdir.c diff -urp coreutils-7.0.orig/src/mkdir.c coreutils-7.0/src/mkdir.c
--- coreutils-6.10-orig/src/mkdir.c 2008-01-05 23:58:25.000000000 +0100 --- coreutils-7.0.orig/src/mkdir.c 2008-08-24 22:58:15.000000000 +0200
+++ coreutils-6.10/src/mkdir.c 2008-01-25 16:35:14.000000000 +0100 +++ coreutils-7.0/src/mkdir.c 2009-01-28 17:18:52.771914007 +0100
@@ -41,6 +41,7 @@ char *program_name; @@ -39,6 +39,7 @@
static struct option const longopts[] = static struct option const longopts[] =
{ {
{GETOPT_SELINUX_CONTEXT_OPTION_DECL}, {GETOPT_SELINUX_CONTEXT_OPTION_DECL},
@ -701,10 +700,10 @@ diff -urp coreutils-6.10-orig/src/mkdir.c coreutils-6.10/src/mkdir.c
{"mode", required_argument, NULL, 'm'}, {"mode", required_argument, NULL, 'm'},
{"parents", no_argument, NULL, 'p'}, {"parents", no_argument, NULL, 'p'},
{"verbose", no_argument, NULL, 'v'}, {"verbose", no_argument, NULL, 'v'},
diff -urp coreutils-6.10-orig/src/mknod.c coreutils-6.10/src/mknod.c diff -urp coreutils-7.0.orig/src/mknod.c coreutils-7.0/src/mknod.c
--- coreutils-6.10-orig/src/mknod.c 2008-01-05 23:58:25.000000000 +0100 --- coreutils-7.0.orig/src/mknod.c 2008-09-27 19:28:54.000000000 +0200
+++ coreutils-6.10/src/mknod.c 2008-01-25 17:01:11.000000000 +0100 +++ coreutils-7.0/src/mknod.c 2009-01-28 17:18:52.772914014 +0100
@@ -38,7 +38,7 @@ char *program_name; @@ -35,7 +35,7 @@
static struct option const longopts[] = static struct option const longopts[] =
{ {
@ -713,21 +712,21 @@ diff -urp coreutils-6.10-orig/src/mknod.c coreutils-6.10/src/mknod.c
{"mode", required_argument, NULL, 'm'}, {"mode", required_argument, NULL, 'm'},
{GETOPT_HELP_OPTION_DECL}, {GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL}, {GETOPT_VERSION_OPTION_DECL},
diff -urp coreutils-6.10-orig/src/mv.c coreutils-6.10/src/mv.c diff -urp coreutils-7.0.orig/src/mv.c coreutils-7.0/src/mv.c
--- coreutils-6.10-orig/src/mv.c 2008-01-05 23:59:11.000000000 +0100 --- coreutils-7.0.orig/src/mv.c 2009-01-28 17:18:16.752671000 +0100
+++ coreutils-6.10/src/mv.c 2008-01-25 17:11:50.000000000 +0100 +++ coreutils-7.0/src/mv.c 2009-01-28 17:18:52.773914020 +0100
@@ -137,6 +137,7 @@ cp_option_init (struct cp_options *x) @@ -138,6 +138,7 @@ cp_option_init (struct cp_options *x)
x->preserve_mode = true; x->preserve_mode = true;
x->preserve_timestamps = true; x->preserve_timestamps = true;
x->preserve_security_context = selinux_enabled; x->preserve_security_context = selinux_enabled;
+ x->set_security_context = false; + x->set_security_context = false;
x->require_preserve = false; /* FIXME: maybe make this an option */ x->require_preserve = false; /* FIXME: maybe make this an option */
x->require_preserve_context = false; x->require_preserve_context = false;
x->recursive = true; x->preserve_xattr = true;
diff -urNp coreutils-6.12-orig/src/runcon.c coreutils-6.12/src/runcon.c diff -urp coreutils-7.0.orig/src/runcon.c coreutils-7.0/src/runcon.c
--- coreutils-6.12-orig/src/runcon.c 2008-05-26 12:10:20.000000000 +0200 --- coreutils-7.0.orig/src/runcon.c 2008-08-24 22:30:10.000000000 +0200
+++ coreutils-6.12/src/runcon.c 2008-10-21 15:57:30.000000000 +0200 +++ coreutils-7.0/src/runcon.c 2009-01-28 17:18:52.774914027 +0100
@@ -88,7 +88,7 @@ Usage: %s CONTEXT COMMAND [args]\n\ @@ -86,7 +86,7 @@ Usage: %s CONTEXT COMMAND [args]\n\
or: %s [ -c ] [-u USER] [-r ROLE] [-t TYPE] [-l RANGE] COMMAND [args]\n\ or: %s [ -c ] [-u USER] [-r ROLE] [-t TYPE] [-l RANGE] COMMAND [args]\n\
"), program_name, program_name); "), program_name, program_name);
fputs (_("\ fputs (_("\
@ -736,10 +735,10 @@ diff -urNp coreutils-6.12-orig/src/runcon.c coreutils-6.12/src/runcon.c
With neither CONTEXT nor COMMAND, print the current security context.\n\ With neither CONTEXT nor COMMAND, print the current security context.\n\
\n\ \n\
CONTEXT Complete security context\n\ CONTEXT Complete security context\n\
diff -urp coreutils-6.10-orig/src/stat.c coreutils-6.10/src/stat.c diff -urp coreutils-7.0.orig/src/stat.c coreutils-7.0/src/stat.c
--- coreutils-6.10-orig/src/stat.c 2008-01-05 23:59:11.000000000 +0100 --- coreutils-7.0.orig/src/stat.c 2008-09-27 19:28:54.000000000 +0200
+++ coreutils-6.10/src/stat.c 2008-01-25 16:50:24.000000000 +0100 +++ coreutils-7.0/src/stat.c 2009-01-28 17:18:52.775914034 +0100
@@ -831,7 +831,7 @@ print_it (char const *format, char const @@ -823,7 +823,7 @@ print_it (char const *format, char const
/* Stat the file system and print what we find. */ /* Stat the file system and print what we find. */
static bool static bool
@ -748,7 +747,7 @@ diff -urp coreutils-6.10-orig/src/stat.c coreutils-6.10/src/stat.c
{ {
STRUCT_STATVFS statfsbuf; STRUCT_STATVFS statfsbuf;
@@ -843,15 +843,31 @@ do_statfs (char const *filename, bool te @@ -835,15 +835,31 @@ do_statfs (char const *filename, bool te
} }
if (format == NULL) if (format == NULL)
@ -787,7 +786,7 @@ diff -urp coreutils-6.10-orig/src/stat.c coreutils-6.10/src/stat.c
print_it (format, filename, print_statfs, &statfsbuf); print_it (format, filename, print_statfs, &statfsbuf);
return true; return true;
@@ -859,7 +875,7 @@ do_statfs (char const *filename, bool te @@ -851,7 +867,7 @@ do_statfs (char const *filename, bool te
/* stat the file and print what we find */ /* stat the file and print what we find */
static bool static bool
@ -796,7 +795,7 @@ diff -urp coreutils-6.10-orig/src/stat.c coreutils-6.10/src/stat.c
{ {
struct stat statbuf; struct stat statbuf;
@@ -872,9 +888,12 @@ do_stat (char const *filename, bool ters @@ -864,9 +880,12 @@ do_stat (char const *filename, bool ters
if (format == NULL) if (format == NULL)
{ {
if (terse) if (terse)
@ -812,7 +811,7 @@ diff -urp coreutils-6.10-orig/src/stat.c coreutils-6.10/src/stat.c
else else
{ {
/* Temporary hack to match original output until conditional /* Temporary hack to match original output until conditional
@@ -891,12 +910,22 @@ do_stat (char const *filename, bool ters @@ -883,12 +902,22 @@ do_stat (char const *filename, bool ters
} }
else else
{ {
@ -841,7 +840,7 @@ diff -urp coreutils-6.10-orig/src/stat.c coreutils-6.10/src/stat.c
} }
} }
} }
@@ -917,6 +946,7 @@ usage (int status) @@ -909,6 +938,7 @@ usage (int status)
Display file or file system status.\n\ Display file or file system status.\n\
\n\ \n\
-L, --dereference follow links\n\ -L, --dereference follow links\n\
@ -849,7 +848,7 @@ diff -urp coreutils-6.10-orig/src/stat.c coreutils-6.10/src/stat.c
-f, --file-system display file system status instead of file status\n\ -f, --file-system display file system status instead of file status\n\
"), stdout); "), stdout);
fputs (_("\ fputs (_("\
@@ -1001,6 +1031,7 @@ main (int argc, char *argv[]) @@ -993,6 +1023,7 @@ main (int argc, char *argv[])
int i; int i;
bool fs = false; bool fs = false;
bool terse = false; bool terse = false;
@ -857,7 +856,7 @@ diff -urp coreutils-6.10-orig/src/stat.c coreutils-6.10/src/stat.c
char *format = NULL; char *format = NULL;
bool ok = true; bool ok = true;
@@ -1040,13 +1071,13 @@ main (int argc, char *argv[]) @@ -1032,13 +1063,13 @@ main (int argc, char *argv[])
terse = true; terse = true;
break; break;
@ -878,7 +877,7 @@ diff -urp coreutils-6.10-orig/src/stat.c coreutils-6.10/src/stat.c
break; break;
case_GETOPT_HELP_CHAR; case_GETOPT_HELP_CHAR;
@@ -1062,8 +1097,8 @@ main (int argc, char *argv[]) @@ -1058,8 +1089,8 @@ main (int argc, char *argv[])
for (i = optind; i < argc; i++) for (i = optind; i < argc; i++)
ok &= (fs ok &= (fs
@ -889,10 +888,10 @@ diff -urp coreutils-6.10-orig/src/stat.c coreutils-6.10/src/stat.c
exit (ok ? EXIT_SUCCESS : EXIT_FAILURE); exit (ok ? EXIT_SUCCESS : EXIT_FAILURE);
} }
diff -urp coreutils-6.10-orig/tests/misc/selinux coreutils-6.10/tests/misc/selinux diff -urp coreutils-7.0.orig/tests/misc/selinux coreutils-7.0/tests/misc/selinux
--- coreutils-6.10-orig/tests/misc/selinux 2008-01-11 11:34:22.000000000 +0100 --- coreutils-7.0.orig/tests/misc/selinux 2008-09-27 19:28:54.000000000 +0200
+++ coreutils-6.10/tests/misc/selinux 2008-01-25 18:17:59.000000000 +0100 +++ coreutils-7.0/tests/misc/selinux 2009-01-28 17:18:52.776914041 +0100
@@ -32,12 +32,10 @@ chcon $ctx f d p 2>/dev/null || { @@ -30,12 +30,10 @@ chcon $ctx f d p ||
# inspect that context with both ls -Z and stat. # inspect that context with both ls -Z and stat.
for i in d f p; do for i in d f p; do

View File

@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils Name: coreutils
Version: 7.0 Version: 7.0
Release: 5%{?dist} Release: 6%{?dist}
License: GPLv3+ License: GPLv3+
Group: System Environment/Base Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/ Url: http://www.gnu.org/software/coreutils/
@ -21,6 +21,8 @@ Source203: coreutils-runuser-l.pamd
Patch1: coreutils-446294-lsexitstatuses.patch Patch1: coreutils-446294-lsexitstatuses.patch
Patch2: coreutils-7.0-dftotal.patch Patch2: coreutils-7.0-dftotal.patch
Patch3: coreutils-7.0-expr-removebignumoptions.patch Patch3: coreutils-7.0-expr-removebignumoptions.patch
Patch4: coreutils-7.0-cp-mv-n.patch
Patch5: coreutils-7.0-xattr.patch
# Our patches # Our patches
Patch100: coreutils-6.10-configuration.patch Patch100: coreutils-6.10-configuration.patch
@ -64,6 +66,7 @@ BuildRequires: autoconf >= 2.58
BuildRequires: automake >= 1.10.1 BuildRequires: automake >= 1.10.1
%{?!nopam:BuildRequires: pam-devel} %{?!nopam:BuildRequires: pam-devel}
BuildRequires: libcap-devel >= 2.0.6 BuildRequires: libcap-devel >= 2.0.6
Requires: libattr-devel
Requires(post): libselinux >= 1.25.6-1 Requires(post): libselinux >= 1.25.6-1
Requires: libattr Requires: libattr
@ -106,6 +109,8 @@ the old GNU fileutils, sh-utils, and textutils packages.
%patch1 -p1 -b .lsexit %patch1 -p1 -b .lsexit
%patch2 -p1 -b .dftotal %patch2 -p1 -b .dftotal
%patch3 -p1 -b .bignum %patch3 -p1 -b .bignum
%patch4 -p1 -b .cpmvn
%patch5 -p1 -b .xattr
# Our patches # Our patches
%patch100 -p1 -b .configure %patch100 -p1 -b .configure
@ -137,6 +142,8 @@ the old GNU fileutils, sh-utils, and textutils packages.
chmod a+x tests/misc/sort-mb-tests chmod a+x tests/misc/sort-mb-tests
chmod a+x tests/misc/id-context chmod a+x tests/misc/id-context
chmod a+x tests/mv/mv-n
chmod a+x tests/misc/xattr
sed -i 's/1.10a/1.10.1/' configure.ac sed -i 's/1.10a/1.10.1/' configure.ac
@ -320,6 +327,10 @@ fi
/sbin/runuser /sbin/runuser
%changelog %changelog
* Wed Jan 28 2009 Kamil Dudka <kdudka@redhat.com> - 7.0-6
- cp/mv: add --no-clobber (-n) option to not overwrite target
- cp/mv: add xattr support (#202823)
* Thu Dec 04 2008 Ondrej Vasik <ovasik@redhat.com> - 7.0-5 * Thu Dec 04 2008 Ondrej Vasik <ovasik@redhat.com> - 7.0-5
- fix info documentation for expr command as well(#474434) - fix info documentation for expr command as well(#474434)