New upstream release 7.1, removed applied patches, amended patches and

LS_COLORS files
This commit is contained in:
Ondrej Vasik 2009-02-24 11:53:38 +00:00
parent eded8d92cb
commit c4b1fe4c8a
21 changed files with 205 additions and 2766 deletions

View File

@ -1 +1 @@
coreutils-7.0.tar.lzma
coreutils-7.1.tar.gz

View File

@ -1,83 +0,0 @@
From 50654566c77d1335870206f657507a2d1c23f628 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= <ovasik <at> redhat.com>
Date: Thu, 9 Oct 2008 10:56:54 +0200
Subject: [PATCH] doc: ls: clarify exit status description
* src/ls.c (exit_status): Clarify comments.
(usage): Clarify exit status description in --help output.
* doc/coreutils.texi (ls invocation): Clarify exit status documentation
Reported by Greg Metcalfe in <http://bugzilla.redhat.com/446294>.
---
THANKS | 1 +
doc/coreutils.texi | 7 +++++--
src/ls.c | 16 ++++++++++++----
3 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/THANKS b/THANKS
index e6e48b3..d06f755 100644
--- a/THANKS
+++ b/THANKS
@@ -201,6 +201,7 @@ Guochun Shi gshi@ncsa.uiuc.edu
GOTO Masanori gotom@debian.or.jp
Greg Louis glouis@dynamicro.on.ca
Greg McGary gkm@gnu.org
+Greg Metcalfe metcalfegreg@qwest.net
Greg Schafer gschafer@zip.com.au
Greg Troxel gdt@bbn.com
Greg Wooledge gawooledge@sherwin.com
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index a0d2202..b7e044d 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -6073,8 +6073,11 @@ ls invocation
@display
0 success
-1 minor problems (e.g., a subdirectory was not found)
-2 serious trouble (e.g., memory exhausted)
+1 minor problems (e.g., failure to access a file or directory not
+ specified as a command line argument. This happens when listing a
+ directory in which entries are actively being removed or renamed.)
+2 serious trouble (e.g., memory exhausted, invalid option or failure
+ to access file or directory specified as a command line argument)
@end display
Also see @ref{Common options}.
diff --git a/src/ls.c b/src/ls.c
index e107162..108d669 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -715,11 +715,14 @@ static int exit_status;
/* Exit statuses. */
enum
{
- /* "ls" had a minor problem (e.g., it could not stat a directory
- entry). */
+ /* "ls" had a minor problem. E.g., while processing a directory,
+ ls obtained the name of an entry via readdir, yet was later
+ unable to stat that name. This happens when listing a directory
+ in which entries are actively being removed or renamed. */
LS_MINOR_PROBLEM = 1,
- /* "ls" had more serious trouble. */
+ /* "ls" had more serious trouble (e.g., memory exhausted, invalid
+ option or failure to stat a command line argument. */
LS_FAILURE = 2
};
@@ -4527,7 +4530,12 @@ colors, and can be set easily by the dircolors command.\n\
"), stdout);
fputs (_("\
\n\
-Exit status is 0 if OK, 1 if minor problems, 2 if serious trouble.\n\
+Exit status:\n\
+0 if OK,\n\
+1 if minor problems (e.g., failure to access a file or directory not\n\
+ specified as a command line argument\n\
+2 if serious trouble (e.g., memory exhausted, invalid option or failure\n\
+ to access a file or directory specified as a command line argument).\n\
"), stdout);
emit_bug_reporting_address ();
}
--
1.6.0.2.514.g23abd3

View File

