Compare commits

...

17 Commits
rawhide ... f9

Author SHA1 Message Date
Fedora Release Engineering 7c8fc4c65e dist-git conversion 2010-07-28 12:11:53 +00:00
Bill Nottingham 8206d60aa2 Fix typo that causes a failure to update the common directory. (releng
#2781)
2009-11-26 01:33:10 +00:00
Ondrej Vasik f9a77f70a6 fix sort bugs (including #485715) for multibyte locales 2009-03-02 14:08:57 +00:00
Ondrej Vasik 381bfcf98f fix showing ACL's for ls -Z (#487374), fix automated column width
computation for it as well, fix couple of bugs (including #485715) in
    sort with determining end of fields (upstream), do not mistakenly
    display -g and -G runuser option in su --help output, some sed cleanup
    in spec
2009-02-27 10:49:41 +00:00
Ondrej Vasik e98233a980 fix several date issues, clarify ls exit statuses documentation (#446294) 2008-10-13 08:44:52 +00:00
Ondrej Vasik 11095edced fix cp -Z issues(#466653, #466646), do not require preservation of SELinux
CTX for preserve=all cp mode
2008-10-12 16:20:10 +00:00
Ondrej Vasik 36f6a89e36 cumulative update for F-9, fixes for bugzillas #463883, #465569, 463556,
#450505 and others
2008-10-10 07:33:23 +00:00
Kamil Dudka 54e1a9db71 removed CAPABILITY color from DIR_COLORS 2008-08-01 07:59:47 +00:00
Kamil Dudka 98c2921bdb disabled last patch ls-libcap which broke tcsh (#457342) 2008-08-01 07:21:59 +00:00
Kamil Dudka 10de1c1c30 dd: iflag=fullblock now read full blocks if possible (#431997, #449263) ls:
--color now highlights files with capabilities (#449985) suppressed
    failing test in tests/touch/no-create-missing
2008-07-28 07:44:16 +00:00
Ondrej Vasik 362aa29aae who -r should not show last runlevel for nonprintable chars like \0
(#453249), add few missing who options to texinfo manual and add
    missing authors for basename and echo
2008-07-04 16:29:00 +00:00
Ondrej Vasik 92bb0f3d59 print verbose output of chcon with newline after each message (#451478) 2008-06-16 15:31:50 +00:00
Ondrej Vasik 772f397cbe no longer double runuser binary + fixed segfault in ls -lZ(#449866) 2008-06-09 14:34:33 +00:00
Tom Callaway 44821918ee fix for sparc 2008-05-30 00:26:23 +00:00
Ondrej Vasik cb15c07553 temporarily fixed a HUGE memory leak in install binary, maybe improvement
will be needed(#447410)
2008-05-20 15:43:29 +00:00
Ondrej Vasik c7e2bdf709 improved fix of checksum line handling #439531 (upstream) 2008-05-13 13:25:40 +00:00
Jesse Keating fbf660f004 Initialize branch F-9 for coreutils 2008-04-20 15:10:02 +00:00
20 changed files with 1732 additions and 104 deletions

View File

View File

@ -1,21 +0,0 @@
# Makefile for source rpm: coreutils
# $Id$
NAME := coreutils
SPECFILE = $(firstword $(wildcard *.spec))
define find-makefile-common
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
endef
MAKEFILE_COMMON := $(shell $(find-makefile-common))
ifeq ($(MAKEFILE_COMMON),)
# attempt a checkout
define checkout-makefile-common
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
endef
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
endif
include $(MAKEFILE_COMMON)

View File

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

@ -0,0 +1,59 @@
diff -urNp coreutils-6.12-orig/man/chcon.1 coreutils-6.12/man/chcon.1
--- coreutils-6.12-orig/man/chcon.1 2008-10-08 14:45:59.000000000 +0200
+++ coreutils-6.12/man/chcon.1 2008-10-08 16:35:55.000000000 +0200
@@ -17,9 +17,6 @@ chcon \- change file SELinux security co
Change the SELinux security context of each FILE to CONTEXT.
With \fB\-\-reference\fR, change the security context of each FILE to that of RFILE.
.TP
-\fB\-c\fR, \fB\-\-changes\fR
-like verbose but report only when a change is made
-.TP
\fB\-h\fR, \fB\-\-no\-dereference\fR
affect symbolic links instead of any referenced file
.TP
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
-};
/* The name the program was run with. */
char *program_name;
@@ -374,7 +355,6 @@ Usage: %s [OPTION]... CONTEXT FILE...\n\
Change the 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

@ -158,7 +158,43 @@
pam_end(pamh, 0);
if (!same_session)
setsid ();
@@ -657,6 +702,12 @@
@@ -628,6 +673,27 @@ usage (int status)
else
{
printf (_("Usage: %s [OPTION]... [-] [USER [ARG]...]\n"), program_name);
+ printf (_("Usage: %s [OPTION]... [-] [USER [ARG]...]\n"), program_name);
+#ifdef RUNUSER
+ fputs (_("\
+Change the effective user id and group id to that of USER. No PAM hooks\n\
+are run, and there will be no password prompt. This command is useful\n\
+when run as the root user. If run as a non-root user without privilege\n\
+to set user ID, the command will fail.\n\
+\n\
+ -, -l, --login make the shell a login shell, uses runuser-l\n\
+ PAM file instead of default one\n\
+ -g --group=group specify the primary group\n\
+ -G --supp-group=group specify a supplemental group\n\
+ -c, --command=COMMAND pass a single COMMAND to the shell with -c\n\
+ --session-command=COMMAND pass a single COMMAND to the shell with -c\n\
+ and do not create a new session\n\
+ -f, --fast pass -f to the shell (for csh or tcsh)\n\
+ -m, --preserve-environment do not reset environment variables\n\
+ -p same as -m\n\
+ -s, --shell=SHELL run SHELL if /etc/shells allows it\n\
+"), stdout);
+#else
fputs (_("\
Change the effective user id and group id to that of USER.\n\
\n\
@@ -640,6 +706,7 @@ Change the effective user id and group i
-p same as -m\n\
-s, --shell=SHELL run SHELL if /etc/shells allows it\n\
"), stdout);
+#endif
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
fputs (_("\
@@ -657,6 +724,12 @@
char *shell = NULL;
struct passwd *pw;
struct passwd pw_copy;
@ -171,7 +207,7 @@
initialize_main (&argc, &argv);
program_name = argv[0];
@@ -671,7 +722,11 @@
@@ -671,7 +744,11 @@
simulate_login = false;
change_environment = true;
@ -184,7 +220,7 @@
{
switch (optc)
{
@@ -701,6 +756,28 @@
@@ -701,6 +778,28 @@
shell = optarg;
break;
@ -213,7 +249,7 @@
case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
@@ -739,7 +816,20 @@
@@ -739,7 +838,20 @@
: DEFAULT_SHELL);
endpwent ();
@ -235,7 +271,7 @@
{
#ifdef SYSLOG_FAILURE
log_su (pw, false);
@@ -771,8 +861,16 @@
@@ -771,8 +883,16 @@
modify_environment (pw, shell);
#ifndef USE_PAM

View File

@ -1,3 +1,15 @@
diff -urNp coreutils-6.11-orig/tests/touch/no-create-missing coreutils-6.11/tests/touch/no-create-missing
--- coreutils-6.11-orig/tests/touch/no-create-missing 2008-04-19 23:34:23.000000000 +0200
+++ coreutils-6.11/tests/touch/no-create-missing 2008-04-24 12:34:52.000000000 +0200
@@ -36,7 +36,7 @@ test="$abs_top_builddir/src/test"
# This test is ineffective unless /dev/stdout also works.
if "$test" -w /dev/stdout >/dev/null &&
"$test" ! -w /dev/stdout >&-; then
- touch -c - >&- 2> /dev/null || fail=1
+ #touch -c - >&- || fail=1
touch -cm - >&- 2> /dev/null || fail=1
touch -ca - >&- 2> /dev/null || fail=1
fi
diff -urp coreutils-6.10-orig/src/Makefile.am coreutils-6.10/src/Makefile.am
--- coreutils-6.10-orig/src/Makefile.am 2008-01-11 11:34:22.000000000 +0100
+++ coreutils-6.10/src/Makefile.am 2008-01-23 14:52:26.000000000 +0100

View File

@ -12,17 +12,30 @@ diff -urNp coreutils-6.10-orig/src/md5sum.c coreutils-6.10/src/md5sum.c
/* Find end of filename. The BSD 'md5' and 'sha1' commands do not escape
diff -urNp coreutils-6.10-orig/src/md5sum.c coreutils-6.10/src/md5sum.c
--- coreutils-6.10-orig/src/md5sum.c 2008-04-18 17:40:03.000000000 +0200
+++ coreutils-6.10/src/md5sum.c 2008-04-18 17:48:05.000000000 +0200
@@ -346,6 +346,8 @@ split_3 (char *s, size_t s_len,
--- coreutils-6.10-orig/src/md5sum.c 2008-05-13 15:09:09.000000000 +0200
+++ coreutils-6.10/src/md5sum.c 2008-05-13 15:10:59.000000000 +0200
@@ -343,16 +343,19 @@ split_3 (char *s, size_t s_len,
return true;
}
+/* Return true if S is a NUL-terminated string of DIGEST_HEX_BYTES hex digits.
+ Otherwise, return false. */
static bool
hex_digits (unsigned char const *s)
{
+ if (!*s)
+ return false;
while (*s)
- while (*s)
+ unsigned int i;
+ for (i = 0; i < digest_hex_bytes; i++)
{
if (!isxdigit (*s))
return false;
++s;
}
- return true;
+ return *s == '\0';
}
/* An interface to the function, DIGEST_STREAM.
diff -urNp coreutils-6.10-orig/tests/misc/sha1sum coreutils-6.10/tests/misc/sha1sum
--- coreutils-6.10-orig/tests/misc/sha1sum 2007-12-13 00:14:28.000000000 +0100
+++ coreutils-6.10/tests/misc/sha1sum 2008-04-15 21:05:43.000000000 +0200
@ -53,3 +66,22 @@ diff -urNp coreutils-6.10-orig/tests/misc/sha1sum coreutils-6.10/tests/misc/sha1
+my $fail = run_tests ($prog, $prog, \@Tests, $save_temps, $verbose);
exit $fail;
EOF
diff -urNp coreutils-6.10-orig/tests/misc/md5sum coreutils-6.10/tests/misc/md5sum
--- coreutils-6.10-orig/tests/misc/md5sum 2007-12-13 00:14:28.000000000 +0100
+++ coreutils-6.10/tests/misc/md5sum 2008-05-13 15:15:48.000000000 +0200
@@ -70,6 +70,15 @@ my @Tests =
['check-bsd3', '--check', '--status',
{IN=> {'f.md5' => "MD5 (f) = $degenerate\n"}},
{AUX=> {f=> 'bar'}}, {EXIT=> 1}],
+ ['bsd-segv', '--check', {IN=> {'z' => "MD5 ("}}, {EXIT=> 1},
+ {ERR=> "md5sum: z: no properly formatted MD5 checksum lines found\n"}],
+ # Ensure that when there's a NUL byte among the checksum hex digits
+ # we detect the invalid formatting and don't even open the file.
+ # Up to coreutils-6.10, this would report:
+ # h: FAILED
+ # md5sum: WARNING: 1 of 1 computed checksum did NOT match
+ ['nul-in-cksum', '--check', {IN=> {'h'=>("\0"x32)." h\n"}}, {EXIT=> 1},
+ {ERR=> "md5sum: h: no properly formatted MD5 checksum lines found\n"}],
);
# Insert the `--text' argument for each test.

View File

@ -0,0 +1,155 @@
diff -urNp coreutils-6.10-orig/src/sort.c coreutils-6.10/src/sort.c
--- coreutils-6.10-orig/src/sort.c 2008-01-22 00:33:25.000000000 +0100
+++ coreutils-6.10/src/sort.c 2009-02-27 11:19:35.000000000 +0100
@@ -1390,7 +1390,6 @@ begfield_uni (const struct line *line, c
char *ptr = line->text, *lim = ptr + line->length - 1;
size_t sword = key->sword;
size_t schar = key->schar;
- size_t remaining_bytes;
/* The leading field separator itself is included in a field when -t
is absent. */
@@ -1416,12 +1415,7 @@ begfield_uni (const struct line *line, c
while (ptr < lim && blanks[to_uchar (*ptr)])
++ptr;
- /* Advance PTR by SCHAR (if possible), but no further than LIM. */
- remaining_bytes = lim - ptr;
- if (schar < remaining_bytes)
- ptr += schar;
- else
- ptr = lim;
+ ptr = MIN (lim, ptr + schar);
return ptr;
}
@@ -1493,7 +1487,9 @@ limfield_uni (const struct line *line, c
{
char *ptr = line->text, *lim = ptr + line->length - 1;
size_t eword = key->eword, echar = key->echar;
- size_t remaining_bytes;
+
+ if (echar == 0)
+ eword++; /* Skip all of end field. */
/* Move PTR past EWORD fields or to one past the last byte on LINE,
whichever comes first. If there are more than EWORD fields, leave
@@ -1566,19 +1566,13 @@ limfield_uni (const struct line *line, c
}
#endif
- /* If we're ignoring leading blanks when computing the End
- of the field, don't start counting bytes until after skipping
- past any leading blanks. */
- if (key->skipeblanks)
- while (ptr < lim && blanks[to_uchar (*ptr)])
- ++ptr;
-
- /* Advance PTR by ECHAR (if possible), but no further than LIM. */
- remaining_bytes = lim - ptr;
- if (echar < remaining_bytes)
- ptr += echar;
- else
- ptr = lim;
+ if (echar != 0) /* We need to skip over a portion of the end field. */
+ {
+ if (key->skipeblanks) /* blanks not counted in echar. */
+ while (ptr < lim && blanks[to_uchar (*ptr)])
+ ++ptr;
+ ptr = MIN (lim, ptr + echar);
+ }
return ptr;
}
@@ -3582,12 +3579,9 @@ main (int argc, char **argv)
badfieldspec (optarg, N_("field number is zero"));
}
if (*s == '.')
- s = parse_field_count (s + 1, &key->echar,
- N_("invalid number after `.'"));
- else
{
- /* `-k 2,3' is equivalent to `+1 -3'. */
- key->eword++;
+ s = parse_field_count (s + 1, &key->echar,
+ N_("invalid number after `.'"));
}
s = set_ordering (s, key, bl_end);
}
diff -urNp coreutils-6.10-orig/tests/sort/sort-tests coreutils-6.10/tests/sort/sort-tests
--- coreutils-6.10-orig/tests/sort/sort-tests 2008-01-22 00:33:25.000000000 +0100
+++ coreutils-6.10/tests/sort/sort-tests 2009-02-27 11:19:35.000000000 +0100
@@ -1008,6 +1008,24 @@ else
esac
fi
test -s 07d.E || rm -f 07d.E
+_POSIX2_VERSION=199209 $xx -k 2,3.0 $srcdir/07e.I > 07e.O 2> 07e.E
+code=$?
+if test $code != 0; then
+ $echo "Test 07e(_POSIX2_VERSION=199209) failed: $xx return code $code differs from expected value 0" 1>&2
+ errors=`expr $errors + 1`
+else
+ cmp 07e.O $srcdir/07e.X > /dev/null 2>&1
+ case $? in
+ 0) if test "$VERBOSE"; then $echo "passed 07d(_POSIX2_VERSION=199209)"; fi;;
+ 1) $echo "Test 07e(_POSIX2_VERSION=199209) failed: files 07e.O and $srcdir/07e.X differ" 1>&2
+ (diff -c 07e.O $srcdir/07e.X) 2> /dev/null
+ errors=`expr $errors + 1`;;
+ 2) $echo "Test 07e(_POSIX2_VERSION=199209) may have failed." 1>&2
+ $echo The command "cmp 07e.O $srcdir/07e.X" failed. 1>&2
+ errors=`expr $errors + 1`;;
+ esac
+fi
+test -s 07e.E || rm -f 07e.E
_POSIX2_VERSION=199209 $xx -k 2.,3 $srcdir/08a.I > 08a.O 2> 08a.E
code=$?
if test $code != 2; then
@@ -1728,6 +1746,24 @@ else
esac
fi
test -s 18e.E || rm -f 18e.E
+_POSIX2_VERSION=199209 $xx -k1,1b $srcdir/18f.I > 18f.O 2> 18f.E
+code=$?
+if test $code != 0; then
+ $echo "Test 18f(_POSIX2_VERSION=199209) failed: $xx return code $code differs from expected value 0" 1>&2
+ errors=`expr $errors + 1`
+else
+ cmp 18f.O $srcdir/18f.X > /dev/null 2>&1
+ case $? in
+ 0) if test "$VERBOSE"; then $echo "passed 18f(_POSIX2_VERSION=199209)"; fi;;
+ 1) $echo "Test 18f(_POSIX2_VERSION=199209) failed: files 18f.O and $srcdir/18f.X differ" 1>&2
+ (diff -c 18f.O $srcdir/18f.X) 2> /dev/null
+ errors=`expr $errors + 1`;;
+ 2) $echo "Test 18f(_POSIX2_VERSION=199209) may have failed." 1>&2
+ $echo The command "cmp 18f.O $srcdir/18f.X" failed. 1>&2
+ errors=`expr $errors + 1`;;
+ esac
+fi
+test -s 18f.E || rm -f 18f.E
_POSIX2_VERSION=199209 $xx +0 +1nr $srcdir/19a.I > 19a.O 2> 19a.E
code=$?
if test $code != 0; then
diff -urNp coreutils-6.10-orig/tests/sort/07e.I coreutils-6.10/tests/sort/07e.I
--- coreutils-6.10-orig/tests/sort/07e.I 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-6.10/tests/sort/07e.I 2009-02-27 11:21:24.000000000 +0100
@@ -0,0 +1,2 @@
+a a b
+z a a
diff -urNp coreutils-6.10-orig/tests/sort/07e.X coreutils-6.10/tests/sort/07e.X
--- coreutils-6.10-orig/tests/sort/07e.X 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-6.10/tests/sort/07e.X 2009-02-27 11:21:10.000000000 +0100
@@ -0,0 +1,2 @@
+z a a
+a a b
diff -urNp coreutils-6.10-orig/tests/sort/18f.I coreutils-6.10/tests/sort/18f.I
--- coreutils-6.10-orig/tests/sort/18f.I 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-6.10/tests/sort/18f.I 2009-02-27 11:14:41.000000000 +0100
@@ -0,0 +1,2 @@
+a y
+a z
diff -urNp coreutils-6.10-orig/tests/sort/18f.X coreutils-6.10/tests/sort/18f.X
--- coreutils-6.10-orig/tests/sort/18f.X 1970-01-01 01:00:00.000000000 +0100
+++ coreutils-6.10/tests/sort/18f.X 2009-02-27 11:15:07.000000000 +0100
@@ -0,0 +1,2 @@
+a y
+a z

View File

@ -0,0 +1,96 @@
diff -up coreutils-6.10/lib/sha256.c.sparc coreutils-6.10/lib/sha256.c
--- coreutils-6.10/lib/sha256.c.sparc 2007-11-25 08:23:31.000000000 -0500
+++ coreutils-6.10/lib/sha256.c 2008-05-29 15:57:56.000000000 -0400
@@ -85,6 +85,15 @@ sha224_init_ctx (struct sha256_ctx *ctx)
ctx->buflen = 0;
}
+/* Copy the value from v into the memory location pointed to by *cp,
+ If your architecture allows unaligned access this is equivalent to
+ * (uint32_t *) cp = v */
+static inline void
+set_uint32 (char *cp, uint32_t v)
+{
+ memcpy (cp, &v, sizeof v);
+}
+
/* Put result from CTX in first 32 bytes following RESBUF. The result
must be in little endian byte order.
@@ -129,9 +138,13 @@ sha256_conclude_ctx (struct sha256_ctx *
if (ctx->total[0] < bytes)
++ctx->total[1];
- /* Put the 64-bit file length in *bits* at the end of the buffer. */
- ctx->buffer[size - 2] = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29));
- ctx->buffer[size - 1] = SWAP (ctx->total[0] << 3);
+ /* Put the 64-bit file length in *bits* at the end of the buffer.
+ Use set_uint32 rather than a simple assignment, to avoid risk of
+ unaligned access. */
+ set_uint32 ((char *) &ctx->buffer[size - 2],
+ SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29)));
+ set_uint32 ((char *) &ctx->buffer[size - 1],
+ SWAP (ctx->total[0] << 3));
memcpy (&((char *) ctx->buffer)[bytes], fillbuf, (size - 2) * 4 - bytes);
diff -up coreutils-6.10/lib/sha512.c.sparc coreutils-6.10/lib/sha512.c
--- coreutils-6.10/lib/sha512.c.sparc 2007-11-25 08:23:31.000000000 -0500
+++ coreutils-6.10/lib/sha512.c 2008-05-29 15:58:49.000000000 -0400
@@ -92,6 +92,15 @@ sha384_init_ctx (struct sha512_ctx *ctx)
ctx->buflen = 0;
}
+/* Copy the value from V into the memory location pointed to by *CP,
+ If your architecture allows unaligned access, this is equivalent to
+ * (__typeof__ (v) *) cp = v */
+static inline void
+set_uint64 (char *cp, u64 v)
+{
+ memcpy (cp, &v, sizeof v);
+}
+
/* Put result from CTX in first 64 bytes following RESBUF. The result
must be in little endian byte order.
@@ -136,10 +145,14 @@ sha512_conclude_ctx (struct sha512_ctx *
if (u64lt (ctx->total[0], u64lo (bytes)))
ctx->total[1] = u64plus (ctx->total[1], u64lo (1));
- /* Put the 64-bit file length in *bits* at the end of the buffer. */
- ctx->buffer[size - 2] = SWAP (u64or (u64shl (ctx->total[1], 3),
- u64shr (ctx->total[0], 61)));
- ctx->buffer[size - 1] = SWAP (u64shl (ctx->total[0], 3));
+ /* Put the 128-bit file length in *bits* at the end of the buffer.
+ Use set_uint64 rather than a simple assignment, to avoid risk of
+ unaligned access. */
+ set_uint64 ((char *) &ctx->buffer[size - 2],
+ SWAP (u64or (u64shl (ctx->total[1], 3),
+ u64shr (ctx->total[0], 61))));
+ set_uint64 ((char *) &ctx->buffer[size - 1],
+ SWAP (u64shl (ctx->total[0], 3)));
memcpy (&((char *) ctx->buffer)[bytes], fillbuf, (size - 2) * 8 - bytes);
diff -up coreutils-6.10/src/Makefile.am.BAD coreutils-6.10/src/Makefile.am
--- coreutils-6.10/src/Makefile.am.BAD 2008-05-29 16:42:30.000000000 -0400
+++ coreutils-6.10/src/Makefile.am 2008-05-29 16:43:00.000000000 -0400
@@ -99,6 +99,7 @@ shred_LDADD = $(LDADD) $(LIB_GETHRXTIME)
shuf_LDADD = $(LDADD) $(LIB_GETHRXTIME)
mktemp_LDADD = $(LDADD) $(LIB_GETHRXTIME)
vdir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_SELINUX)
+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.10/src/Makefile.in.BAD coreutils-6.10/src/Makefile.in
--- coreutils-6.10/src/Makefile.in.BAD 2008-05-29 16:43:31.000000000 -0400
+++ coreutils-6.10/src/Makefile.in 2008-05-29 16:44:03.000000000 -0400
@@ -1242,6 +1242,7 @@ shuf_LDADD = $(LDADD) $(LIB_GETHRXTIME)
mktemp_LDADD = $(LDADD) $(LIB_GETHRXTIME)
vdir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_SELINUX) $(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

@ -0,0 +1,78 @@
From 63467fa18794f02497c7a46e3b7783ba1180f8fc Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Fri, 4 Jul 2008 16:34:39 +0200
Subject: [PATCH] who -r: don't print "last=" when the corresponding byte is unprintable
* src/who.c (print_runlevel): Print last=%c only when the "preceding
run-level" byte is printable. Reported by Gian Piero De Lolliis in
<http://bugzilla.redhat.com/453249>.
---
src/who.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/who.c b/src/who.c
index 5529618..0bba912 100644
--- a/src/who.c
+++ b/src/who.c
@@ -30,6 +30,7 @@
#include <sys/types.h>
#include "system.h"
+#include "c-ctype.h"
#include "canon-host.h"
#include "readutmp.h"
#include "error.h"
@@ -511,7 +512,7 @@ print_runlevel (const STRUCT_UTMP *utmp_ent)
sprintf (comment, "%s%c", _("last="), (last == 'N') ? 'S' : last);
print_line (-1, "", ' ', -1, runlevline, time_string (utmp_ent),
- "", "", comment, "");
+ "", "", c_isprint (last) ? comment : "", "");
return;
}
--
1.5.6.1.206.g8dcaf96
From 10db2e5e05c67eea205b3ec76a2408f46356a7fd Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= <ovasik@redhat.com>
Date: Wed, 2 Jul 2008 14:11:05 +0200
Subject: [PATCH] doci: describe who's -p -r and -t options
* doc/coreutils.texi (who invocation):
---
doc/coreutils.texi | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 155ba8d..c0ea237 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -12710,6 +12710,24 @@ automatic dial-up internet access.
@opindex --heading
Print a line of column headings.
+@item -p
+@itemx --process
+@opindex -p
+@opindex --process
+List active processes spawned by init.
+
+@item -r
+@itemx --runlevel
+@opindex -r
+@opindex --runlevel
+Print the current (and maybe previous) run-level of the init process.
+
+@item -t
+@itemx --time
+@opindex -t
+@opindex --time
+Print last system clock change.
+
@item -w
@itemx -T
@itemx --mesg
--
1.5.2.2

View File

@ -0,0 +1,46 @@
From a089634c855312a28f2ff3c2e7c08df5d030e2f5 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering <at> redhat.com>
Date: Tue, 20 May 2008 17:58:42 +0200
Subject: [PATCH] install: avoid a leak in currently-ifdef'd-out code
* src/install.c (setdefaultfilecon)
[ENABLE_WHEN_MATCHPATHCON_IS_MORE_EFFICIENT]:
Call matchpathcon_init_prefix only once.
Suggestion from Stephen Smalley. Reported by Ben Webb in
<http://bugzilla.redhat.com/447410>.
---
src/install.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/src/install.c b/src/install.c
index 964ab36..b531f45 100644
--- a/src/install.c
+++ b/src/install.c
@@ -208,6 +208,8 @@ setdefaultfilecon (char const *file)
{
struct stat st;
security_context_t scontext = NULL;
+ static bool first_call = true;
+
if (selinux_enabled != 1)
{
/* Indicate no context found. */
@@ -216,7 +218,7 @@ setdefaultfilecon (char const *file)
if (lstat (file, &st) != 0)
return;
- if (IS_ABSOLUTE_FILE_NAME (file))
+ if (first_call && IS_ABSOLUTE_FILE_NAME (file))
{
/* Calling matchpathcon_init_prefix (NULL, "/first_component/")
is an optimization to minimize the expense of the following
@@ -247,6 +249,7 @@ setdefaultfilecon (char const *file)
}
}
}
+ first_call = false;
/* If there's an error determining the context, or it has none,
return to allow default context */
--
1.5.5.1.249.g68ef3

View File

@ -0,0 +1,381 @@
diff -urNp coreutils-6.12-orig/lib/getdate.y coreutils-6.12/lib/getdate.y
--- coreutils-6.12-orig/lib/getdate.y 2008-01-31 19:37:19.000000000 +0100
+++ coreutils-6.12/lib/getdate.y 2008-10-08 15:49:35.000000000 +0200
@@ -1,8 +1,8 @@
%{
/* Parse a string into an internal time stamp.
- Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
- Foundation, Inc.
+ Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 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
@@ -60,7 +60,7 @@
# undef static
#endif
-#include <ctype.h>
+#include <c-ctype.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
@@ -205,7 +205,7 @@ typedef struct
union YYSTYPE;
static int yylex (union YYSTYPE *, parser_control *);
static int yyerror (parser_control const *, char const *);
-static long int time_zone_hhmm (textint, long int);
+static long int time_zone_hhmm (parser_control *, textint, long int);
/* Extract into *PC any date and time info from a string of digits
of the form e.g., YYYYMMDD, YYMMDD, HHMM, HH (and sometimes YYY,
@@ -246,6 +246,31 @@ digits_to_date_time (parser_control *pc,
}
}
+/* Increment PC->rel by FACTOR * REL (FACTOR is 1 or -1). */
+static void
+apply_relative_time (parser_control *pc, relative_time rel, int factor)
+{
+ pc->rel.ns += factor * rel.ns;
+ pc->rel.seconds += factor * rel.seconds;
+ pc->rel.minutes += factor * rel.minutes;
+ pc->rel.hour += factor * rel.hour;
+ pc->rel.day += factor * rel.day;
+ pc->rel.month += factor * rel.month;
+ pc->rel.year += factor * rel.year;
+ pc->rels_seen = true;
+}
+
+/* Set PC-> hour, minutes, seconds and nanoseconds members from arguments. */
+static void
+set_hhmmss (parser_control *pc, long int hour, long int minutes,
+ time_t sec, long int nsec)
+{
+ pc->hour = hour;
+ pc->minutes = minutes;
+ pc->seconds.tv_sec = sec;
+ pc->seconds.tv_nsec = nsec;
+}
+
%}
/* We want a reentrant parser, even if the TZ manipulation and the calls to
@@ -268,7 +293,7 @@ digits_to_date_time (parser_control *pc,
%token tAGO tDST
%token tYEAR_UNIT tMONTH_UNIT tHOUR_UNIT tMINUTE_UNIT tSEC_UNIT
-%token <intval> tDAY_UNIT
+%token <intval> tDAY_UNIT tDAY_SHIFT
%token <intval> tDAY tDAYZONE tLOCAL_ZONE tMERIDIAN
%token <intval> tMONTH tORDINAL tZONE
@@ -279,7 +304,7 @@ digits_to_date_time (parser_control *pc,
%type <intval> o_colon_minutes o_merid
%type <timespec> seconds signed_seconds unsigned_seconds
-%type <rel> relunit relunit_snumber
+%type <rel> relunit relunit_snumber dayshift
%%
@@ -313,7 +338,6 @@ item:
| day
{ pc->days_seen++; }
| rel
- { pc->rels_seen = true; }
| number
| hybrid
;
@@ -321,45 +345,32 @@ item:
time:
tUNUMBER tMERIDIAN
{
- pc->hour = $1.value;
- pc->minutes = 0;
- pc->seconds.tv_sec = 0;
- pc->seconds.tv_nsec = 0;
+ set_hhmmss (pc, $1.value, 0, 0, 0);
pc->meridian = $2;
}
| tUNUMBER ':' tUNUMBER o_merid
{
- pc->hour = $1.value;
- pc->minutes = $3.value;
- pc->seconds.tv_sec = 0;
- pc->seconds.tv_nsec = 0;
+ set_hhmmss (pc, $1.value, $3.value, 0, 0);
pc->meridian = $4;
}
| tUNUMBER ':' tUNUMBER tSNUMBER o_colon_minutes
{
- pc->hour = $1.value;
- pc->minutes = $3.value;
- pc->seconds.tv_sec = 0;
- pc->seconds.tv_nsec = 0;
+ set_hhmmss (pc, $1.value, $3.value, 0, 0);
pc->meridian = MER24;
pc->zones_seen++;
- pc->time_zone = time_zone_hhmm ($4, $5);
+ pc->time_zone = time_zone_hhmm (pc, $4, $5);
}
| tUNUMBER ':' tUNUMBER ':' unsigned_seconds o_merid
{
- pc->hour = $1.value;
- pc->minutes = $3.value;
- pc->seconds = $5;
+ set_hhmmss (pc, $1.value, $3.value, $5.tv_sec, $5.tv_nsec);
pc->meridian = $6;
}
| tUNUMBER ':' tUNUMBER ':' unsigned_seconds tSNUMBER o_colon_minutes
{
- pc->hour = $1.value;
- pc->minutes = $3.value;
- pc->seconds = $5;
+ set_hhmmss (pc, $1.value, $3.value, $5.tv_sec, $5.tv_nsec);
pc->meridian = MER24;
pc->zones_seen++;
- pc->time_zone = time_zone_hhmm ($6, $7);
+ pc->time_zone = time_zone_hhmm (pc, $6, $7);
}
;
@@ -381,16 +392,9 @@ zone:
{ pc->time_zone = $1; }
| tZONE relunit_snumber
{ pc->time_zone = $1;
- pc->rel.ns += $2.ns;
- pc->rel.seconds += $2.seconds;
- pc->rel.minutes += $2.minutes;
- pc->rel.hour += $2.hour;
- pc->rel.day += $2.day;
- pc->rel.month += $2.month;
- pc->rel.year += $2.year;
- pc->rels_seen = true; }
+ apply_relative_time (pc, $2, 1); }
| tZONE tSNUMBER o_colon_minutes
- { pc->time_zone = $1 + time_zone_hhmm ($2, $3); }
+ { pc->time_zone = $1 + time_zone_hhmm (pc, $2, $3); }
| tDAYZONE
{ pc->time_zone = $1 + 60; }
| tZONE tDST
@@ -495,25 +499,11 @@ date:
rel:
relunit tAGO
- {
- pc->rel.ns -= $1.ns;
- pc->rel.seconds -= $1.seconds;
- pc->rel.minutes -= $1.minutes;
- pc->rel.hour -= $1.hour;
- pc->rel.day -= $1.day;
- pc->rel.month -= $1.month;
- pc->rel.year -= $1.year;
- }
+ { apply_relative_time (pc, $1, -1); }
| relunit
- {
- pc->rel.ns += $1.ns;
- pc->rel.seconds += $1.seconds;
- pc->rel.minutes += $1.minutes;
- pc->rel.hour += $1.hour;
- pc->rel.day += $1.day;
- pc->rel.month += $1.month;
- pc->rel.year += $1.year;
- }
+ { apply_relative_time (pc, $1, 1); }
+ | dayshift
+ { apply_relative_time (pc, $1, 1); }
;
relunit:
@@ -575,6 +565,11 @@ relunit_snumber:
{ $$ = RELATIVE_TIME_0; $$.seconds = $1.value; }
;
+dayshift:
+ tDAY_SHIFT
+ { $$ = RELATIVE_TIME_0; $$.day = $1; }
+ ;
+
seconds: signed_seconds | unsigned_seconds;
signed_seconds:
@@ -600,14 +595,7 @@ hybrid:
/* Hybrid all-digit and relative offset, so that we accept e.g.,
"YYYYMMDD +N days" as well as "YYYYMMDD N days". */
digits_to_date_time (pc, $1);
- pc->rel.ns += $2.ns;
- pc->rel.seconds += $2.seconds;
- pc->rel.minutes += $2.minutes;
- pc->rel.hour += $2.hour;
- pc->rel.day += $2.day;
- pc->rel.month += $2.month;
- pc->rel.year += $2.year;
- pc->rels_seen = true;
+ apply_relative_time (pc, $2, 1);
}
;
@@ -688,10 +676,10 @@ static table const time_units_table[] =
/* Assorted relative-time words. */
static table const relative_time_table[] =
{
- { "TOMORROW", tDAY_UNIT, 1 },
- { "YESTERDAY",tDAY_UNIT, -1 },
- { "TODAY", tDAY_UNIT, 0 },
- { "NOW", tDAY_UNIT, 0 },
+ { "TOMORROW", tDAY_SHIFT, 1 },
+ { "YESTERDAY",tDAY_SHIFT, -1 },
+ { "TODAY", tDAY_SHIFT, 0 },
+ { "NOW", tDAY_SHIFT, 0 },
{ "LAST", tORDINAL, -1 },
{ "THIS", tORDINAL, 0 },
{ "NEXT", tORDINAL, 1 },
@@ -814,15 +802,33 @@ static table const military_table[] =
/* Convert a time zone expressed as HH:MM into an integer count of
minutes. If MM is negative, then S is of the form HHMM and needs
- to be picked apart; otherwise, S is of the form HH. */
+ to be picked apart; otherwise, S is of the form HH. As specified in
+ http://www.opengroup.org/susv3xbd/xbd_chap08.html#tag_08_03, allow
+ only valid TZ range, and consider first two digits as hours, if no
+ minutes specified. */
static long int
-time_zone_hhmm (textint s, long int mm)
+time_zone_hhmm (parser_control *pc, textint s, long int mm)
{
+ long int n_minutes;
+
+ /* If the length of S is 1 or 2 and no minutes are specified,
+ interpret it as a number of hours. */
+ if (s.digits <= 2 && mm < 0)
+ s.value *= 100;
+
if (mm < 0)
- return (s.value / 100) * 60 + s.value % 100;
+ n_minutes = (s.value / 100) * 60 + s.value % 100;
else
- return s.value * 60 + (s.negative ? -mm : mm);
+ n_minutes = s.value * 60 + (s.negative ? -mm : mm);
+
+ /* If the absolute number of minutes is larger than 24 hours,
+ arrange to reject it by incrementing pc->zones_seen. Thus,
+ we allow only values in the range UTC-24:00 to UTC+24:00. */
+ if (24 * 60 < abs (n_minutes))
+ pc->zones_seen++;
+
+ return n_minutes;
}
static int
@@ -919,7 +925,7 @@ lookup_word (parser_control const *pc, c
for (p = word; *p; p++)
{
unsigned char ch = *p;
- *p = toupper (ch);
+ *p = c_toupper (ch);
}
for (tp = meridian_table; tp->name; tp++)
@@ -984,7 +990,7 @@ yylex (YYSTYPE *lvalp, parser_control *p
for (;;)
{
- while (c = *pc->input, isspace (c))
+ while (c = *pc->input, c_isspace (c))
pc->input++;
if (ISDIGIT (c) || c == '-' || c == '+')
@@ -995,7 +1001,7 @@ yylex (YYSTYPE *lvalp, parser_control *p
if (c == '-' || c == '+')
{
sign = c == '-' ? -1 : 1;
- while (c = *++pc->input, isspace (c))
+ while (c = *++pc->input, c_isspace (c))
continue;
if (! ISDIGIT (c))
/* skip the '-' sign */
@@ -1099,7 +1105,7 @@ yylex (YYSTYPE *lvalp, parser_control *p
}
}
- if (isalpha (c))
+ if (c_isalpha (c))
{
char buff[20];
char *p = buff;
@@ -1111,7 +1117,7 @@ yylex (YYSTYPE *lvalp, parser_control *p
*p++ = c;
c = *++pc->input;
}
- while (isalpha (c) || c == '.');
+ while (c_isalpha (c) || c == '.');
*p = '\0';
tp = lookup_word (pc, buff);
@@ -1224,7 +1230,7 @@ get_date (struct timespec *result, char
if (! tmp)
return false;
- while (c = *p, isspace (c))
+ while (c = *p, c_isspace (c))
p++;
if (strncmp (p, "TZ=\"", 4) == 0)
@@ -1436,25 +1442,6 @@ get_date (struct timespec *result, char
goto fail;
}
- if (pc.zones_seen)
- {
- long int delta = pc.time_zone * 60;
- time_t t1;
-#ifdef HAVE_TM_GMTOFF
- delta -= tm.tm_gmtoff;
-#else
- time_t t = Start;
- struct tm const *gmt = gmtime (&t);
- if (! gmt)
- goto fail;
- delta -= tm_diff (&tm, gmt);
-#endif
- t1 = Start - delta;
- if ((Start < t1) != (delta < 0))
- goto fail; /* time_t overflow */
- Start = t1;
- }
-
/* Add relative date. */
if (pc.rel.year | pc.rel.month | pc.rel.day)
{
@@ -1477,6 +1464,27 @@ get_date (struct timespec *result, char
goto fail;
}
+ /* The only "output" of this if-block is an updated Start value,
+ so this block must follow others that clobber Start. */
+ if (pc.zones_seen)
+ {
+ long int delta = pc.time_zone * 60;
+ time_t t1;
+#ifdef HAVE_TM_GMTOFF
+ delta -= tm.tm_gmtoff;
+#else
+ time_t t = Start;
+ struct tm const *gmt = gmtime (&t);
+ if (! gmt)
+ goto fail;
+ delta -= tm_diff (&tm, gmt);
+#endif
+ t1 = Start - delta;
+ if ((Start < t1) != (delta < 0))
+ goto fail; /* time_t overflow */
+ Start = t1;
+ }
+
/* Add relative hours, minutes, and seconds. On hosts that support
leap seconds, ignore the possibility of leap seconds; e.g.,
"+ 10 minutes" adds 600 seconds, even if one of them is a

View File

@ -0,0 +1,181 @@
From 9f8be4b0b83d1e0cbf1326f8cb7e077d026d9b0b Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Wed, 23 Jul 2008 11:29:21 +0200
Subject: [PATCH] dd: iflag=fullblock now read full blocks if possible
* src/dd.c (iread_fullblock): New function for reading full blocks.
(scanargs): Check for new parameter iflag=fullblock.
(skip): Use iread_fnc pointer instead of iread function.
(dd_copy): Use iread_fnc pointer instead of iread function.
* tests/dd/misc: Add test for dd - read full blocks.
* doc/coretuils.texi: Mention new parameter iflag=fullblock.
* NEWS: Mentioned the change.
---
NEWS | 4 ++++
doc/coreutils.texi | 6 ++++++
src/dd.c | 39 +++++++++++++++++++++++++++++++++++++--
tests/dd/misc | 9 +++++++++
4 files changed, 56 insertions(+), 2 deletions(-)
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 81e3b91..b95f8dc 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -7719,6 +7719,12 @@ platforms that distinguish binary from text I/O.
Use text I/O. Like @samp{binary}, this option has no effect on
standard platforms.
+@item fullblock
+@opindex fullblock
+Read full blocks from input if possible. read() may return early
+if a full block is not available, so retry until data is available
+or end of file is reached. This flag can be used only for the iflag option.
+
@end table
These flags are not supported on all systems, and @samp{dd} rejects
diff --git a/src/dd.c b/src/dd.c
index ead9574..1b620df 100644
--- a/src/dd.c
+++ b/src/dd.c
@@ -225,6 +225,9 @@ static sig_atomic_t volatile interrupt_signal;
/* A count of the number of pending info signals that have been received. */
static sig_atomic_t volatile info_signal_count;
+/* Function used for read (to handle iflag=fullblock parameter) */
+static ssize_t (*iread_fnc) (int fd, char *buf, size_t size);
+
/* A longest symbol in the struct symbol_values tables below. */
#define LONGEST_SYMBOL "fdatasync"
@@ -257,6 +260,7 @@ static struct symbol_value const conversions[] =
};
/* Flags, for iflag="..." and oflag="...". */
+#define O_FULLBLOCK 010000000 /* Read only full blocks from input */
static struct symbol_value const flags[] =
{
{"append", O_APPEND},
@@ -271,6 +275,7 @@ static struct symbol_value const flags[] =
{"nonblock", O_NONBLOCK},
{"sync", O_SYNC},
{"text", O_TEXT},
+ {"fullblock", O_FULLBLOCK}, /* Read only full blocks from input */
{"", 0}
};
@@ -762,6 +767,27 @@ iread (int fd, char *buf, size_t size)
}
}
+/* Wrapper around iread function which reads full blocks if possible */
+static ssize_t
+iread_fullblock (int fd, char *buf, size_t size)
+{
+ ssize_t nread = 0;
+
+ while (0 < size)
+ {
+ ssize_t ncurr = iread(fd, buf, size);
+ if (ncurr < 0)
+ return ncurr;
+ if (ncurr == 0)
+ break;
+ nread += ncurr;
+ buf += ncurr;
+ size -= ncurr;
+ }
+
+ return nread;
+}
+
/* Write to FD the buffer BUF of size SIZE, processing any signals
that arrive. Return the number of bytes written, setting errno if
this is less than SIZE. Keep trying if there are partial
@@ -1000,6 +1026,15 @@ scanargs (int argc, char *const *argv)
if (input_flags & (O_DSYNC | O_SYNC))
input_flags |= O_RSYNC;
+ if (output_flags & O_FULLBLOCK)
+ {
+ error (0, 0, "%s: %s", _("invalid output flag"), "'fullblock'");
+ usage (EXIT_FAILURE);
+ }
+ iread_fnc = (input_flags & O_FULLBLOCK)?
+ iread_fullblock:
+ iread;
+
if (multiple_bits_set (conversions_mask & (C_ASCII | C_EBCDIC | C_IBM)))
error (EXIT_FAILURE, 0, _("cannot combine any two of {ascii,ebcdic,ibm}"));
if (multiple_bits_set (conversions_mask & (C_BLOCK | C_UNBLOCK)))
@@ -1197,7 +1232,7 @@ skip (int fdesc, char const *file, uintmax_t records, size_t blocksize,
do
{
- ssize_t nread = iread (fdesc, buf, blocksize);
+ ssize_t nread = iread_fnc (fdesc, buf, blocksize);
if (nread < 0)
{
if (fdesc == STDIN_FILENO)
@@ -1508,7 +1543,7 @@ dd_copy (void)
(conversions_mask & (C_BLOCK | C_UNBLOCK)) ? ' ' : '\0',
input_blocksize);
- nread = iread (STDIN_FILENO, ibuf, input_blocksize);
+ nread = iread_fnc (STDIN_FILENO, ibuf, input_blocksize);
if (nread == 0)
break; /* EOF. */
diff --git a/tests/dd/misc b/tests/dd/misc
index d54fbfa..24e5eba 100755
--- a/tests/dd/misc
+++ b/tests/dd/misc
@@ -88,6 +88,15 @@ fi
outbytes=`echo x | dd bs=3 ibs=10 obs=10 conv=sync 2>/dev/null | wc -c`
test "$outbytes" -eq 3 || fail=1
+(echo a; sleep .1; echo b) \
+ | LC_ALL=C dd bs=4 status=noxfer iflag=fullblock >out 2>err || fail=1
+echo "a
+b" > out_ok
+echo "1+0 records in
+1+0 records out" > err_ok
+compare out out_ok || fail=1
+compare err err_ok || fail=1
+
test $fail -eq 0 && fail=$warn
(exit $fail); exit $fail
diff -ruN coreutils-6.12.old/doc/coreutils.info coreutils-6.12/doc/coreutils.info
--- coreutils-6.12.old/doc/coreutils.info 2008-07-24 12:49:57.000000000 +0200
+++ coreutils-6.12/doc/coreutils.info 2008-07-24 12:52:17.000000000 +0200
@@ -6112,6 +6112,12 @@
Use text I/O. Like `binary', this option has no effect on
standard platforms.
+ 'fullblock'
+ Read full blocks from input if possible. read() may return
+ early if a full block is not available, so retry until data
+ is available or end of file is reached. This flag can be used
+ only for the iflag option.
+
These flags are not supported on all systems, and `dd' rejects
attempts to use them when they are not supported. When reading
diff -ruN coreutils-6.12.old/man/dd.1 coreutils-6.12/man/dd.1
--- coreutils-6.12.old/man/dd.1 2008-07-24 12:51:06.000000000 +0200
+++ coreutils-6.12/man/dd.1 2008-07-24 12:59:06.000000000 +0200
@@ -111,6 +111,13 @@
.TP
direct
use direct I/O for data
+.PP
+FLAG symbols only for iflag option:
+.TP
+fullblock
+Read full blocks from input if possible. read() may return early
+if a full block is not available, so retry until data is available
+or end of file is reached.
.IP
directory fail unless a directory
dsync use synchronized I/O for data

View File

@ -0,0 +1,256 @@
From 7634188624dc7f48c047b29fab3715dc7a468059 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Wed, 23 Jul 2008 09:52:05 +0200
Subject: [PATCH] ls: --color now highlights files with capabilities, too
* configure.ac: New option: --disable-libcap. Check for libcap usability.
* src/Makefile.am (dir_LDADD, ls_LDADD, ...): Append $(LIB_CAP).
* src/ls.c: [HAVE_CAP] Include <sys/capability.h>.
(has_capability): New function for capability detection.
(print_color_indicator): Colorize file with capability.
* src/dircolors.c: Update color lists.
* src/dircolors.hin: Mention new CAPABILITY color attribute.
* tests/ls/capability: Test for ls - colorize file with capability.
* tests/Makefile.am (TESTS): Add ls/capability.
* NEWS: Mention the change.
---
NEWS | 2 ++
configure.ac | 13 +++++++++++++
src/Makefile.am | 6 +++---
src/dircolors.c | 4 ++--
src/dircolors.hin | 1 +
src/ls.c | 43 +++++++++++++++++++++++++++++++++++++++++--
tests/Makefile.am | 1 +
tests/ls/capability | 43 +++++++++++++++++++++++++++++++++++++++++++
8 files changed, 106 insertions(+), 7 deletions(-)
create mode 100755 tests/ls/capability
diff --git a/configure.ac b/configure.ac
index ac93e1c..96b2fda 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,6 +44,19 @@ gl_EARLY
gl_INIT
coreutils_MACROS
+dnl Check whether libcap is usable
+AC_ARG_ENABLE([libcap],
+ AC_HELP_STRING([--disable-libcap], [disable libcap support]),
+ AC_MSG_WARN([libcap support disabled by user]),
+ [AC_CHECK_LIB([cap], [cap_get_file],
+ [AC_CHECK_HEADER([sys/capability.h],
+ [LIB_CAP="-lcap" AC_DEFINE(HAVE_CAP, 1, [libcap usability])],
+ [AC_MSG_WARN([header sys/capability.h was not found, support for libcap will not be built])]
+ )],
+ [AC_MSG_WARN([libcap library was not found or not usable, support for libcap will not be built])])
+ ])
+AC_SUBST([LIB_CAP])
+
AC_FUNC_FORK
optional_bin_progs=
diff -ruN coreutils-6.12.orig/src/Makefile.am coreutils-6.12/src/Makefile.am
--- coreutils-6.12.orig/src/Makefile.am 2008-07-10 12:30:03.000000000 +0200
+++ coreutils-6.12/src/Makefile.am 2008-07-24 13:18:43.000000000 +0200
@@ -91,14 +91,14 @@
# for clock_gettime and fdatasync
dd_LDADD = $(LDADD) $(LIB_GETHRXTIME) $(LIB_FDATASYNC)
-dir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_SELINUX)
+dir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_SELINUX) $(LIB_CAP)
id_LDADD = $(LDADD) $(LIB_SELINUX)
-ls_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_SELINUX)
+ls_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_SELINUX) $(LIB_CAP)
pr_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
shred_LDADD = $(LDADD) $(LIB_GETHRXTIME) $(LIB_FDATASYNC)
shuf_LDADD = $(LDADD) $(LIB_GETHRXTIME)
mktemp_LDADD = $(LDADD) $(LIB_GETHRXTIME)
-vdir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_SELINUX)
+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.
diff -ruN coreutils-6.10.orig/src/dircolors.c coreutils-6.10/src/dircolors.c
--- coreutils-6.10.orig/src/dircolors.c 2008-07-24 14:29:44.000000000 +0200
+++ coreutils-6.10/src/dircolors.c 2008-07-24 14:38:14.000000000 +0200
@@ -63,14 +63,14 @@
"SYMLINK", "ORPHAN", "MISSING", "FIFO", "PIPE", "SOCK", "BLK", "BLOCK",
"CHR", "CHAR", "DOOR", "EXEC", "LEFT", "LEFTCODE", "RIGHT", "RIGHTCODE",
"END", "ENDCODE", "SUID", "SETUID", "SGID", "SETGID", "STICKY",
- "OTHER_WRITABLE", "OWR", "STICKY_OTHER_WRITABLE", "OWT", NULL
+ "OTHER_WRITABLE", "OWR", "STICKY_OTHER_WRITABLE", "OWT", "CAPABILITY", NULL
};
static const char *const ls_codes[] =
{
"no", "no", "fi", "di", "ln", "ln", "ln", "or", "mi", "pi", "pi",
"so", "bd", "bd", "cd", "cd", "do", "ex", "lc", "lc", "rc", "rc", "ec", "ec",
- "su", "su", "sg", "sg", "st", "ow", "ow", "tw", "tw", NULL
+ "su", "su", "sg", "sg", "st", "ow", "ow", "tw", "tw", "ca", NULL
};
#define array_len(Array) (sizeof (Array) / sizeof *(Array))
verify (array_len (slack_codes) == array_len (ls_codes));
diff --git a/src/dircolors.hin b/src/dircolors.hin
index 38914c8..5137cc6 100644
--- a/src/dircolors.hin
+++ b/src/dircolors.hin
@@ -77,6 +77,7 @@ CHR 40;33;01 # character device driver
ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file
SETUID 37;41 # file that is setuid (u+s)
SETGID 30;43 # file that is setgid (g+s)
+CAPABILITY 30;41 # file with capability
STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w)
OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
diff --git a/src/ls.c b/src/ls.c
index 4b69f7d..9bc66a1 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -38,6 +38,10 @@
#include <config.h>
#include <sys/types.h>
+#ifdef HAVE_CAP
+# include <sys/capability.h>
+#endif
+
#if HAVE_TERMIOS_H
# include <termios.h>
#endif
@@ -518,14 +518,14 @@
{
C_LEFT, C_RIGHT, C_END, C_NORM, C_FILE, C_DIR, C_LINK, C_FIFO, C_SOCK,
C_BLK, C_CHR, C_MISSING, C_ORPHAN, C_EXEC, C_DOOR, C_SETUID, C_SETGID,
- C_STICKY, C_OTHER_WRITABLE, C_STICKY_OTHER_WRITABLE
+ C_STICKY, C_OTHER_WRITABLE, C_STICKY_OTHER_WRITABLE, C_CAP
};
static const char *const indicator_name[]=
{
"lc", "rc", "ec", "no", "fi", "di", "ln", "pi", "so",
"bd", "cd", "mi", "or", "ex", "do", "su", "sg", "st",
- "ow", "tw", NULL
+ "ow", "tw", "ca", NULL
};
struct color_ext_type
@@ -553,6 +557,7 @@ static struct bin_str color_indicator[] =
{ LEN_STR_PAIR ("37;44") }, /* st: sticky: black on blue */
{ LEN_STR_PAIR ("34;42") }, /* ow: other-writable: blue on green */
{ LEN_STR_PAIR ("30;42") }, /* tw: ow w/ sticky: black on green */
+ { LEN_STR_PAIR ("30;41") }, /* capability: black on red */
};
/* FIXME: comment */
@@ -3953,6 +3953,38 @@
DIRED_PUTCHAR (c);
}
+#ifdef HAVE_CAP
+static bool
+/* Return true if NAME has a capability (see linux/capability.h) */
+has_capability (const char *name)
+{
+ cap_t cap_d;
+ char *result;
+ bool has_cap;
+
+ cap_d = cap_get_file (name);
+ if (cap_d == NULL)
+ return false;
+
+ result = cap_to_text (cap_d, NULL);
+ cap_free (cap_d);
+ if (!result)
+ return false;
+
+ /* check if human-readable capability string is empty */
+ has_cap = !!*result;
+
+ cap_free (result);
+ return has_cap;
+}
+#else
+static bool
+has_capability (const char *name)
+{
+ return false;
+}
+#endif
+
static void
print_color_indicator (const char *name, mode_t mode, int linkok,
bool stat_ok, enum filetype filetype)
@@ -3923,6 +3960,8 @@ print_color_indicator (const char *name, mode_t mode, int linkok,
type = C_SETUID;
else if ((mode & S_ISGID) != 0)
type = C_SETGID;
+ else if (has_capability (name))
+ type = C_CAP;
else if ((mode & S_IXUGO) != 0)
type = C_EXEC;
}
diff -ruN coreutils-6.10.orig/tests/ls/Makefile.am coreutils-6.10/tests/ls/Makefile.am
--- coreutils-6.10.orig/tests/ls/Makefile.am 2007-11-25 14:23:31.000000000 +0100
+++ coreutils-6.10/tests/ls/Makefile.am 2008-07-24 14:46:36.000000000 +0200
@@ -18,7 +18,7 @@
TESTS = \
stat-free-symlinks \
nameless-uid \
- color-dtype-dir \
+ color-dtype-dir capability \
stat-failed \
stat-dtype \
inode dangle file-type recursive dired infloop \
diff --git a/tests/ls/capability b/tests/ls/capability
new file mode 100755
index 0000000..549e06b
--- /dev/null
+++ b/tests/ls/capability
@@ -0,0 +1,43 @@
+#!/bin/sh
+# Ensure "ls --color" properly colorizes file with capability.
+
+# Copyright (C) 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
+ ls --version
+fi
+
+. $srcdir/../test-lib.sh
+uid_is_privileged_ || skip_test_ "must be run as root"
+
+(setcap --help) 2>&1 |grep 'usage: setcap' > /dev/null \
+ || skip_test_ "setcap utility not found"
+fail=0
+
+# Don't let a different umask perturb the results.
+umask 22
+
+touch test
+setcap cap_net_bind_service=ep test \
+ || framework_failure
+code='30;41'
+LS_COLORS="ca=$code" \
+ ls --color=always test > out || fail=1
+printf "\033[0m\033[${code}mtest\033[0m\n\033[m" > out_ok || fail=1
+compare out out_ok || fail=1
+
+(exit $fail); exit $fail
--
1.5.4.1

