Compare commits

...

9 Commits
rawhide ... f13

Author SHA1 Message Date
Kamil Dudka dfab349bdb prevent sort from assertion failure (#647938)
... in case LC_CTYPE does not match LC_TIME
2010-11-03 12:45:05 +01:00
Ondřej Vašík c115d8a1c5 add missing patches 2010-10-01 13:41:24 +02:00
Ondřej Vašík d0389630a2 cumulative update from rawhide 2010-10-01 13:40:27 +02:00
Fedora Release Engineering f2b720cd89 dist-git conversion 2010-07-28 12:11:01 +00:00
Ondrej Vasik bdab1ae0e6 fix danish translation file encoding(#615945) 2010-07-20 08:13:12 +00:00
Ondrej Vasik b6691b37ed compile coreutils with SELinux support again(#603359) 2010-06-14 08:42:12 +00:00
Ondrej Vasik 153ad72649 oops, release bump 2010-04-28 14:44:28 +00:00
Ondrej Vasik bbd5ef1fe4 cumulative update from rawhide - speedup shell start, readlink move 2010-04-28 14:43:24 +00:00
Jesse Keating 2fda16bdbc Initialize branch F-13 for coreutils 2010-02-17 01:06:04 +00:00
14 changed files with 668 additions and 66 deletions

View File

@ -1 +1,2 @@
coreutils-8.4.tar.xz
coreutils-8.4.da.po

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 $$d/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,11 @@
diff -urNp coreutils-8.4-orig/src/Makefile.am coreutils-8.4/src/Makefile.am
--- coreutils-8.4-orig/src/Makefile.am 2010-09-03 17:34:43.399747649 +0200
+++ coreutils-8.4/src/Makefile.am 2010-09-03 17:36:13.005765125 +0200
@@ -367,6 +367,7 @@ factor_LDADD += $(LIB_GMP)
# for crypt
su_LDADD += $(LIB_CRYPT) @LIB_PAM@
+su_LDFLAGS = -pie -Wl,-z,relro,-z,now
# for various ACL functions
copy_LDADD += $(LIB_ACL)

View File

@ -0,0 +1,17 @@
diff -urNp coreutils-8.4-orig/m4/xattr.m4 coreutils-8.4/m4/xattr.m4
--- coreutils-8.4-orig/m4/xattr.m4 2010-01-12 07:36:58.000000000 +0100
+++ coreutils-8.4/m4/xattr.m4 2010-06-14 09:40:44.922293550 +0200
@@ -33,11 +33,11 @@ AC_DEFUN([gl_FUNC_XATTR],
use_xattr=yes
fi
fi
- AC_DEFINE_UNQUOTED([USE_XATTR], [$use_xattr],
- [Define if you want extended attribute support.])
if test $use_xattr = no; then
AC_MSG_WARN([libattr development library was not found or not usable.])
AC_MSG_WARN([AC_PACKAGE_NAME will be built without xattr support.])
fi
fi
+ AC_DEFINE_UNQUOTED([USE_XATTR], [`test $use_xattr != yes; echo $?`],
+ [Define if you want extended attribute support.])
])

View File

@ -0,0 +1,66 @@
From b3959fc691e606857a3c6e9b316ec34819972245 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Sat, 28 Aug 2010 17:45:29 +0200
Subject: [PATCH] tac: avoid double free
* src/tac.c (main): Reading a line longer than 16KiB would cause
tac to realloc its primary buffer. Then, just before exit, tac
would mistakenly free the original (now free'd) buffer.
This bug was introduced by commit be6c13e7, "maint: always free a
buffer, to avoid even semblance of a leak".
* tests/misc/tac (double-free): New test, to exercise this.
Reported by Salvo Tomaselli in <http://bugs.debian.org/594666>.
---
src/tac.c | 6 ++++--
tests/misc/tac | 6 ++++++
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/tac.c b/src/tac.c
index cec9736..859e006 100644
--- a/src/tac.c
+++ b/src/tac.c
@@ -633,7 +633,6 @@ main (int argc, char **argv)
if (! (read_size < half_buffer_size && half_buffer_size < G_buffer_size))
xalloc_die ();
G_buffer = xmalloc (G_buffer_size);
- void *buf = G_buffer;
if (sentinel_length)
{
strcpy (G_buffer, separator);
@@ -666,6 +665,9 @@ main (int argc, char **argv)
error (0, errno, "-");
ok = false;
}
- free (buf);
+
+ size_t offset = sentinel_length ? sentinel_length : 1;
+ free (G_buffer - offset);
+
exit (ok ? EXIT_SUCCESS : EXIT_FAILURE);
}
diff --git a/tests/misc/tac b/tests/misc/tac
index 7631049..4130c00 100755
--- a/tests/misc/tac
+++ b/tests/misc/tac
@@ -24,6 +24,9 @@ my $prog = 'tac';
my $bad_dir = 'no/such/dir';
+# This must be longer than 16KiB to trigger the double free in coreutils-8.5.
+my $long_line = 'o' x (16 * 1024 + 1);
+
my @Tests =
(
['segfault', '-r', {IN=>"a\n"}, {IN=>"b\n"}, {OUT=>"a\nb\n"}],
@@ -67,6 +70,9 @@ my @Tests =
{ERR_SUBST => "s,`$bad_dir': .*,...,"},
{ERR => "$prog: cannot create temporary file in ...\n"},
{EXIT => 1}],
+
+ # coreutils-8.5's tac would double-free its primary buffer.
+ ['double-free', {IN=>$long_line}, {OUT=>$long_line}],
);
@Tests = triple_test \@Tests;
--
1.7.2.2.510.g7180a

View File

@ -0,0 +1,431 @@
From: Pádraig Brady <P@draigBrady.com>
Date: Mon, 27 Sep 2010 06:16:44 +0000 (+0100)
Subject: tr: fix various issues with case conversion
X-Git-Url: http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commitdiff_plain;h=3f48829c;hp=704eedab034e24814067c535d3577f165c9a8b68
tr: fix various issues with case conversion
This valid translation spec aborted:
LC_ALL=en_US.iso-8859-1 tr '[:upper:]- ' '[:lower:]_'
This invalid translation spec aborted:
LC_ALL=en_US.iso-8859-1 tr '[:upper:] ' '[:lower:]'
This was caused by commit 6efd1046, 05-01-2008,
"Avoid tr case-conversion failure in some locales"
This misaligned conversion spec was allowed:
LC_ALL=C tr 'A-Y[:lower:]' 'a-z[:upper:]'
This was caused by commit af5d0c36, 21-10-2007,
"tr: do not reject an unmatched [:lower:] or [:upper:] in SET1"
This misaligned spec was allowed by extending the class:
LC_ALL=C tr '[:upper:] ' '[:lower:]'
* src/tr.c (validate_case_classes): A new function to check
alignment of case conversion classes. Also it adjusts the
length of the sets so that locales with different numbers of
upper and lower case characters, don't cause issues.
(string2_extend): Disallow extending the case conversion
class as in the above example. That is locale dependent
and most likely not what the user wants.
(validate): Do the simple test for "restricted" char classes
earlier, so we don't redundantly do more expensive validation.
(main): Remove the case class validation, and simplify.
* tests/misc/tr-case-class: A new test to test the various
alignment and locale issues, associated with case conversion.
* tests/misc/tr: Move case conversion tests to new tr-case-class.
* tests/Makefile.am: Reference the new test.
---
diff --git a/src/tr.c b/src/tr.c
index a5b6810..479d3d3 100644
--- a/src/tr.c
+++ b/src/tr.c
@@ -1177,6 +1177,78 @@ card_of_complement (struct Spec_list *s)
return cardinality;
}
+/* Discard the lengths associated with a case conversion,
+ as using the actual number of upper or lower case characters
+ is problematic when they don't match in some locales.
+ Also ensure the case conversion classes in string2 are
+ aligned correctly with those in string1.
+ Note POSIX says the behavior of `tr "[:upper:]" "[:upper:]"'
+ is undefined. Therefore we allow it (unlike Solaris)
+ and treat it as a no-op. */
+
+static void
+validate_case_classes (struct Spec_list *s1, struct Spec_list *s2)
+{
+ size_t n_upper = 0;
+ size_t n_lower = 0;
+ unsigned int i;
+ int c1 = 0;
+ int c2 = 0;
+ count old_s1_len = s1->length;
+ count old_s2_len = s2->length;
+ struct List_element *s1_tail = s1->tail;
+ struct List_element *s2_tail = s2->tail;
+ bool s1_new_element = true;
+ bool s2_new_element = true;
+
+ if (!s2->has_char_class)
+ return;
+
+ for (i = 0; i < N_CHARS; i++)
+ {
+ if (isupper (i))
+ n_upper++;
+ if (islower (i))
+ n_lower++;
+ }
+
+ s1->state = BEGIN_STATE;
+ s2->state = BEGIN_STATE;
+
+ while (c1 != -1 && c2 != -1)
+ {
+ enum Upper_Lower_class class_s1, class_s2;
+
+ c1 = get_next (s1, &class_s1);
+ c2 = get_next (s2, &class_s2);
+
+ /* If c2 transitions to a new case class, then
+ c1 must also transition at the same time. */
+ if (s2_new_element && class_s2 != UL_NONE
+ && !(s1_new_element && class_s1 != UL_NONE))
+ error (EXIT_FAILURE, 0,
+ _("misaligned [:upper:] and/or [:lower:] construct"));
+
+ /* If case converting, quickly skip over the elements. */
+ if (class_s2 != UL_NONE)
+ {
+ skip_construct (s1);
+ skip_construct (s2);
+ /* Discount insignificant/problematic lengths. */
+ s1->length -= (class_s1 == UL_UPPER ? n_upper : n_lower) - 1;
+ s2->length -= (class_s2 == UL_UPPER ? n_upper : n_lower) - 1;
+ }
+
+ s1_new_element = s1->state == NEW_ELEMENT; /* Next element is new. */
+ s2_new_element = s2->state == NEW_ELEMENT; /* Next element is new. */
+ }
+
+ assert (old_s1_len >= s1->length && old_s2_len >= s2->length);
+
+ s1->tail = s1_tail;
+ s2->tail = s2_tail;
+}
+
/* Gather statistics about the spec-list S in preparation for the tests
in validate that determine the consistency of the specs. This function
is called at most twice; once for string1, and again for any string2.
@@ -1318,20 +1390,14 @@ parse_str (char const *s, struct Spec_list *spec_list)
Upon successful completion, S2->length is set to S1->length. The only
way this function can fail to make S2 as long as S1 is when S2 has
zero-length, since in that case, there is no last character to repeat.
- So S2->length is required to be at least 1.
+ So S2->length is required to be at least 1. */
- Providing this functionality allows the user to do some pretty
- non-BSD (and non-portable) things: For example, the command
- tr -cs '[:upper:]0-9' '[:lower:]'
- is almost guaranteed to give results that depend on your collating
- sequence. */
static void
string2_extend (const struct Spec_list *s1, struct Spec_list *s2)
{
struct List_element *p;
unsigned char char_to_repeat;
- int i;
assert (translating);
assert (s1->length > s2->length);
@@ -1347,11 +1413,13 @@ string2_extend (const struct Spec_list *s1, struct Spec_list *s2)
char_to_repeat = p->u.range.last_char;
break;
case RE_CHAR_CLASS:
- for (i = N_CHARS - 1; i >= 0; i--)
- if (is_char_class_member (p->u.char_class, i))
- break;
- assert (i >= 0);
- char_to_repeat = i;
+ /* Note BSD allows extending of classes in string2. For example:
+ tr '[:upper:]0-9' '[:lower:]'
+ That's not portable however, contradicts POSIX and is dependent
+ on your collating sequence. */
+ error (EXIT_FAILURE, 0,
+ _("when translating with string1 longer than string2,\n\
+the latter string must not end with a character class"));
break;
case RE_REPEATED_CHAR:
@@ -1431,6 +1499,15 @@ validate (struct Spec_list *s1, struct Spec_list *s2)
when translating"));
}
+ if (s2->has_restricted_char_class)
+ {
+ error (EXIT_FAILURE, 0,
+ _("when translating, the only character classes that may \
+appear in\nstring2 are `upper' and `lower'"));
+ }
+
+ validate_case_classes (s1, s2);
+
if (s1->length > s2->length)
{
if (!truncate_set1)
@@ -1452,13 +1529,6 @@ when translating"));
_("when translating with complemented character classes,\
\nstring2 must map all characters in the domain to one"));
}
-
- if (s2->has_restricted_char_class)
- {
- error (EXIT_FAILURE, 0,
- _("when translating, the only character classes that may \
-appear in\nstring2 are `upper' and `lower'"));
- }
}
else
/* Not translating. */
@@ -1812,7 +1882,6 @@ main (int argc, char **argv)
{
int c1, c2;
int i;
- bool case_convert = false;
enum Upper_Lower_class class_s1;
enum Upper_Lower_class class_s2;
@@ -1822,47 +1891,21 @@ main (int argc, char **argv)
s2->state = BEGIN_STATE;
for (;;)
{
- /* When the previous pair identified case-converting classes,
- advance S1 and S2 so that each points to the following
- construct. */
- if (case_convert)
- {
- skip_construct (s1);
- skip_construct (s2);
- case_convert = false;
- }
-
c1 = get_next (s1, &class_s1);
c2 = get_next (s2, &class_s2);
- /* When translating and there is an [:upper:] or [:lower:]
- class in SET2, then there must be a corresponding [:lower:]
- or [:upper:] class in SET1. */
- if (class_s1 == UL_NONE
- && (class_s2 == UL_LOWER || class_s2 == UL_UPPER))
- error (EXIT_FAILURE, 0,
- _("misaligned [:upper:] and/or [:lower:] construct"));
-
if (class_s1 == UL_LOWER && class_s2 == UL_UPPER)
{
- case_convert = true;
for (i = 0; i < N_CHARS; i++)
if (islower (i))
xlate[i] = toupper (i);
}
else if (class_s1 == UL_UPPER && class_s2 == UL_LOWER)
{
- case_convert = true;
for (i = 0; i < N_CHARS; i++)
if (isupper (i))
xlate[i] = tolower (i);
}
- else if ((class_s1 == UL_LOWER && class_s2 == UL_LOWER)
- || (class_s1 == UL_UPPER && class_s2 == UL_UPPER))
- {
- /* POSIX says the behavior of `tr "[:upper:]" "[:upper:]"'
- is undefined. Treat it as a no-op. */
- }
else
{
/* The following should have been checked by validate... */
@@ -1870,6 +1913,13 @@ main (int argc, char **argv)
break;
xlate[c1] = c2;
}
+
+ /* When case-converting, skip the elements as an optimization. */
+ if (class_s2 != UL_NONE)
+ {
+ skip_construct (s1);
+ skip_construct (s2);
+ }
}
assert (c1 == -1 || truncate_set1);
}
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5619d0b..3236637 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -260,6 +260,7 @@ TESTS = \
misc/timeout \
misc/timeout-parameters \
misc/tr \
+ misc/tr-case-class \
misc/truncate-dangling-symlink \
misc/truncate-dir-fail \
misc/truncate-fail-diag \
diff --git a/tests/misc/tr b/tests/misc/tr
index ca7a960..00cd8e6 100755
--- a/tests/misc/tr
+++ b/tests/misc/tr
@@ -155,34 +155,8 @@ my @Tests =
# Up to coreutils-6.9, this would provoke a failed assertion.
['no-abort-1', qw(-c a '[b*256]'), {IN=>'abc'}, {OUT=>'abb'}],
-
- # Up to coreutils-6.9, tr rejected an unmatched [:lower:] or [:upper:] in SET1.
- ['s1-lower', qw('[:lower:]' '[.*]'),
- {IN=>'#$%123abcABC'}, {OUT=>'#$%123...ABC'}],
- ['s1-upper', qw('[:upper:]' '[.*]'),
- {IN=>'#$%123abcABC'}, {OUT=>'#$%123abc...'}],
-
- # Up to coreutils-6.9.91, this would fail with the diagnostic:
- # tr: misaligned [:upper:] and/or [:lower:] construct
- # with LC_CTYPE=en_US.ISO-8859-1.
- ['tolower-F', qw('[:upper:]' '[:lower:]'), {IN=>'A'}, {OUT=>'a'}],
-
- # When doing a case-converting translation with something after the
- # [:upper:] and [:lower:] elements, ensure that tr honors the following byte.
- ['upcase-xtra', qw('[:lower:].' '[:upper:]x'), {IN=>'abc.'}, {OUT=>'ABCx'}],
- ['dncase-xtra', qw('[:upper:].' '[:lower:]x'), {IN=>'ABC.'}, {OUT=>'abcx'}],
);
-# Set LC_CTYPE=en_US.ISO-8859-1 in the environment of the tolower-F test.
-foreach my $t (@Tests)
- {
- if ($t->[0] eq 'tolower-F')
- {
- push @$t, {ENV=>'LC_CTYPE=en_US.ISO-8859-1'};
- last;
- }
- }
-
@Tests = triple_test \@Tests;
# tr takes its input only from stdin, not from a file argument, so
diff --git a/tests/misc/tr-case-class b/tests/misc/tr-case-class
new file mode 100755
index 0000000..d81c676
--- /dev/null
+++ b/tests/misc/tr-case-class
@@ -0,0 +1,112 @@
+#!/bin/sh
+# Test case conversion classes
+
+# Copyright (C) 2010 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/>.
+
+. $srcdir/test-lib.sh
+
+# Ensure we support translation of case classes with extension
+echo '01234567899999999999999999' > exp
+echo 'abcdefghijklmnopqrstuvwxyz' |
+tr '[:lower:]' '0-9' > out || fail=1
+compare out exp || fail=1
+echo 'abcdefghijklmnopqrstuvwxyz' |
+tr '[:lower:][:lower:]' '[:upper:]0-9' > out || fail=1
+compare out exp || fail=1
+
+# Validate the alignment of case classes
+tr 'A-Z[:lower:]' 'a-y[:upper:]' < /dev/null && fail=1
+tr '[:upper:][:lower:]' 'a-y[:upper:]' < /dev/null && fail=1
+tr 'A-Y[:lower:]' 'a-z[:upper:]' < /dev/null && fail=1
+tr 'A-Z[:lower:]' '[:lower:][:upper:]' < /dev/null && fail=1
+tr 'A-Z[:lower:]' '[:lower:]A-Z' < /dev/null && fail=1
+tr '[:upper:][:lower:]' 'a-z[:upper:]' < /dev/null || fail=1
+tr '[:upper:][:lower:]' '[:upper:]a-z' < /dev/null || fail=1
+
+# Before coreutils 8.6 the trailing space in string1
+# caused the case class in string2 to be extended.
+# However that was not portable, dependent on locale
+# and in contravention of POSIX.
+tr '[:upper:] ' '[:lower:]' < /dev/null 2>out && fail=1
+echo 'tr: when translating with string1 longer than string2,
+the latter string must not end with a character class' > exp
+compare out exp || fail=1
+
+# Up to coreutils-6.9, tr rejected an unmatched [:lower:] or [:upper:] in SET1.
+echo '#$%123abcABC' | tr '[:lower:]' '[.*]' > out || fail=1
+echo '#$%123...ABC' > exp
+compare out exp || fail=1
+echo '#$%123abcABC' | tr '[:upper:]' '[.*]' > out || fail=1
+echo '#$%123abc...' > exp
+compare out exp || fail=1
+
+# When doing a case-converting translation with something after the
+# [:upper:] and [:lower:] elements, ensure that tr honors the following byte.
+echo 'abc.' | tr '[:lower:].' '[:upper:]x' > out || fail=1
+echo 'ABCx' > exp
+compare out exp || fail=1
+
+# Before coreutils 8.6 the disparate number of upper and lower
+# characters in some locales, triggered abort()s and invalid behavior
+export LC_ALL=en_US.ISO-8859-1
+
+if test "$(locale charmap 2>/dev/null)" = ISO-8859-1; then
+ # Up to coreutils-6.9.91, this would fail with the diagnostic:
+ # tr: misaligned [:upper:] and/or [:lower:] construct
+ # with LC_CTYPE=en_US.ISO-8859-1.
+ tr '[:upper:]' '[:lower:]' < /dev/null || fail=1
+
+ tr '[:upper:] ' '[:lower:]' < /dev/null 2>out && fail=1
+ echo 'tr: when translating with string1 longer than string2,
+the latter string must not end with a character class' > exp
+ compare out exp || fail=1
+
+ # Ensure when there are a different number of elements
+ # in each string, we validate the case mapping correctly
+ echo 'abc.xyz' |
+ tr 'ab[:lower:]' '0-1[:upper:]' > out || fail=1
+ echo 'ABC.XYZ' > exp
+ compare out exp || fail=1
+
+ # Ensure we extend string2 appropriately
+ echo 'ABC- XYZ' |
+ tr '[:upper:]- ' '[:lower:]_' > out || fail=1
+ echo 'abc__xyz' > exp
+ compare out exp || fail=1
+
+ # Ensure the size of the case classes are accounted
+ # for as a unit.
+ echo 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
+ tr '[:upper:]A-B' '[:lower:]0' >out || fail=1
+ echo '00cdefghijklmnopqrstuvwxyz' > exp
+ compare out exp || fail=1
+
+ # Ensure the size of the case classes are accounted
+ # for as a unit.
+ echo 'a' |
+ tr -t '[:lower:]a' '[:upper:]0' >out || fail=1
+ echo '0' > exp
+ compare out exp || fail=1
+
+ # Ensure the size of the case classes are accounted
+ # for as a unit.
+ echo 'a' |
+ tr -t '[:lower:][:lower:]a' '[:lower:][:upper:]0' >out || fail=1
+ echo '0' > exp
+ compare out exp || fail=1
+fi
+
+Exit $fail