@ -1,46 +0,0 @@
diff -urNp coreutils-6.12-orig/src/chcon.c coreutils-6.12/src/chcon.c
--- coreutils-6.12-orig/src/chcon.c 2008-10-08 14:45:59.000000000 +0200
+++ coreutils-6.12/src/chcon.c 2008-10-08 16:28:36.000000000 +0200
@@ -35,25 +35,6 @@
proper_name ("Russell Coker"), \
proper_name ("Jim Meyering")
-enum Change_status
-{
- CH_NOT_APPLIED,
- CH_SUCCEEDED,
- CH_FAILED,
- CH_NO_CHANGE_REQUESTED
-};
-
-enum Verbosity
-{
- /* Print a message for each file that is processed. */
- V_high,
-
- /* Print a message for each file whose attributes we change. */
- V_changes_only,
-
- /* Do not be verbose. This is the default. */
- V_off
-};
/* If nonzero, and the systems has support for it, change the context
of symbolic links rather than any files they point to. */
@@ -374,7 +355,6 @@ Usage: %s [OPTION]... CONTEXT FILE...\n\
Change the SELinux security context of each FILE to CONTEXT.\n\
With --reference, change the security context of each FILE to that of RFILE.\n\
\n\
- -c, --changes like verbose but report only when a change is made\n\
-h, --no-dereference affect symbolic links instead of any referenced file\n\
"), stdout);
fputs (_("\
@@ -435,7 +415,7 @@ main (int argc, char **argv)
atexit (close_stdout);
- while ((optc = getopt_long (argc, argv, "HLPRchvu:r:t:l:", long_options, NULL))
+ while ((optc = getopt_long (argc, argv, "HLPRhvu:r:t:l:", long_options, NULL))
!= -1)
{
switch (optc)

View File

@ -107,15 +107,15 @@ diff -urNp coreutils-7.0.orig/src/su.c coreutils-7.0/src/su.c
# include <paths.h>
@@ -149,6 +155,10 @@
#ifndef USE_PAM
char *crypt ();
char *crypt (char const *key, char const *salt);
#endif
+#ifndef CHECKPASSWD
+#define CHECKPASSWD 1
+#endif
+
char *getusershell ();
void endusershell ();
void setusershell ();
char *getusershell (void);
void endusershell (void);
void setusershell (void);
@@ -156,7 +166,11 @@ void setusershell ();
extern char **environ;

View File

@ -1,22 +1,3 @@
diff -urNp coreutils-7.0-orig/tests/Makefile.am coreutils-7.0/tests/Makefile.am
--- coreutils-7.0-orig/tests/Makefile.am 2008-11-11 16:37:08.000000000 +0100
+++ coreutils-7.0/tests/Makefile.am 2008-11-11 16:39:55.000000000 +0100
@@ -217,7 +217,6 @@ TESTS = \
misc/tee-dash \
misc/test-diag \
misc/timeout \
- misc/timeout-parameters \
misc/tr \
misc/truncate-dangling-symlink \
misc/truncate-dir-fail \
@@ -285,7 +284,6 @@ TESTS = \
dd/skip-seek \
dd/skip-seek2 \
dd/unblock-sync \
- df/total \
df/total-awk \
du/2g \
du/8gb \
diff -urN coreutils-6.12-orig/tests/misc/cut coreutils-6.12/tests/misc/cut
--- coreutils-6.12-orig/tests/misc/cut 2008-05-17 08:41:11.000000000 +0200
+++ coreutils-6.12/tests/misc/cut 2008-06-02 11:13:08.000000000 +0200

View File

@ -1,13 +0,0 @@
diff -urp coreutils-6.10-orig/lib/long-options.c coreutils-6.10/lib/long-options.c
--- coreutils-6.10-orig/lib/long-options.c 2007-10-17 15:47:26.000000000 +0200
+++ coreutils-6.10/lib/long-options.c 2008-01-31 14:28:01.000000000 +0100
@@ -57,8 +57,7 @@ parse_long_options (int argc,
/* Don't print an error message for unrecognized options. */
opterr = 0;
- if (argc == 2
- && (c = getopt_long (argc, argv, "+", long_options, NULL)) != -1)
+ while ((c = getopt_long (argc, argv, "+", long_options, NULL)) != -1)
{
switch (c)
{

View File

@ -11,15 +11,3 @@ diff -urNp coreutils-6.12-orig/src/md5sum.c coreutils-6.12/src/md5sum.c
fputs (_("\
\n\
The following three options are useful only when verifying checksums:\n\
diff -urNp coreutils-6.12-orig/src/sort.c coreutils-6.12/src/sort.c
--- coreutils-6.12-orig/src/sort.c 2008-10-21 16:04:50.000000000 +0200
+++ coreutils-6.12/src/sort.c 2008-10-22 10:52:30.000000000 +0200
@@ -412,7 +413,7 @@ With no FILE, or when FILE is -, read st
\n\
*** WARNING ***\n\
The locale specified by the environment affects sort order.\n\
-Set LC_ALL=C to get the traditional sort order that uses\n\
+Set LC_ALL=C (by \"export LC_LL=C\") to get the traditional sort order that uses\n\
native byte values.\n\
"), stdout );
emit_bug_reporting_address ();

View File

@ -1,22 +0,0 @@
diff -up coreutils-6.11/src/Makefile.am.sparc coreutils-6.11/src/Makefile.am
--- coreutils-6.11/src/Makefile.am.sparc 2008-04-19 16:34:23.000000000 -0500
+++ coreutils-6.11/src/Makefile.am 2008-05-29 18:40:36.000000000 -0500
@@ -101,6 +101,7 @@ shred_LDADD = $(LDADD) $(LIB_GETHRXTIME)
shuf_LDADD = $(LDADD) $(LIB_GETHRXTIME)
tac_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
vdir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_SELINUX) $(LIB_CAP)
+tac_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
## If necessary, add -lm to resolve use of pow in lib/strtod.c.
sort_LDADD = $(LDADD) $(POW_LIB) $(LIB_GETHRXTIME)
diff -up coreutils-6.11/src/Makefile.in.sparc coreutils-6.11/src/Makefile.in
--- coreutils-6.11/src/Makefile.in.sparc 2008-04-19 16:50:10.000000000 -0500
+++ coreutils-6.11/src/Makefile.in 2008-05-29 18:40:36.000000000 -0500
@@ -1251,6 +1251,7 @@ shuf_LDADD = $(LDADD) $(LIB_GETHRXTIME)
vdir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_SELINUX) $(LIB_CAP) \
$(LIB_ACL)
sort_LDADD = $(LDADD) $(POW_LIB) $(LIB_GETHRXTIME)
+tac_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
# for get_date and gettime
date_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)

View File

@ -1,322 +0,0 @@
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

View File

@ -1,115 +0,0 @@
diff -urNp coreutils-7.0-orig/tests/df/total-awk coreutils-7.0/tests/df/total-awk
--- coreutils-7.0-orig/tests/df/total-awk 2008-09-27 19:28:54.000000000 +0200
+++ coreutils-7.0/tests/df/total-awk 2008-11-11 16:54:49.000000000 +0100
@@ -18,7 +18,7 @@
if test "$VERBOSE" = yes; then
set -x
- ls --version
+ df --version
fi
. $srcdir/test-lib.sh
@@ -24,6 +24,8 @@
. $srcdir/test-lib.sh
+ df || skip_test_ "df fails"
+
fail=0
# Don't let a different umask perturb the results.
@@ -23,58 +25,44 @@ fi
. $srcdir/test-lib.sh
-fail=0
-
-# Don't let a different umask perturb the results.
-umask 22
-
-echo '
-BEGIN {
- total = 0
- used = 0
- available = 0
-}
-{
- if (NR==1 || $0==$1 || $0~/^total +(-?[0-9]+|-) +(-?[0-9]+|-) +(-?[0-9]+|-) +-?[0-9]+%$/)
- next
- if ($1~/^[0-9]/)
- {
- total += $1
- used += $2
- available += $3
- }
- else
- {
- total += $2
- used += $3
- available += $4
- }
-}
-END {
- print total
- print used
- print available
-}
-' > compute_sum.awk || fail=1
-
-echo '
-/^total +(-?[0-9]+|-) +(-?[0-9]+|-) +(-?[0-9]+|-) +-?[0-9]+%$/ {
- print $2;
- print $3;
- print $4
-}
-' > parse_total.awk || fail=1
+cat <<\EOF > check-df || framework_failure
+my ($total, $used, $avail) = (0, 0, 0);
+while (<>)
+ {
+ $. == 1
+ and next; # skip first (header) line
+ # Recognize df output lines like these:
+ # /dev/sdc1 0 0 0 - /c
+ # tmpfs 1536000 12965 1523035 1% /tmp
+ # total 5285932 787409 4498523 15%
+ /^(.*?) +(-?\d+|-) +(-?\d+|-) +(-?\d+|-) +(?:- |[0-9]+%)(.*)$/
+ or die "$0: invalid input line\n: $_";
+ if ($1 eq 'total' && $5 eq '')
+ {
+ $total == $2 or die "$total != $2";
+ $used == $3 or die "$used != $3";
+ $avail == $4 or die "$avail != $4";
+ my $line = <>;
+ defined $line
+ and die "$0: extra line(s) after totals\n";
+ exit 0;
+ }
+ $total += $2 unless $2 eq '-';
+ $used += $3 unless $3 eq '-';
+ $avail += $4 unless $4 eq '-';
+ }
+die "$0: missing line of totals\n";
+EOF
# Use --block-size=512 to keep df from printing rounded-to-kilobyte
# numbers which wouldn't necessarily add up to the displayed total.
-df --block-size=512 --total |tee tmp || fail=1
-$AWK -f compute_sum.awk tmp > out1 || fail=1
-$AWK -f parse_total.awk tmp > out2 || fail=1
-compare out1 out2 || fail=1
+fail=0
+df --total -P --block-size=512 >space || fail=1
+cat space # this helps when debugging any test failure
+df --total -i -P >inode || fail=1
+cat inode
-df -i --block-size=512 --total |tee tmp || fail=1
-$AWK -f compute_sum.awk tmp > out1 || fail=1
-$AWK -f parse_total.awk tmp > out2 || fail=1
-compare out1 out2 || fail=1
+$PERL -f check-df space || fail=1
+$PERL -f check-df inode || fail=1
Exit $fail

File diff suppressed because it is too large Load Diff

View File

@ -1,792 +0,0 @@
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,4 +1,5 @@
# Configuration file for the color ls utility
# 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.
@ -34,6 +35,8 @@ TERM cygwin
TERM dtterm
TERM eterm-color
TERM gnome
TERM gnome-256color
TERM jfbterm
TERM konsole
TERM kterm
TERM linux
@ -63,22 +66,24 @@ 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:
# 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 # global default, although everything should be something.
FILE 00 # normal file
DIR 01;34 # directory
LINK 01;36 # symbolic link (If you set this to 'target' instead of a
#NORMAL 00 # no color code at all
#FILE 00 # normal file, use no color at all
RESET 0 # reset to "normal" color
DIR 01;34 # directory
LINK 01;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 01;35 # socket
DOOR 01;35 # door
BLK 40;33;01 # block device driver
CHR 40;33;01 # character 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)
@ -90,13 +95,13 @@ STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
# This is for files with execute permission:
EXEC 01;32
EXEC 01;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 '#')
# executables (bright green)
#.cmd 01;32
#.cmd 01;32
#.exe 01;32
#.com 01;32
#.btm 01;32
@ -104,9 +109,8 @@ EXEC 01;32
#.sh 01;32
#.csh 01;32
# archives or compressed (bright red)
.tar 01;31
.tar 01;31
.tgz 01;31
.svgz 01;31
.arj 01;31
.taz 01;31
.lzh 01;31
@ -129,8 +133,9 @@ EXEC 01;32
.cpio 01;31
.7z 01;31
.rz 01;31
.xz 01;31
# image formats (magenta)
.jpg 01;35
.jpg 01;35
.jpeg 01;35
.gif 01;35
.bmp 01;35
@ -164,21 +169,33 @@ EXEC 01;32
.flc 01;35
.avi 01;35
.fli 01;35
.flv 01;35
.gl 01;35
.dl 01;35
.xcf 01;35
.xwd 01;35
.yuv 01;35
.svg 01;35
.svgz 01;35
# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
.axv 01;35
.anx 01;35
.ogv 01;35
.ogx 01;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
.aac 01;36
.au 01;36
.flac 01;36
.mid 01;36
.midi 01;36
.mka 01;36
.mp3 01;36
.mpc 01;36
.ogg 01;36
.ra 01;36
.wav 01;36
# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
.axa 01;36
.oga 01;36
.spx 01;36
.xspf 01;36

View File

@ -1,5 +1,6 @@
# Configuration file for the 256color ls utility
# This file goes in the /etc directory, and must be world readable.
# Synchronized with coreutils 7.1 dircolors
# You can copy this file to .dir_colors in your $HOME directory to override
# the system defaults.
# In the case that you are not satisfied with supplied colors, please
@ -31,7 +32,7 @@ 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:
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color(8 colors mode) codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
@ -48,16 +49,18 @@ EIGHTBIT 1
# You may find following command useful to search the best one for you:
# for ((x=0; x<=255; x++));do echo -e "${x}:\033[48;5;${x}mcolor\033[000m";done
NORMAL 00 # global default, although everything should be something.
FILE 00 # normal file
DIR 01;38;5;27 # directory
LINK 01;38;5;51 # symbolic link (If you set this to 'target' instead of a
#NORMAL 00 # global default, no color code at all
#FILE 00 # normal file, use no color at all
RESET 0 # reset to "normal" color
DIR 01;38;5;27 # directory
LINK 01;38;5;51 # symbolic link (If you set this to 'target' instead of a
# numerical value, the color is as for the file pointed to.)
HARDLINK 44;38;5;15; # regular file with more than one link
FIFO 40;38;5;11 # pipe
SOCK 01;38;5;13 # socket
DOOR 01;38;5;5 # door
BLK 01;48;5;232;38;5;11 # block device driver
CHR 01;48;5;232;38;5;3 # character device driver
CHR 01;48;5;232;38;5;3 # character device driver
ORPHAN 01;48;5;232;38;5;9 # symlink to nonexistent file, or non-stat'able file
MISSING 01;05;48;5;232;38;5;15 # ... and the files they point to
SETUID 48;5;196;38;5;15 # file that is setuid (u+s)
@ -82,9 +85,8 @@ EXEC 01;38;5;34
#.sh 01;38;5;34
#.csh 01;38;5;34
# archives or compressed (bright red)
.tar 01;38;5;9
.tar 01;38;5;9
.tgz 01;38;5;9
.svgz 01;38;5;9
.arj 01;38;5;9
.taz 01;38;5;9
.lzh 01;38;5;9
@ -107,8 +109,9 @@ EXEC 01;38;5;34
.cpio 01;38;5;9
.7z 01;38;5;9
.rz 01;38;5;9
.xz 01;38;5;9
# image formats (magenta)
.jpg 01;38;5;13
.jpg 01;38;5;13
.jpeg 01;38;5;13
.gif 01;38;5;13
.bmp 01;38;5;13
@ -142,21 +145,33 @@ EXEC 01;38;5;34
.flc 01;38;5;13
.avi 01;38;5;13
.fli 01;38;5;13
.flv 01;38;5;13
.gl 01;38;5;13
.dl 01;38;5;13
.xcf 01;38;5;13
.xwd 01;38;5;13
.yuv 01;38;5;13
.svg 01;38;5;13
.svgz 01;38;5;13
# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
.axv 01;38;5;13
.anx 01;38;5;13
.ogv 01;38;5;13
.ogx 01;38;5;13
# audio formats (cyan)
.aac 00;38;5;45
.au 00;38;5;45
.flac 00;38;5;45
.mid 00;38;5;45
.midi 00;38;5;45
.mka 00;38;5;45
.mp3 00;38;5;45
.mpc 00;38;5;45
.ogg 00;38;5;45
.ra 00;38;5;45
.wav 00;38;5;45
.aac 01;38;5;45
.au 01;38;5;45
.flac 01;38;5;45
.mid 01;38;5;45
.midi 01;38;5;45
.mka 01;38;5;45
.mp3 01;38;5;45
.mpc 01;38;5;45
.ogg 01;38;5;45
.ra 01;38;5;45
.wav 01;38;5;45
# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
.axa 01;38;5;45
.oga 01;38;5;45
.spx 01;38;5;45
.xspf 01;38;5;45

View File

@ -1,4 +1,5 @@
# Configuration file for the color ls utility
# 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.
@ -45,22 +46,24 @@ 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:
# 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 # global default, although everything should be something.
FILE 00 # normal file
DIR 00;34 # directory
LINK 00;36 # symbolic link (If you set this to 'target' instead of a
#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
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)
@ -72,7 +75,7 @@ STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
# This is for files with execute permission:
EXEC 00;32
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.
@ -85,9 +88,8 @@ EXEC 00;32
#.sh 00;32
#.csh 00;32
# archives or compressed (red)
.tar 00;31
.tar 00;31
.tgz 00;31
.svgz 00;31
.arj 00;31
.taz 00;31
.lzh 00;31
@ -110,8 +112,9 @@ EXEC 00;32
.cpio 00;31
.7z 00;31
.rz 00;31
.xz 00;31
# image formats (magenta)
.jpg 00;35
.jpg 00;35
.jpeg 00;35
.gif 00;35
.bmp 00;35
@ -145,12 +148,19 @@ EXEC 00;32
.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
@ -163,3 +173,8 @@ EXEC 00;32
.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

View File

@ -331,7 +331,7 @@ diff -urN coreutils-6.12-orig/tests/Makefile.am coreutils-6.12/tests/Makefile.am
error (EXIT_FAILURE, errno, "-");
--- coreutils-6.8+/src/join.c.i18n 2007-01-14 15:41:28.000000000 +0000
+++ coreutils-6.8+/src/join.c 2007-03-01 15:08:24.000000000 +0000
@@ -23,17 +23,31 @@
@@ -23,16 +23,30 @@
#include <sys/types.h>
#include <getopt.h>
@ -347,7 +347,6 @@ diff -urN coreutils-6.12-orig/tests/Makefile.am coreutils-6.12/tests/Makefile.am
+
#include "system.h"
#include "error.h"
#include "hard-locale.h"
#include "linebuffer.h"
-#include "memcasecmp.h"
#include "quote.h"
@ -2841,11 +2840,11 @@ diff -urNp coreutils-6.11-orig/src/join.c coreutils-6.11/src/join.c
line of 1st page printed). */
@@ -696,6 +756,7 @@
-a|COLUMN|-m is a `space' and with the -J option a `tab'. */
static char *col_sep_string = "";
static char *col_sep_string = (char *) "";
static int col_sep_length = 0;
+static int col_sep_width = 0;
static char *column_separator = " ";
static char *line_separator = "\t";
static char *column_separator = (char *) " ";
static char *line_separator = (char *) "\t";
@@ -852,6 +913,13 @@
col_sep_length = (int) strlen (optarg_S);
@ -2927,7 +2926,7 @@ diff -urNp coreutils-6.11-orig/src/join.c coreutils-6.11/src/join.c
@@ -1031,7 +1122,7 @@
old_s = false;
/* Reset an additional input of -s, -S dominates -s */
col_sep_string = "";
col_sep_string = bad_cast ("");
- col_sep_length = 0;
+ col_sep_length = col_sep_width = 0;
use_col_separator = true;

View File

@ -49,11 +49,11 @@
#define DEFAULT_USER "root"
+#ifndef USE_PAM
char *crypt ();
char *crypt (char const *key, char const *salt);
+#endif
char *getusershell ();
void endusershell ();
void setusershell ();
char *getusershell (void);
void endusershell (void);
void setusershell (void);
extern char **environ;

View File

@ -49,71 +49,6 @@ diff -urp coreutils-7.0.orig/src/chcon.c coreutils-7.0/src/chcon.c
diff -urp coreutils-7.0.orig/src/copy.c coreutils-7.0/src/copy.c
--- coreutils-7.0.orig/src/copy.c 2009-01-28 17:18:16.748671000 +0100
+++ coreutils-7.0/src/copy.c 2009-01-28 17:18:52.762913947 +0100
@@ -449,9 +449,10 @@ copy_reg (char const *src_name, char con
security_context_t con = NULL;
if (getfscreatecon (&con) < 0)
{
- error (0, errno, _("failed to get file system create context"));
+ //do not show error when we not require security context (-a option)
if (x->require_preserve_context)
{
+ error (0, errno, _("failed to get file system create context"));
return_val = false;
goto close_src_and_dst_desc;
}
@@ -461,11 +462,12 @@ copy_reg (char const *src_name, char con
{
if (fsetfilecon (dest_desc, con) < 0)
{
- error (0, errno,
- _("failed to set the security context of %s to %s"),
- quote_n (0, dst_name), quote_n (1, con));
+ //do not show error when we not require security context (-a option)
if (x->require_preserve_context)
{
+ error (0, errno,
+ _("failed to set the security context of %s to %s"),
+ quote_n (0, dst_name), quote_n (1, con));
return_val = false;
freecon (con);
goto close_src_and_dst_desc;
@@ -1714,11 +1716,12 @@ copy_internal (char const *src_name, cha
{
if (setfscreatecon (con) < 0)
{
- error (0, errno,
- _("failed to set default file creation context to %s"),
- quote (con));
+ //do not show error when we not require security context (-a option)
if (x->require_preserve_context)
{
+ error (0, errno,
+ _("failed to set default file creation context to %s"),
+ quote (con));
freecon (con);
return false;
}
@@ -1728,12 +1731,14 @@ copy_internal (char const *src_name, cha
else
{
if (errno != ENOTSUP && errno != ENODATA)
- {
- error (0, errno,
- _("failed to get security context of %s"),
- quote (src_name));
- if (x->require_preserve_context)
- return false;
+ {
+ //do not show error when we not require security context (-a option)
+ if (x->require_preserve_context) {
+ error (0, errno,
+ _("failed to get security context of %s"),
+ quote (src_name));
+ return false;
+ }
}
}
}
@@ -1819,6 +1824,8 @@ copy_internal (char const *src_name, cha
{
/* Here, we are crossing a file system boundary and cp's -x option
@ -147,15 +82,6 @@ diff -urp coreutils-7.0.orig/src/cp.c coreutils-7.0/src/cp.c
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
@@ -175,7 +176,7 @@ Copy SOURCE to DEST, or multiple SOURCE(
Mandatory arguments to long options are mandatory for short options too.\n\
"), stdout);
fputs (_("\
- -a, --archive same as -dpR\n\
+ -a, --archive same as -cdpR\n\
--backup[=CONTROL] make a backup of each existing destination file\n\
-b like --backup but does not accept an argument\n\
--copy-contents copy contents of special files when recursive\n\
@@ -206,6 +207,9 @@ Mandatory arguments to long options are
all\n\
"), stdout);
@ -191,24 +117,6 @@ diff -urp coreutils-7.0.orig/src/cp.c coreutils-7.0/src/cp.c
long_opts, NULL))
!= -1)
{
@@ -936,13 +942,15 @@ main (int argc, char **argv)
sparse_type_string, sparse_type);
break;
- case 'a': /* Like -dpR. */
+ case 'a': /* Like -dpRc. */
x.dereference = DEREF_NEVER;
x.preserve_links = true;
x.preserve_ownership = true;
x.preserve_mode = true;
x.preserve_timestamps = true;
- x.require_preserve = true;
+ x.require_preserve = true;
+ if (selinux_enabled)
+ x.preserve_security_context = true;
x.recursive = true;
break;
@@ -956,6 +964,16 @@ main (int argc, char **argv)
copy_contents = true;
break;
@ -288,15 +196,15 @@ diff -urp coreutils-7.0.orig/src/install.c coreutils-7.0/src/install.c
x->require_preserve = false;
x->require_preserve_context = false;
+ x->set_security_context = false;
x->require_preserve_xattr = false;
x->recursive = false;
x->sparse_mode = SPARSE_AUTO;
x->symbolic_link = false;
@@ -361,7 +362,7 @@ main (int argc, char **argv)
we'll actually use backup_suffix_string. */
backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
- while ((optc = getopt_long (argc, argv, "bcsDdg:m:o:pt:TvS:Z:", long_options,
+ while ((optc = getopt_long (argc, argv, "bcsDdg:m:o:pPt:TvS:Z:", long_options,
- while ((optc = getopt_long (argc, argv, "bcCsDdg:m:o:pt:TvS:Z:", long_options,
+ while ((optc = getopt_long (argc, argv, "bcCsDdg:m:o:pPt:TvS:Z:", long_options,
NULL)) != -1)
{
switch (optc)
@ -351,18 +259,6 @@ diff -urp coreutils-7.0.orig/src/ls.c coreutils-7.0/src/ls.c
};
/* Display letters and indicators for each filetype.
@@ -182,8 +183,9 @@ struct fileinfo
exists, otherwise false. */
bool linkok;
- /* For long listings, true if the file has an access control list,
- or an SELinux security context. */
+ /* For long listings, true if the file has an access control list.
+ Unlike with upstream not true for SELinux scontext(#430779) as
+ this removes possibility to detect ACL via ls */
bool have_acl;
};
@@ -246,6 +248,7 @@ static void queue_directory (char const
static void sort_files (void);
static void parse_ls_color (void);
@ -513,26 +409,6 @@ diff -urp coreutils-7.0.orig/src/ls.c coreutils-7.0/src/ls.c
{
bool have_acl = false;
int attr_len = (do_deref
@@ -2708,9 +2735,7 @@ gobble_file (char const *name, enum file
f->scontext = xstrdup ("unlabeled");
}
- if (err == 0)
- have_acl = ! STREQ ("unlabeled", f->scontext);
- else
+ if (err != 0)
{
f->scontext = UNKNOWN_SECURITY_CONTEXT;
@@ -2722,7 +2747,7 @@ gobble_file (char const *name, enum file
err = 0;
}
- if (err == 0 && ! have_acl && format == long_format)
+ if (err == 0 && format == long_format)
{
int n = file_has_acl (absolute_name, &f->stat);
err = (n < 0);
@@ -3297,6 +3322,13 @@ print_current_files (void)
print_long_format (sorted_file[i]);
DIRED_PUTCHAR ('\n');
@ -590,9 +466,9 @@ diff -urp coreutils-7.0.orig/src/ls.c coreutils-7.0/src/ls.c
- if (print_scontext)
- printf ("%*s ", format == with_commas ? 0 : scontext_width, f->scontext);
-
print_name_with_quoting (f->name, FILE_OR_LINK_MODE (f), f->linkok,
f->stat_ok, f->filetype, NULL);
size_t width = print_name_with_quoting (f->name, FILE_OR_LINK_MODE (f),
f->linkok, f->stat_ok, f->filetype,
NULL, f->stat.st_nlink, start_col);
@@ -4077,9 +4109,6 @@ length_of_file_name_and_frills (const st
output_block_size))
: block_size_width);
@ -621,74 +497,6 @@ diff -urp coreutils-7.0.orig/src/ls.c coreutils-7.0/src/ls.c
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
fputs (_("\n\
@@ -4541,3 +4577,67 @@ Exit status:\n\
}
exit (status);
}
+
+static void
+print_scontext_format (const struct fileinfo *f)
+{
+ char modebuf[12];
+
+ /* 7 fields that may require LONGEST_HUMAN_READABLE bytes,
+ 1 10-byte mode string,
+ 9 spaces, one following each of these fields, and
+ 1 trailing NUL byte. */
+
+ char init_bigbuf[7 * LONGEST_HUMAN_READABLE + 10 + 9 + 1];
+ char *buf = init_bigbuf;
+ size_t bufsize = sizeof (init_bigbuf);
+ size_t s;
+ char *p;
+ const char *fmt;
+ char *user_name;
+ char *group_name;
+ int rv;
+ char *scontext;
+
+ p = buf;
+
+ if ( print_scontext ) { /* zero means terse listing */
+ filemodestring (&f->stat, modebuf);
+ modebuf[10] = (f->have_acl ? '+' : ' ');
+ modebuf[11] = '\0';
+
+ /* print mode */
+
+ (void) sprintf (p, "%s ", modebuf);
+ p += strlen (p);
+
+ /* print standard user and group */
+
+ DIRED_FPUTS (buf, stdout, p - buf);
+ format_user (f->stat.st_uid, owner_width, f->stat_ok);
+ format_group (f->stat.st_gid, group_width, f->stat_ok);
+ p = buf;
+ }
+
+ (void) sprintf (p, "%-32s ", f->scontext ?: "");
+ p += strlen (p);
+
+ DIRED_INDENT ();
+ DIRED_FPUTS (buf, stdout, p - buf);
+ print_name_with_quoting (f->name, f->stat.st_mode, f->linkok,
+ f->stat_ok, f->filetype, &dired_obstack);
+
+ if (f->filetype == symbolic_link) {
+ if (f->linkname) {
+ DIRED_FPUTS_LITERAL (" -> ", stdout);
+ print_name_with_quoting (f->linkname, f->linkmode, f->linkok - 1,
+ f->stat_ok, f->filetype, NULL);
+ if (indicator_style != none)
+ print_type_indicator (f->stat_ok, f->linkmode, f->filetype);
+ }
+ }
+ else {
+ if (indicator_style != none)
+ print_type_indicator (f->stat_ok, f->stat.st_mode, f->filetype);
+ }
+}
diff -urp coreutils-7.0.orig/src/mkdir.c coreutils-7.0/src/mkdir.c
--- coreutils-7.0.orig/src/mkdir.c 2008-08-24 22:58:15.000000000 +0200
+++ coreutils-7.0/src/mkdir.c 2009-01-28 17:18:52.771914007 +0100
@ -720,9 +528,9 @@ diff -urp coreutils-7.0.orig/src/mv.c coreutils-7.0/src/mv.c
x->preserve_timestamps = true;
x->preserve_security_context = selinux_enabled;
+ x->set_security_context = false;
x->reduce_diagnostics = false;
x->require_preserve = false; /* FIXME: maybe make this an option */
x->require_preserve_context = false;
x->preserve_xattr = true;
diff -urp coreutils-7.0.orig/src/runcon.c coreutils-7.0/src/runcon.c
--- coreutils-7.0.orig/src/runcon.c 2008-08-24 22:30:10.000000000 +0200
+++ coreutils-7.0/src/runcon.c 2009-01-28 17:18:52.774914027 +0100
@ -891,7 +699,7 @@ diff -urp coreutils-7.0.orig/src/stat.c coreutils-7.0/src/stat.c
diff -urp coreutils-7.0.orig/tests/misc/selinux coreutils-7.0/tests/misc/selinux
--- coreutils-7.0.orig/tests/misc/selinux 2008-09-27 19:28:54.000000000 +0200
+++ coreutils-7.0/tests/misc/selinux 2009-01-28 17:18:52.776914041 +0100
@@ -30,12 +30,10 @@ chcon $ctx f d p ||
@@ -30,7 +30,7 @@ chcon $ctx f d p ||
# inspect that context with both ls -Z and stat.
for i in d f p; do
@ -900,8 +708,76 @@ diff -urp coreutils-7.0.orig/tests/misc/selinux coreutils-7.0/tests/misc/selinux
c=`stat --printf %C $i`; test x$c = x$ctx || fail=1
done
-# ensure that ls -l output includes the "+".
-c=`ls -l f|cut -c11`; test "$c" = + || fail=1
diff -urNp coreutils-7.1-orig/src/ls.c coreutils-7.1/src/ls.c
--- coreutils-7.1-orig/src/ls.c 2009-02-23 17:11:01.000000000 +0100
+++ coreutils-7.1/src/ls.c 2009-02-23 17:14:27.000000000 +0100
@@ -3467,6 +3467,69 @@ format_group_width (gid_t g)
}
# Copy each to a new directory and ensure that context is preserved.
cp -r --preserve=all d f p s1 || fail=1
+/* Print info about f in scontext format */
+static void
+print_scontext_format (const struct fileinfo *f)
+{
+ char modebuf[12];
+
+ /* 7 fields that may require LONGEST_HUMAN_READABLE bytes,
+ 1 10-byte mode string,
+ 9 spaces, one following each of these fields, and
+ 1 trailing NUL byte. */
+
+ char init_bigbuf[7 * LONGEST_HUMAN_READABLE + 10 + 9 + 1];
+ char *buf = init_bigbuf;
+ char *p;
+
+ p = buf;
+
+ if ( print_scontext ) { /* zero means terse listing */
+ filemodestring (&f->stat, modebuf);
+ if (! any_has_acl)
+ modebuf[10] = '\0';
+ else if (f->acl_type == ACL_T_SELINUX_ONLY)
+ modebuf[10] = '.';
+ else if (f->acl_type == ACL_T_YES)
+ modebuf[10] = '+';
+ modebuf[11] = '\0';
+
+ /* print mode */
+
+ (void) sprintf (p, "%s ", modebuf);
+ p += strlen (p);
+
+ /* print standard user and group */
+
+ DIRED_FPUTS (buf, stdout, p - buf);
+ format_user (f->stat.st_uid, owner_width, f->stat_ok);
+ format_group (f->stat.st_gid, group_width, f->stat_ok);
+ p = buf;
+ }
+
+ (void) sprintf (p, "%-32s ", f->scontext ?: "");
+ p += strlen (p);
+
+ DIRED_INDENT ();
+ DIRED_FPUTS (buf, stdout, p - buf);
+ size_t w = print_name_with_quoting (f->name, FILE_OR_LINK_MODE(f), f->linkok,
+ f->stat_ok, f->filetype, &dired_obstack, f->stat.st_nlink, p - buf);
+
+ if (f->filetype == symbolic_link) {
+ if (f->linkname) {
+ DIRED_FPUTS_LITERAL (" -> ", stdout);
+ print_name_with_quoting (f->linkname, f->linkmode, f->linkok - 1,
+ f->stat_ok, f->filetype, NULL, f->stat.st_nlink, (p-buf) + w + 4 );
+ if (indicator_style != none)
+ print_type_indicator (f->stat_ok, f->linkmode, f->filetype);
+ }
+ }
+ else {
+ if (indicator_style != none)
+ print_type_indicator (f->stat_ok, f->stat.st_mode, f->filetype);
+ }
+}
+
/* Print information about F in long format. */
static void

View File

@ -1,39 +1,6 @@
diff -urNp coreutils-6.10-orig/doc/coreutils.info coreutils-6.10/doc/coreutils.info
--- coreutils-6.10-orig/doc/coreutils.info 2008-04-07 17:52:11.000000000 +0200
+++ coreutils-6.10/doc/coreutils.info 2008-04-07 18:03:27.000000000 +0200
@@ -5642,7 +5642,7 @@ options::.
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., `ls -U' may list the entries in a copied
- directory in a different order). Equivalent to `-dpR'.
+ directory in a different order). Equivalent to `-cdpR'.
`-b'
`--backup[=METHOD]'
@@ -5660,6 +5660,11 @@ options::.
cp --backup --force -- "$i" "$i"
done
+`-c'
+ Preserve SELinux security context of the original files if possible.
+ Note: Some file systems don't support storing of SELinux security
+ context.
+
`--copy-contents'
If copying recursively, copy the contents of any special files
(e.g., FIFOs and device files) as if they were regular files.
diff -urNp coreutils-6.10-orig/doc/coreutils.texi coreutils-6.10/doc/coreutils.texi
--- coreutils-6.10-orig/doc/coreutils.texi 2008-04-07 17:52:11.000000000 +0200
+++ coreutils-6.10/doc/coreutils.texi 2008-04-07 18:01:43.000000000 +0200
@@ -6957,7 +6957,7 @@ Preserve as much as possible of the stru
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).
-Equivalent to @option{-dpR}.
+Equivalent to @option{-cdpR}.
@item -b
@itemx @w{@kbd{--backup}[=@var{method}]}
@@ -6981,6 +6981,11 @@ for i; do
done
@end example

View File

@ -1,12 +1,13 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 7.0
Release: 8%{?dist}
Version: 7.1
Release: 1%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Source0: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.lzma
#Using .tar.gz tarball until xz utils will be in Fedora
Source0: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.gz
Source101: coreutils-DIR_COLORS
Source102: coreutils-DIR_COLORS.xterm
Source103: coreutils-DIR_COLORS.256color
@ -18,17 +19,10 @@ Source202: coreutils-su-l.pamd
Source203: coreutils-runuser-l.pamd
# From upstream
Patch1: coreutils-446294-lsexitstatuses.patch
Patch2: coreutils-7.0-dftotal.patch
Patch3: coreutils-7.0-expr-removebignumoptions.patch
Patch4: coreutils-7.0-cp-mv-n.patch
Patch5: coreutils-7.0-xattr.patch
# Our patches
Patch100: coreutils-6.10-configuration.patch
Patch101: coreutils-6.10-manpages.patch
#Patch102: coreutils-6.10-longoptions.patch
Patch103: coreutils-6.11-sparc-shafix.patch
# sh-utils
Patch703: sh-utils-2.0.11-dateman.patch
@ -54,15 +48,12 @@ Patch916: coreutils-getfacl-exit-code.patch
#(upstream did some SELinux implementation unlike with RedHat patch)
Patch950: coreutils-selinux.patch
Patch951: coreutils-selinuxmanpages.patch
Patch952: coreutils-463883-chcon-changes.patch
BuildRequires: libselinux-devel >= 1.25.6-1
BuildRequires: libacl-devel
BuildRequires: gettext bison
BuildRequires: texinfo >= 4.3
BuildRequires: lzma
BuildRequires: autoconf >= 2.58
#dist-lzma required
BuildRequires: automake >= 1.10.1
%{?!nopam:BuildRequires: pam-devel}
BuildRequires: libcap-devel >= 2.0.6
@ -107,17 +98,10 @@ the old GNU fileutils, sh-utils, and textutils packages.
%setup -q
# From upstream
%patch1 -p1 -b .lsexit
%patch2 -p1 -b .dftotal
%patch3 -p1 -b .bignum
%patch4 -p1 -b .cpmvn
%patch5 -p1 -b .xattr
# Our patches
%patch100 -p1 -b .configure
%patch101 -p1 -b .manpages
#%patch102 -p1 -b .longopt
%patch103 -p1 -b .sparc
# sh-utils
%patch703 -p1 -b .dateman
@ -134,19 +118,16 @@ the old GNU fileutils, sh-utils, and textutils packages.
%patch908 -p1 -b .getgrouplist
%patch912 -p1 -b .overflow
%patch915 -p1 -b .splitl
#%patch916 -p1 -b .getfacl-exit-code
%patch916 -p1 -b .getfacl-exit-code
#SELinux
%patch950 -p1 -b .selinux
%patch951 -p1 -b .selinuxman
%patch952 -p1 -b .changeonly
chmod a+x tests/misc/sort-mb-tests
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/dist-xz/dist-lzma/' configure.ac
#fix typos/mistakes in localized documentation(#439410, #440056)
find ./po/ -name "*.p*" | xargs \
@ -328,6 +309,11 @@ fi
/sbin/runuser
%changelog
* Tue Feb 24 2009 Ondrej Vasik <ovasik@redhat.com> - 7.1-1
- New upstream release 7.1 (temporarily using tar.gz tarball
as there are no xz utils in Fedora), removed applied
patches, amended patches and LS_COLORS files
* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 7.0-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

View File

@ -1 +1 @@
81c7aecc0daa6cada78005108edb6502 coreutils-7.0.tar.lzma
cbb2b3d1718ee1237b808e00b5c11b1e coreutils-7.1.tar.gz