View File

@ -0,0 +1,15 @@
diff -urNp coreutils-6.12-orig/src/seq.c coreutils-6.12/src/seq.c
--- coreutils-6.12-orig/src/seq.c 2008-05-26 08:40:32.000000000 +0200
+++ coreutils-6.12/src/seq.c 2008-09-29 22:09:21.000000000 +0200
@@ -304,7 +304,10 @@ print_numbers (char const *fmt, struct l
bool print_extra_number = false;
long double x_val;
char *x_str;
- int x_strlen = asprintf (&x_str, fmt, x);
+ int x_strlen;
+ setlocale (LC_NUMERIC, "C");
+ x_strlen = asprintf (&x_str, fmt, x);
+ setlocale (LC_NUMERIC, "");
if (x_strlen < 0)
xalloc_die ();
x_str[x_strlen - layout.suffix_len] = '\0';

59
coreutils-authors.patch Normal file
View File

@ -0,0 +1,59 @@
Signed-off-by: Ondřej Vašík <ovasik@redhat.com>
Signed-off-by: Jim Meyering <meyering@redhat.com>
* src/echo.c (AUTHORS) : Use bash builtin echo authors instead of FIXME unknown
* src/basename.c (AUTHORS): List David as the author.
* AUTHORS: Update here, too.
---
AUTHORS | 4 ++--
src/basename.c | 2 +-
src/echo.c | 4 +++-
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/basename.c b/src/basename.c
index 38e8879..69b708f 100644
--- a/src/basename.c
+++ b/src/basename.c
@@ -37,7 +37,7 @@
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "basename"
-#define AUTHORS "FIXME unknown"
+#define AUTHORS "David MacKenzie"
/* The name this program was run with. */
char *program_name;
diff --git a/AUTHORS b/AUTHORS
index 404cf70..666edc1 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -3,7 +3,7 @@ each followed by the name(s) of its author(s).
arch: David MacKenzie, Karel Zak
base64: Simon Josefsson
-basename: FIXME unknown
+basename: David MacKenzie
cat: Torbjorn Granlund, Richard M. Stallman
chcon: Russell Coker, Jim Meyering
chgrp: David MacKenzie, Jim Meyering
@@ -22,7 +22,7 @@ dir: Richard M. Stallman, David MacKenzie
dircolors: H. Peter Anvin
dirname: David MacKenzie, Jim Meyering
du: Torbjorn Granlund, David MacKenzie, Paul Eggert, Jim Meyering
-echo: FIXME unknown
+echo: Brian Fox, Chet Ramey
env: Richard Mlynarik, David MacKenzie
expand: David MacKenzie
expr: Mike Parker
diff --git a/src/echo.c b/src/echo.c
index ebbf5b8..11e648e 100644
--- a/src/echo.c
+++ b/src/echo.c
@@ -24,7 +24,7 @@
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "echo"
-#define AUTHORS "FIXME unknown"
+#define AUTHORS "Brian Fox", "Chet Ramey"
/* echo [-neE] [arg ...]
Output the ARGs. If -n is specified, the trailing newline is

View File

@ -1933,7 +1933,7 @@
if (newlim)
lim = newlim;
}
@@ -1384,6 +1570,107 @@
@@ -1384,6 +1570,113 @@
return ptr;
}
@ -1946,6 +1946,9 @@
+ int i;
+ size_t mblength;
+ mbstate_t state;
+ if (echar == 0)
+ eword++; /* skip all of end field. */
+
+
+ memset (&state, '\0', sizeof(mbstate_t));
+
@ -2015,24 +2018,27 @@
+ }
+# endif
+
+ /* If we're skipping leading blanks, don't start counting characters
+ * until after skipping past any leading blanks. */
+ if (key->skipsblanks)
+ while (ptr < lim && ismbblank (ptr, lim - ptr, &mblength))
+ ptr += mblength;
+ if (echar != 0)
+ {
+ /* If we're skipping leading blanks, don't start counting characters
+ * until after skipping past any leading blanks. */
+ if (key->skipsblanks)
+ while (ptr < lim && ismbblank (ptr, lim - ptr, &mblength))
+ ptr += mblength;
+
+ memset (&state, '\0', sizeof(mbstate_t));
+ memset (&state, '\0', sizeof(mbstate_t));
+
+ /* Advance PTR by ECHAR (if possible), but no further than LIM. */
+ for (i = 0; i < echar; i++)
+ {
+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
+ /* Advance PTR by ECHAR (if possible), but no further than LIM. */
+ for (i = 0; i < echar; i++)
+ {
+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
+
+ if (ptr + mblength > lim)
+ break;
+ else
+ ptr += mblength;
+ }
+ if (ptr + mblength > lim)
+ break;
+ else
+ ptr += mblength;
+ }
+ }
+
+ return ptr;
+}