View File

@ -1,5 +1,5 @@
# Configuration file for the color ls utility
# Synchronized with coreutils 8.1 dircolors
# Synchronized with coreutils 8.5 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,9 +45,11 @@ TERM mach-color
TERM mlterm
TERM putty
TERM rxvt
TERM rxvt-256color
TERM rxvt-cygwin
TERM rxvt-cygwin-native
TERM rxvt-unicode
TERM rxvt-unicode256
TERM screen
TERM screen-256color
TERM screen-256color-bce
@ -94,7 +96,6 @@ STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w)
OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
# This is for files with execute permission:
EXEC 01;32
@ -133,6 +134,9 @@ EXEC 01;32
.deb 01;31
.rpm 01;31
.jar 01;31
.war 01;31
.ear 01;31
.sar 01;31
.rar 01;31
.ace 01;31
.zoo 01;31

View File

@ -1,6 +1,6 @@
# Configuration file for the 256color ls utility
# This file goes in the /etc directory, and must be world readable.
# Synchronized with coreutils 8.1 dircolors
# Synchronized with coreutils 8.5 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
@ -23,6 +23,7 @@ OPTIONS -F -T 0
# Below, there should be one TERM entry for each termtype that is colorizable
TERM putty-256color
TERM rxvt-256color
TERM rxvt-unicode256
TERM screen-256color
TERM xterm-256color
TERM gnome-256color
@ -108,6 +109,9 @@ EXEC 38;5;34
.deb 38;5;9
.rpm 38;5;9
.jar 38;5;9
.war 38;5;9
.ear 38;5;9
.sar 38;5;9
.rar 38;5;9
.ace 38;5;9
.zoo 38;5;9

View File

@ -1,5 +1,5 @@
# Configuration file for the color ls utility - modified for gray backgrounds
# Synchronized with coreutils 8.1 dircolors
# Synchronized with coreutils 8.5 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,7 +34,9 @@ TERM xterm-16color
TERM xterm-88color
TERM xterm-256color
TERM rxvt
TERM rxvt-256color
TERM rxvt-unicode
TERM rxvt-unicode256
TERM xterm-color
TERM color-xterm
TERM vt100
@ -111,6 +113,9 @@ EXEC 00;32
.deb 00;31
.rpm 00;31
.jar 00;31
.war 00;31
.ear 00;31
.sar 00;31
.rar 00;31
.ace 00;31
.zoo 00;31

View File

@ -2,7 +2,7 @@
# color-ls initialization
if ( $?USER_LS_COLORS ) then
if ( "$USER_LS_COLORS" != "" ) then
#when USER_LS_COLORS defined do not override user
#when USER_LS_COLORS defined do not override user
#specified LS_COLORS and use them
goto finish
endif
@ -12,14 +12,14 @@ alias ll 'ls -l'
alias l. 'ls -d .*'
set COLORS=/etc/DIR_COLORS
if ($?TERM) then
if ( -e "/etc/DIR_COLORS.$TERM" ) then
if ( -e "/etc/DIR_COLORS.$TERM" ) then
set COLORS="/etc/DIR_COLORS.$TERM"
endif
endif
if ( -e "/etc/DIR_COLORS.256color" ) then
if ( "`tput colors`" == "256" ) then
if ( "`tty -s && tput colors`" == "256" ) then
set COLORS=/etc/DIR_COLORS.256color
endif
endif
endif
if ( -f ~/.dircolors ) set COLORS=~/.dircolors
if ( -f ~/.dir_colors ) set COLORS=~/.dir_colors
@ -30,11 +30,11 @@ endif
if ( ! -e "$COLORS" ) exit
eval `dircolors -c $COLORS`
eval "`dircolors -c $COLORS`"
if ( "$LS_COLORS" == '' ) exit
set color_none=`sed -n '/^COLOR.*none/Ip' < $COLORS`
if ( "$color_none" != '' ) then
if ( "$color_none" != '' ) then
unset color_none
exit
endif