View File

@ -361,6 +361,15 @@
The program accepts the following options. Also see @ref{Common options}.
@@ -12815,6 +12815,8 @@
@env{PATH} to a compiled-in default value. Change to @var{user}'s home
directory. Prepend @samp{-} to the shell's name, intended to make it
read its login startup file(s).
+Additionaly @env{DISPLAY} and @env{XAUTHORITY} environment variables
+are preserved as well for PAM functionality.
@item -m
@itemx -p
@@ -13477,33 +13480,6 @@
the exit status of the subshell otherwise
@end display

View File

@ -31,9 +31,9 @@ diff -urp coreutils-6.10-orig/man/cp.1 coreutils-6.10/man/cp.1
.TP
\fB\-x\fR, \fB\-\-one\-file\-system\fR
stay on this file system
+.TP
+\fB\-Z\fR, \fB\-\-context\fR=\fICONTEXT\fR
+(SELinux) set SELinux security context of copy to CONTEXT
+.TP
.TP
\fB\-\-help\fR
display this help and exit
@ -89,15 +89,6 @@ diff -urp coreutils-6.10-orig/man/chcon.1 coreutils-6.10/man/chcon.1
With \fB\-\-reference\fR, change the security context of each FILE to that of RFILE.
.TP
\fB\-c\fR, \fB\-\-changes\fR
@@ -74,6 +74,8 @@ License GPLv3+: GNU GPL version 3 or lat
.br
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
+.SH "REPORTING BUGS"
+Report bugs to <https://bugzilla.redhat.com/bugzilla>.
.SH "SEE ALSO"
The full documentation for
.B chcon
diff -urp coreutils-6.10-orig/man/id.1 coreutils-6.10/man/id.1
--- coreutils-6.10-orig/man/id.1 2008-01-25 12:34:24.000000000 +0100
+++ coreutils-6.10/man/id.1 2008-01-25 14:40:22.000000000 +0100
@ -240,6 +231,23 @@ diff -urp coreutils-6.10-orig/man/vdir.1 coreutils-6.10/man/vdir.1
.TP
\fB\-\-help\fR
display this help and exit
diff -urNp coreutils-6.12-orig/src/chcon.c coreutils-6.12/src/chcon.c
--- coreutils-6.12-orig/src/chcon.c 2008-05-26 08:40:32.000000000 +0200
+++ coreutils-6.12/src/chcon.c 2008-06-16 14:43:24.000000000 +0200
@@ -302,9 +302,11 @@ process_file (FTS *fts, FTSENT *ent)
if (ok)
{
- if (verbose)
- printf (_("changing security context of %s"),
+ if (verbose) {
+ printf (_("changing security context of %s"),
quote (file_full_name));
+ putchar ('\n');
+ }
if (change_file_context (fts->fts_cwd_fd, file) != 0)
ok = false;
diff -urp coreutils-6.10-orig/src/copy.c coreutils-6.10/src/copy.c
--- coreutils-6.10-orig/src/copy.c 2008-01-05 23:59:11.000000000 +0100
+++ coreutils-6.10/src/copy.c 2008-01-25 17:23:17.000000000 +0100
@ -376,24 +384,12 @@ diff -urp coreutils-6.10-orig/src/cp.c coreutils-6.10/src/cp.c
x->require_preserve = false;
x->recursive = false;
@@ -867,8 +873,10 @@ decode_preserve_arg (char const *arg, st
x->preserve_timestamps = on_off;
x->preserve_ownership = on_off;
x->preserve_links = on_off;
- if (selinux_enabled)
+ if (selinux_enabled) {
x->preserve_security_context = on_off;
+ x->require_preserve_context = on_off;
+ }
break;
default:
@@ -909,7 +917,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, "abcdfHilLprst:uvxPRS:TZ",
+ while ((c = getopt_long (argc, argv, "abcdfHilLprst:uvxPRS:TZ:",
long_opts, NULL))
!= -1)
{
@ -656,7 +652,26 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
};
ARGMATCH_VERIFY (format_args, format_types);
@@ -1236,7 +1245,7 @@ main (int argc, char **argv)
@@ -1151,7 +1160,8 @@ main (int argc, char **argv)
/* Avoid following symbolic links when possible. */
if (is_colored (C_ORPHAN)
|| (is_colored (C_EXEC) && color_symlink_as_referent)
- || (is_colored (C_MISSING) && format == long_format))
+ || (is_colored (C_MISSING) && (format == long_format
+ || format == security_format)))
check_symlink_color = true;
/* If the standard output is a controlling terminal, watch out
@@ -1200,7 +1210,7 @@ main (int argc, char **argv)
if (dereference == DEREF_UNDEFINED)
dereference = ((immediate_dirs
|| indicator_style == classify
- || format == long_format)
+ || format == long_format || format == security_format)
? DEREF_NEVER
: DEREF_COMMAND_LINE_SYMLINK_TO_DIR);
@@ -1236,7 +1246,7 @@ main (int argc, char **argv)
format_needs_stat = sort_type == sort_time || sort_type == sort_size
|| format == long_format
@ -665,7 +680,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
|| print_block_size;
format_needs_type = (! format_needs_stat
&& (recursive
@@ -1267,7 +1276,7 @@ main (int argc, char **argv)
@@ -1267,7 +1277,7 @@ main (int argc, char **argv)
}
else
do
@ -674,7 +689,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
while (i < argc);
if (cwd_n_used)
@@ -1429,7 +1438,7 @@ decode_switches (int argc, char **argv)
@@ -1429,7 +1439,7 @@ decode_switches (int argc, char **argv)
ignore_mode = IGNORE_DEFAULT;
ignore_patterns = NULL;
hide_patterns = NULL;
@ -683,7 +698,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
/* FIXME: put this in a function. */
{
@@ -1811,13 +1820,27 @@ decode_switches (int argc, char **argv)
@@ -1811,13 +1821,27 @@ decode_switches (int argc, char **argv)
break;
case 'Z':
@ -712,7 +727,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
default:
usage (LS_FAILURE);
}
@@ -2517,8 +2540,10 @@ clear_files (void)
@@ -2517,8 +2541,10 @@ clear_files (void)
struct fileinfo *f = sorted_file[i];
free (f->name);
free (f->linkname);
@ -725,7 +740,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
}
cwd_n_used = 0;
@@ -2560,6 +2585,7 @@ gobble_file (char const *name, enum file
@@ -2560,6 +2586,7 @@ gobble_file (char const *name, enum file
memset (f, '\0', sizeof *f);
f->stat.st_ino = inode;
f->filetype = type;
@ -733,7 +748,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
if (command_line_arg
|| format_needs_stat
@@ -2609,7 +2635,7 @@ gobble_file (char const *name, enum file
@@ -2609,7 +2636,7 @@ gobble_file (char const *name, enum file
{
case DEREF_ALWAYS:
err = stat (absolute_name, &f->stat);
@ -742,7 +757,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
break;
case DEREF_COMMAND_LINE_ARGUMENTS:
@@ -2618,7 +2644,7 @@ gobble_file (char const *name, enum file
@@ -2618,7 +2645,7 @@ gobble_file (char const *name, enum file
{
bool need_lstat;
err = stat (absolute_name, &f->stat);
@ -751,7 +766,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
if (dereference == DEREF_COMMAND_LINE_ARGUMENTS)
break;
@@ -2637,7 +2663,7 @@ gobble_file (char const *name, enum file
@@ -2637,7 +2664,7 @@ gobble_file (char const *name, enum file
default: /* DEREF_NEVER */
err = lstat (absolute_name, &f->stat);
@ -760,16 +775,16 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
break;
}
@@ -2659,7 +2685,7 @@ gobble_file (char const *name, enum file
@@ -2659,7 +2686,7 @@ gobble_file (char const *name, enum file
f->stat_ok = true;
- if (format == long_format || print_scontext)
+ if (format == long_format || format == security_format)
+ if (format == long_format || format == security_format || print_scontext)
{
bool have_acl = false;
int attr_len = (do_deref
@@ -2667,9 +2694,7 @@ gobble_file (char const *name, enum file
@@ -2667,9 +2695,7 @@ gobble_file (char const *name, enum file
: lgetfilecon (absolute_name, &f->scontext));
err = (attr_len < 0);
@ -780,16 +795,43 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
{
f->scontext = UNKNOWN_SECURITY_CONTEXT;
@@ -2681,7 +2706,7 @@ gobble_file (char const *name, enum file
@@ -2681,7 +2707,7 @@ gobble_file (char const *name, enum file
err = 0;
}
- if (err == 0 && ! have_acl && format == long_format)
+ if (err == 0 && format == long_format)
+ if (err == 0 && (format == long_format || format == security_format))
{
int n = file_has_acl (absolute_name, &f->stat);
err = (n < 0);
@@ -3255,6 +3281,13 @@ print_current_files (void)
@@ -2695,7 +2721,7 @@ gobble_file (char const *name, enum file
}
if (S_ISLNK (f->stat.st_mode)
- && (format == long_format || check_symlink_color))
+ && (format == long_format || format == security_format || check_symlink_color))
{
char *linkname;
struct stat linkstats;
@@ -2715,7 +2741,7 @@ gobble_file (char const *name, enum file
command line are automatically traced if not being
listed as files. */
if (!command_line_arg || format == long_format
- || !S_ISDIR (linkstats.st_mode))
+ || format == security_format || !S_ISDIR (linkstats.st_mode))
{
/* Get the linked-to file's mode for the filetype indicator
in long listings. */
@@ -2754,7 +2780,7 @@ gobble_file (char const *name, enum file
block_size_width = len;
}
- if (format == long_format)
+ if (format == long_format || format == security_format )
{
if (print_owner)
{
@@ -3255,6 +3282,13 @@ print_current_files (void)
print_long_format (sorted_file[i]);
DIRED_PUTCHAR ('\n');
}
@ -803,7 +845,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
break;
}
}
@@ -3481,7 +3514,7 @@ print_long_format (const struct fileinfo
@@ -3481,7 +3515,7 @@ print_long_format (const struct fileinfo
The latter is wrong when inode_number_width is zero. */
p += strlen (p);
}
@ -812,7 +854,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
if (print_block_size)
{
char hbuf[LONGEST_HUMAN_READABLE + 1];
@@ -3510,9 +3543,15 @@ print_long_format (const struct fileinfo
@@ -3510,9 +3544,15 @@ print_long_format (const struct fileinfo
The latter is wrong when nlink_width is zero. */
p += strlen (p);
@ -829,7 +871,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
{
DIRED_FPUTS (buf, stdout, p - buf);
@@ -3525,9 +3564,6 @@ print_long_format (const struct fileinfo
@@ -3525,9 +3565,6 @@ print_long_format (const struct fileinfo
if (print_author)
format_user (f->stat.st_author, author_width, f->stat_ok);
@ -839,7 +881,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
p = buf;
}
@@ -3864,9 +3900,6 @@ print_file_name_and_frills (const struct
@@ -3864,9 +3901,6 @@ print_file_name_and_frills (const struct
human_readable (ST_NBLOCKS (f->stat), buf, human_output_opts,
ST_NBLOCKSIZE, output_block_size));
@ -849,7 +891,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,
f->stat_ok, f->filetype, NULL);
@@ -4030,9 +4063,6 @@ length_of_file_name_and_frills (const st
@@ -4030,9 +4064,6 @@ length_of_file_name_and_frills (const st
output_block_size))
: block_size_width);
@ -859,7 +901,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);
len += name_width;
@@ -4461,9 +4491,16 @@ Mandatory arguments to long options are
@@ -4461,9 +4492,16 @@ Mandatory arguments to long options are
-w, --width=COLS assume screen width instead of current value\n\
-x list entries by lines instead of by columns\n\
-X sort alphabetically by entry extension\n\
@ -877,7 +919,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
fputs (_("\n\
@@ -4487,3 +4524,67 @@ Exit status is 0 if OK, 1 if minor probl
@@ -4487,3 +4525,67 @@ Exit status is 0 if OK, 1 if minor probl
}
exit (status);
}

View File

@ -1,7 +1,7 @@
Summary: The GNU core utilities: a set of tools commonly used in shell scripts
Name: coreutils
Version: 6.10
Release: 21%{?dist}
Release: 35%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@ -24,12 +24,21 @@ Patch3: coreutils-mvatomic.patch
Patch4: coreutils-6.10-lonebackslash.patch
Patch5: coreutils-6.10-mkscontextsegfault.patch
Patch6: coreutils-6.10-md5sha1sum.patch
Patch7: coreutils-6.11-matchpathconinstall.patch
Patch8: coreutils-authors.patch
Patch9: coreutils-6.10-whorunlevel.patch
Patch10: coreutils-6.12-seqdecimalutf8.patch
Patch11: coreutils-6.12-date_timerelsnumber.patch
Patch12: coreutils-446294-lsexitstatuses.patch
Patch13: coreutils-6.10-sort-endoffields.patch
# Our patches
Patch100: coreutils-chgrp.patch
Patch101: coreutils-6.10-configuration.patch
Patch102: coreutils-6.10-manpages.patch
#Patch103: coreutils-6.10-longoptions.patch
Patch104: coreutils-6.10-sparc-shafix.patch
Patch105: coreutils-6.12-dd-fullblock.patch
# sh-utils
Patch703: sh-utils-2.0.11-dateman.patch
@ -51,10 +60,13 @@ Patch912: coreutils-overflow.patch
Patch915: coreutils-split-pam.patch
Patch916: coreutils-getfacl-exit-code.patch
#SELINUX Patch - implements Redhat changes
#SELINUX Patch - implements Redhat changes
#(upstream did some SELinux implementation unlike with RedHat patch)
Patch950: coreutils-selinux.patch
Patch951: coreutils-selinuxmanpages.patch
Patch952: coreutils-463883-chcon-changes.patch
Patch954: coreutils-6.12-ls-libcap.patch
BuildRequires: libselinux-devel >= 1.25.6-1
BuildRequires: libacl-devel
@ -63,15 +75,18 @@ BuildRequires: texinfo >= 4.3
BuildRequires: lzma
BuildRequires: autoconf >= 2.58
#dist-lzma required
BuildRequires: automake >= 1.10.1
BuildRequires: automake >= 1.10.1
%{?!nopam:BuildRequires: pam-devel}
BuildRequires: libcap-devel >= 2.0.6
Requires: libattr
Requires(post): libselinux >= 1.25.6-1
Requires(pre): /sbin/install-info
Requires(preun): /sbin/install-info
Requires(post): /sbin/install-info
Requires(post): grep
%{?!nopam:Requires: pam >= 0.66-12}
Requires(post): libcap >= 2.0.6
# Require a C library that doesn't put LC_TIME files in our way.
Conflicts: glibc < 2.2
@ -108,12 +123,22 @@ cd %name-%version
%patch4 -p1 -b .backslash
%patch5 -p1 -b .mksegfault
%patch6 -p1 -b .mda5sum
%patch7 -p1 -b .matchpathcon
%patch8 -p1 -b .authors
%patch9 -p1 -b .whorunlevel
%patch10 -p1 -b .sequtf8
%patch11 -p1 -b .getdate
%patch12 -p1 -b .lsexit
%patch13 -p1 -b .endfields
# Our patches
%patch100 -p1 -b .chgrp
%patch101 -p1 -b .configure
%patch102 -p1 -b .manpages
#%patch103 -p1 -b .longopt
%patch104 -p1 -b .sparc
%patch105 -p1 -b .dd-fullblock
# sh-utils
%patch703 -p1 -b .dateman
@ -136,17 +161,19 @@ cd %name-%version
#SELinux
%patch950 -p1 -b .selinux
%patch951 -p1 -b .selinuxman
%patch952 -p1 -b .chconchanges
%patch954 -p1 -b .ls-libcap
chmod a+x tests/sort/sort-mb-tests
chmod a+x tests/mkdir/selinux
chmod a+x tests/ls/capability
#fix typos/mistakes in localized documentation(#439410, #440056)
for pofile in $(find ./po/*.p*)
do
sed -i 's/-dpR/-cdpR/' "$pofile"
sed -i 's/commmand/command/' "$pofile"
done
find ./po/ -name "*.p*" | xargs \
sed -i \
-e 's/-dpR/-cdpR/' \
-e 's/commmand/command/'
%build
%ifarch s390 s390x
@ -196,12 +223,12 @@ mkdir -p $RPM_BUILD_ROOT{/bin,%_bindir,%_sbindir,/sbin}
%{?!nopam:mkdir -p $RPM_BUILD_ROOT%_sysconfdir/pam.d}
for f in basename cat chgrp chmod chown cp cut date dd df echo env false link ln ls mkdir mknod mktemp mv nice pwd rm rmdir sleep sort stty sync touch true uname unlink
do
mv $RPM_BUILD_ROOT{%_bindir,/bin}/$f
mv $RPM_BUILD_ROOT{%_bindir,/bin}/$f
done
# chroot was in /usr/sbin :
mv $RPM_BUILD_ROOT{%_bindir,%_sbindir}/chroot
# {cat,sort,cut} were previously moved from bin to /usr/bin and linked into
# {cat,sort,cut} were previously moved from bin to /usr/bin and linked into
for i in env cut; do ln -sf ../../bin/$i $RPM_BUILD_ROOT/usr/bin; done
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
@ -214,6 +241,9 @@ install -p -c -m644 %SOURCE106 $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/colorls.c
# su
install -m 4755 src/su $RPM_BUILD_ROOT/bin
install -m 755 src/runuser $RPM_BUILD_ROOT/sbin
# do not ship runuser in /usr/bin/runuser
rm -rf $RPM_BUILD_ROOT/usr/bin/runuser
# These come from util-linux and/or procps.
for i in hostname uptime kill ; do
@ -314,6 +344,79 @@ fi
/sbin/runuser
%changelog
* Mon Mar 02 2009 Ondrej Vasik <ovasik@redhat.com> 6.10-35
- fix sort bugs (including #485715) for multibyte locales
as well
* Fri Feb 27 2009 Ondrej Vasik <ovasik@redhat.com> - 6.10-34
- fix showing ACL's for ls -Z (#487374), fix automatic
column width for it as well
- fix couple of bugs (including #485715) in sort with
determining end of fields(upstream)
- do not mistakenly display -g and -G runuser option in su
--help output
- some sed cleanup
* Mon Oct 13 2008 Ondrej Vasik <ovasik@redhat.com> - 6.10-33
- fix several date issues(e.g. countable dayshifts, ignoring
some cases of relative offset, locales conversions...)
- clarify ls exit statuses documentation (#446294)
* Sun Oct 12 2008 Ondrej Vasik <ovasik@redhat.com> - 6.10-32
- cp -Z now correctly separated in man page (#466646)
- cp -Z works again (#466653)
- make preservation of SELinux CTX non-mandatory for
preserve=all cp option
* Thu Oct 09 2008 Ondrej Vasik <ovasik@redhat.com> - 6.10-31
- do not double bugreport page in chcon
- do not mention --change chcon option in help and man
(never accepted by upstream, can't be reliable), code
not exists in F-9 (#463883)
- added capability support to ls, but not to DIRCOLORS*
files
- added requires for libattr (#465569)
- seq should no longer fail to display final number of some
float usages of seq with utf8 locales(#463556)
- mention that DISPLAY and XAUTHORITY envvars are preserved
for pam_xauth in su -l (#450505)
* Fri Aug 01 2008 Kamil Dudka <kdudka@redhat.com> - 6.10-30
- removed CAPABILITY color from DIR_COLORS
* Fri Aug 01 2008 Kamil Dudka <kdudka@redhat.com> - 6.10-29
- disabled last patch ls-libcap which broke tcsh (#457342)
* Wed Jul 28 2008 Kamil Dudka <kdudka@redhat.com> - 6.10-28
- dd: iflag=fullblock now read full blocks if possible
(#431997, #449263)
- ls: --color now highlights files with capabilities (#449985)
- suppressed failing test in tests/touch/no-create-missing
* Fri Jul 04 2008 Ondrej Vasik <ovasik@redhat.com> - 6.10-27
- who -r should not show last runlevel for nonprintable chars
(like \0) - #453249,add few missing who options to texinfo
documentation, add missing authors for basename and echo
* Mon Jun 16 2008 Ondrej Vasik <ovasik@redhat.com> - 6.10-26
- print verbose output of chcon with newline after each
message (#451478)
* Mon Jun 09 2008 Ondrej Vasik <ovasik@redhat.com> - 6.10-25
- modified memory leak fix (upstream patch)
- fixed segfault in ls -lZ(#449866)
- runuser binary is no longer doubled in /usr/bin/runuser
* Mon May 26 2008 Tom "spot" Callaway <tcallawa@redhat.com> - 6.10-24
- fix SHA256/SHA512 to work on sparc
* Tue May 20 2008 Ondrej Vasik <ovasik@redhat.com> - 6.10-23
- fixed a HUGE memory leak in install binary(#447410)
* Tue May 13 2008 Ondrej Vasik <ovasik@redhat.com> - 6.10-22
- checksum line handling fix (#439531) done upstream way
which covers more possible cases
* Fri Apr 18 2008 Ondrej Vasik <ovasik@redhat.com> - 6.10-21
- fix wrong checksum line handling in sha1sum -c
command(#439531)