View File

@ -18,7 +18,7 @@ if [ -z "$USER_LS_COLORS" ]; then
done
[ -z "$COLORS" ] && [ -e "/etc/DIR_COLORS.256color" ] && \
[ "x`tput colors 2>/dev/null`" = "x256" ] && \
[ "x`tty -s && tput colors 2>/dev/null`" = "x256" ] && \
COLORS="/etc/DIR_COLORS.256color"
if [ -z "$COLORS" ]; then
@ -30,7 +30,7 @@ if [ -z "$USER_LS_COLORS" ]; then
# Existence of $COLORS already checked above.
[ -n "$COLORS" ] || return
eval `dircolors --sh "$COLORS" 2>/dev/null`
eval "`dircolors --sh "$COLORS" 2>/dev/null`"
[ -z "$LS_COLORS" ] && return
grep -qi "^COLOR.*none" $COLORS >/dev/null 2>/dev/null && return
fi

View File

@ -1,3 +1,21 @@
lib/linebuffer.h | 8 +
src/cut.c | 420 ++++++++++++++++++++++++++--
src/expand.c | 160 +++++++++++-
src/fold.c | 309 +++++++++++++++++++--
src/join.c | 343 ++++++++++++++++++++---
src/pr.c | 431 ++++++++++++++++++++++++++---
src/sort.c | 692 ++++++++++++++++++++++++++++++++++++++++++++--
src/unexpand.c | 226 +++++++++++++++-
src/uniq.c | 259 +++++++++++++++++-
tests/Makefile.am | 5 +
tests/misc/cut | 4 +-
tests/misc/mb1.I | 4 +
tests/misc/mb1.X | 4 +
tests/misc/mb2.I | 4 +
tests/misc/mb2.X | 4 +
tests/misc/sort-mb-tests | 58 ++++
16 files changed, 2754 insertions(+), 177 deletions(-)
diff -urNp coreutils-8.0-orig/lib/linebuffer.h coreutils-8.0/lib/linebuffer.h
--- coreutils-8.0-orig/lib/linebuffer.h 2009-10-06 10:59:48.000000000 +0200
+++ coreutils-8.0/lib/linebuffer.h 2009-10-07 10:07:16.000000000 +0200
@ -2429,12 +2447,8 @@ diff -urNp coreutils-8.0-orig/src/sort.c coreutils-8.0/src/sort.c
#include "system.h"
#include "argmatch.h"
#include "error.h"
@@ -122,14 +131,38 @@ static int decimal_point;
/* Thousands separator; if -1, then there isn't one. */
static int thousands_sep;
@@ -125,12 +134,34 @@ static int thousands_sep;
+static int force_general_numcompare = 0;
+
/* Nonzero if the corresponding locales are hard. */
static bool hard_LC_COLLATE;
-#if HAVE_NL_LANGINFO
@ -2469,7 +2483,7 @@ diff -urNp coreutils-8.0-orig/src/sort.c coreutils-8.0/src/sort.c
/* The kind of blanks for '-b' to skip in various options. */
enum blanktype { bl_start, bl_end, bl_both };
@@ -268,13 +301,11 @@ static bool reverse;
@@ -269,13 +300,11 @@ static bool reverse;
they were read if all keys compare equal. */
static bool stable;
@ -2486,7 +2500,7 @@ diff -urNp coreutils-8.0-orig/src/sort.c coreutils-8.0/src/sort.c
/* Flag to remove consecutive duplicate lines from the output.
Only the last of a sequence of equal lines will be output. */
@@ -712,6 +743,44 @@ reap_some (void)
@@ -713,6 +742,44 @@ reap_some (void)
update_proc (pid);
}
@ -2531,7 +2545,7 @@ diff -urNp coreutils-8.0-orig/src/sort.c coreutils-8.0/src/sort.c
/* Clean up any remaining temporary files. */
static void
@@ -1093,7 +1162,7 @@ zaptemp (const char *name)
@@ -1094,7 +1161,7 @@ zaptemp (const char *name)
free (node);
}
@ -2540,7 +2554,7 @@ diff -urNp coreutils-8.0-orig/src/sort.c coreutils-8.0/src/sort.c
static int
struct_month_cmp (const void *m1, const void *m2)
@@ -1108,7 +1177,7 @@ struct_month_cmp (const void *m1, const
@@ -1109,7 +1176,7 @@ struct_month_cmp (const void *m1, const void *m2)
/* Initialize the character class tables. */
static void
@ -2549,7 +2563,7 @@ diff -urNp coreutils-8.0-orig/src/sort.c coreutils-8.0/src/sort.c
{
size_t i;
@@ -1120,7 +1189,7 @@ inittables (void)
@@ -1121,7 +1188,7 @@ inittables (void)
fold_toupper[i] = toupper (i);
}
@ -2558,7 +2572,7 @@ diff -urNp coreutils-8.0-orig/src/sort.c coreutils-8.0/src/sort.c
/* If we're not in the "C" locale, read different names for months. */
if (hard_LC_TIME)
{
@@ -1202,6 +1271,64 @@ specify_nmerge (int oi, char c, char con
@@ -1203,6 +1270,84 @@ specify_nmerge (int oi, char c, char const *s)
xstrtol_fatal (e, oi, c, long_options, s);
}
@ -2567,12 +2581,25 @@ diff -urNp coreutils-8.0-orig/src/sort.c coreutils-8.0/src/sort.c
+inittables_mb (void)
+{
+ int i, j, k, l;
+ char *name, *s;
+ char *name, *s, *lc_time, *lc_ctype;
+ size_t s_len, mblength;
+ char mbc[MB_LEN_MAX];
+ wchar_t wc, pwc;
+ mbstate_t state_mb, state_wc;
+
+ lc_time = setlocale (LC_TIME, "");
+ if (lc_time)
+ lc_time = xstrdup (lc_time);
+
+ lc_ctype = setlocale (LC_CTYPE, "");
+ if (lc_ctype)
+ lc_ctype = xstrdup (lc_ctype);
+
+ if (lc_time && lc_ctype)
+ /* temporarily set LC_CTYPE to match LC_TIME, so that we can convert
+ * the names of months to upper case */
+ setlocale (LC_CTYPE, lc_time);
+
+ for (i = 0; i < MONTHS_PER_YEAR; i++)
+ {
+ s = (char *) nl_langinfo (ABMON_1 + i);
@ -2617,13 +2644,20 @@ diff -urNp coreutils-8.0-orig/src/sort.c coreutils-8.0/src/sort.c
+ }
+ qsort ((void *) monthtab, MONTHS_PER_YEAR,
+ sizeof (struct month), struct_month_cmp);
+
+ if (lc_time && lc_ctype)
+ /* restore the original locales */
+ setlocale (LC_CTYPE, lc_ctype);
+
+ free (lc_ctype);
+ free (lc_time);
+}
+#endif
+
/* Specify the amount of main memory to use when sorting. */
static void
specify_sort_size (int oi, char c, char const *s)
@@ -1412,7 +1539,7 @@ buffer_linelim (struct buffer const *buf
@@ -1413,7 +1558,7 @@ buffer_linelim (struct buffer const *buf)
by KEY in LINE. */
static char *
@ -2632,7 +2666,7 @@ diff -urNp coreutils-8.0-orig/src/sort.c coreutils-8.0/src/sort.c
{
char *ptr = line->text, *lim = ptr + line->length - 1;
size_t sword = key->sword;
@@ -1421,10 +1548,10 @@ begfield (const struct line *line, const
@@ -1422,10 +1567,10 @@ begfield (const struct line *line, const struct keyfield *key)
/* The leading field separator itself is included in a field when -t
is absent. */
@ -2645,7 +2679,7 @@ diff -urNp coreutils-8.0-orig/src/sort.c coreutils-8.0/src/sort.c
++ptr;
if (ptr < lim)
++ptr;
@@ -1450,11 +1577,70 @@ begfield (const struct line *line, const
@@ -1451,11 +1596,70 @@ begfield (const struct line *line, const struct keyfield *key)
return ptr;
}
@ -2717,7 +2751,7 @@ diff -urNp coreutils-8.0-orig/src/sort.c coreutils-8.0/src/sort.c
{
char *ptr = line->text, *lim = ptr + line->length - 1;
size_t eword = key->eword, echar = key->echar;
@@ -1469,10 +1655,10 @@ limfield (const struct line *line, const
@@ -1470,10 +1674,10 @@ limfield (const struct line *line, const struct keyfield *key)
`beginning' is the first character following the delimiting TAB.
Otherwise, leave PTR pointing at the first `blank' character after
the preceding field. */
@ -2730,7 +2764,7 @@ diff -urNp coreutils-8.0-orig/src/sort.c coreutils-8.0/src/sort.c
++ptr;
if (ptr < lim && (eword || echar))
++ptr;
@@ -1518,10 +1704,10 @@ limfield (const struct line *line, const
@@ -1519,10 +1723,10 @@ limfield (const struct line *line, const struct keyfield *key)
*/
/* Make LIM point to the end of (one byte past) the current field. */
@ -2743,7 +2777,7 @@ diff -urNp coreutils-8.0-orig/src/sort.c coreutils-8.0/src/sort.c
if (newlim)
lim = newlim;
}
@@ -1552,6 +1738,113 @@ limfield (const struct line *line, const
@@ -1553,6 +1757,113 @@ limfield (const struct line *line, const struct keyfield *key)
return ptr;
}
@ -2857,7 +2891,7 @@ diff -urNp coreutils-8.0-orig/src/sort.c coreutils-8.0/src/sort.c
/* Fill BUF reading from FP, moving buf->left bytes from the end
of buf->buf to the beginning first. If EOF is reached and the
file wasn't terminated by a newline, supply one. Set up BUF's line
@@ -1634,8 +1927,24 @@ fillbuf (struct buffer *buf, FILE *fp, c
@@ -1635,8 +1946,24 @@ fillbuf (struct buffer *buf, FILE *fp, char const *file)
else
{
if (key->skipsblanks)
@ -2884,7 +2918,7 @@ diff -urNp coreutils-8.0-orig/src/sort.c coreutils-8.0/src/sort.c
line->keybeg = line_start;
}
}
@@ -1673,7 +1982,7 @@ fillbuf (struct buffer *buf, FILE *fp, c
@@ -1674,7 +2001,7 @@ fillbuf (struct buffer *buf, FILE *fp, char const *file)
hideously fast. */
static int
@ -2893,7 +2927,7 @@ diff -urNp coreutils-8.0-orig/src/sort.c coreutils-8.0/src/sort.c
{
while (blanks[to_uchar (*a)])
a++;
@@ -1782,6 +2091,25 @@ human_numcompare (const char *a, const c
@@ -1783,6 +2110,25 @@ human_numcompare (const char *a, const char *b, struct keyfield *key)
: strnumcmp (a, b, decimal_point, thousands_sep));
}
@ -2919,7 +2953,7 @@ diff -urNp coreutils-8.0-orig/src/sort.c coreutils-8.0/src/sort.c
static int
general_numcompare (const char *sa, const char *sb)
{
@@ -1815,7 +2143,7 @@ general_numcompare (const char *sa, cons
@@ -1816,7 +2162,7 @@ general_numcompare (const char *sa, const char *sb)
Return 0 if the name in S is not recognized. */
static int
@ -2928,7 +2962,7 @@ diff -urNp coreutils-8.0-orig/src/sort.c coreutils-8.0/src/sort.c
{
size_t lo = 0;
size_t hi = MONTHS_PER_YEAR;
@@ -1996,11 +2324,79 @@ compare_version (char *restrict texta, s
@@ -1997,11 +2343,80 @@ compare_version (char *restrict texta, size_t lena,
return diff;
}
@ -2965,7 +2999,8 @@ diff -urNp coreutils-8.0-orig/src/sort.c coreutils-8.0/src/sort.c
+ memset (&state, '\0', sizeof(mbstate_t));
+
+ wclength = mbsrtowcs (month_wcs, pp, len + 1, &state);
+ assert (wclength != (size_t)-1 && *pp == NULL);
+ if (wclength == (size_t)-1 || *pp != NULL)
+ error (SORT_FAILURE, 0, _("Invalid multibyte input %s."), quote(s));
+
+ for (i = 0; i < wclength; i++)
+ {
@ -3009,7 +3044,7 @@ diff -urNp coreutils-8.0-orig/src/sort.c coreutils-8.0/src/sort.c
{
struct keyfield *key = keylist;
@@ -2180,6 +2576,179 @@ keycompare (const struct line *a, const
@@ -2181,6 +2596,179 @@ keycompare (const struct line *a, const struct line *b)
return key->reverse ? -diff : diff;
}
@ -3189,7 +3224,7 @@ diff -urNp coreutils-8.0-orig/src/sort.c coreutils-8.0/src/sort.c
/* Compare two lines A and B, returning negative, zero, or positive
depending on whether A compares less than, equal to, or greater than B. */
@@ -3178,7 +3747,7 @@ main (int argc, char **argv)
@@ -3179,7 +3767,7 @@ main (int argc, char **argv)
initialize_exit_failure (SORT_FAILURE);
hard_LC_COLLATE = hard_locale (LC_COLLATE);
@ -3198,7 +3233,7 @@ diff -urNp coreutils-8.0-orig/src/sort.c coreutils-8.0/src/sort.c
hard_LC_TIME = hard_locale (LC_TIME);
#endif
@@ -3199,6 +3768,27 @@ main (int argc, char **argv)
@@ -3200,6 +3788,27 @@ main (int argc, char **argv)
thousands_sep = -1;
}
@ -3226,7 +3261,7 @@ diff -urNp coreutils-8.0-orig/src/sort.c coreutils-8.0/src/sort.c
have_read_stdin = false;
inittables ();
@@ -3459,13 +4049,35 @@ main (int argc, char **argv)
@@ -3461,13 +4070,35 @@ main (int argc, char **argv)
case 't':
{
@ -3266,7 +3301,7 @@ diff -urNp coreutils-8.0-orig/src/sort.c coreutils-8.0/src/sort.c
else
{
/* Provoke with `sort -txx'. Complain about
@@ -3476,9 +4088,12 @@ main (int argc, char **argv)
@@ -3478,9 +4109,12 @@ main (int argc, char **argv)
quote (optarg));
}
}

View File

@ -1,12 +1,14 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.4
Release: 5%{?dist}
Release: 10%{?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.xz
#updated danish translation for 8.4 coreutils with correct encoding
Source1: coreutils-8.4.da.po
Source101: coreutils-DIR_COLORS
Source102: coreutils-DIR_COLORS.lightbgcolor
Source103: coreutils-DIR_COLORS.256color
@ -20,6 +22,12 @@ Source203: coreutils-runuser-l.pamd
# From upstream
#"who" doesn't determine user's message status correctly - #454261
Patch1: coreutils-8.4-who-msgstatus.patch
#fix detection of xattr support in configure
Patch2: coreutils-8.4-xattrmodule.patch
#fix double free error in tac (reported in debian bug #594666)
Patch3: coreutils-8.5-tac-doublefree.patch
#fix various case conversion issues in tr(#611274)
Patch4: coreutils-8.5-trcaseconversion.patch
# Our patches
#general patch to workaround koji build system issues
@ -58,6 +66,8 @@ Patch912: coreutils-overflow.patch
Patch915: coreutils-split-pam.patch
#prevent koji build failure with wrong getfacl exit code
Patch916: coreutils-getfacl-exit-code.patch
#compile su with pie flag and RELRO protection
Patch917: coreutils-8.4-su-pie.patch
#SELINUX Patch - implements Redhat changes
#(upstream did some SELinux implementation unlike with RedHat patch)
@ -118,6 +128,9 @@ Libraries for coreutils package.
# From upstream
%patch1 -p1 -b .whomsg
%patch2 -p1 -b .xattr
%patch3 -p1 -b .doublefree
%patch4 -p1 -b .caseconvert
# Our patches
%patch100 -p1 -b .configure
@ -140,12 +153,17 @@ Libraries for coreutils package.
%patch912 -p1 -b .overflow
%patch915 -p1 -b .splitl
%patch916 -p1 -b .getfacl-exit-code
%patch917 -p1 -b .pie
#SELinux
%patch950 -p1 -b .selinux
%patch951 -p1 -b .selinuxman
chmod a+x tests/misc/sort-mb-tests
chmod a+x tests/misc/tr-case-class
#fix bad encoding in danish translations(#615945)
cp -a %{SOURCE1} po/da.po
#fix typos/mistakes in localized documentation(#439410, #440056)
find ./po/ -name "*.p*" | xargs \
@ -204,15 +222,15 @@ bzip2 -9f ChangeLog
# let be compatible with old fileutils, sh-utils and textutils packages :
mkdir -p $RPM_BUILD_ROOT{/bin,%_bindir,%_sbindir,/sbin}
%{?!nopam:mkdir -p $RPM_BUILD_ROOT%_sysconfdir/pam.d}
for f in arch 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
for f in arch basename cat chgrp chmod chown cp cut date dd df echo env false link ln ls mkdir mknod mktemp mv nice pwd readlink rm rmdir sleep sort stty sync touch true uname unlink
do
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
for i in env cut; do ln -sf ../../bin/$i $RPM_BUILD_ROOT/usr/bin; done
# {env,cut,readlink} were previously moved from /usr/bin to /bin and linked into
for i in env cut readlink; do ln -sf ../../bin/$i $RPM_BUILD_ROOT/usr/bin; done
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
install -p -c -m644 %SOURCE101 $RPM_BUILD_ROOT%{_sysconfdir}/DIR_COLORS
@ -314,6 +332,7 @@ fi
/bin/mv
/bin/nice
/bin/pwd
/bin/readlink
/bin/rm
/bin/rmdir
/bin/sleep
@ -337,6 +356,35 @@ fi
%{_libdir}/coreutils
%changelog
* Wed Nov 03 2010 Kamil Dudka <kdudka@redhat.com> - 8.4-10
- prevent sort from assertion failure in case LC_CTYPE does not match LC_TIME
(#647938)
* Fri Oct 01 2010 Ondrej Vasik <ovasik@redhat.com> - 8.4-9
- various fixes for case conversion in tr(#611274)
- change assertion failure for invalid multibyte input
in sort to less confusing error message(#591352)
- add RELRO protection to su as well (#630017)
- compile su with pie again (#630017)
- fix double free abort in tac (#628213)
- Add .ear, .war, .sar , for Java jar-like archives to
dircolors (#616497)
* Tue Jul 20 2010 Ondrej Vasik <ovasik@redhat.com> - 8.4-8
- fix danish translation file encoding(#615945)
* Mon Jun 14 2010 Ondrej Vasik <ovasik@redhat.com> - 8.4-7
- compile coreutils with SELinux support again(#603359)
* Wed Apr 28 2010 Ondrej Vasik <ovasik@redhat.com> - 8.4-6
- doublequote LS_COLORS in colorls.*sh scripts to speedup
shell start(#586029)
- update /etc/DIR_COLORS* files
- move readlink from /usr/bin to bin, keep symlink in
/usr/bin(#580682)
- run tput colors in colorls profile.d scripts only
in the interactive mode(#450424)
* Fri Feb 12 2010 Ondrej Vasik <ovasik@redhat.com> - 8.4-5
- fix exit status of terminated child processes in su with
pam(#559098)

View File

@ -1 +1,2 @@
1fde97f144b4699b18f36c2ec18b1f18 coreutils-8.4.tar.xz
39bf597eb0d94adddce919e0b0f41b88 coreutils-8.4.da.po