diff --git a/.cvsignore b/.gitignore similarity index 100% rename from .cvsignore rename to .gitignore diff --git a/Makefile b/Makefile deleted file mode 100644 index 00f96eb..0000000 --- a/Makefile +++ /dev/null @@ -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) diff --git a/coreutils-6.12-sort-endoffields.patch b/coreutils-6.12-sort-endoffields.patch new file mode 100644 index 0000000..1f841af --- /dev/null +++ b/coreutils-6.12-sort-endoffields.patch @@ -0,0 +1,117 @@ +diff -urNp coreutils-6.12-orig/src/sort.c coreutils-6.12/src/sort.c +--- coreutils-6.12-orig/src/sort.c 2009-02-26 16:01:04.000000000 +0100 ++++ coreutils-6.12/src/sort.c 2009-02-26 16:24:27.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.12-orig/tests/misc/sort coreutils-6.12/tests/misc/sort +--- coreutils-6.12-orig/tests/misc/sort 2008-05-17 08:41:12.000000000 +0200 ++++ coreutils-6.12/tests/misc/sort 2009-02-26 16:25:39.000000000 +0100 +@@ -24,6 +24,10 @@ my $prog = 'sort'; + # Turn off localization of executable's output. + @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; + ++my $mb_locale = $ENV{LOCALE_FR_UTF8}; ++! defined $mb_locale || $mb_locale eq 'none' ++ and $mb_locale = 'C'; ++ + # Since each test is run with a file name and with redirected stdin, + # the name in the diagnostic is either the file name or "-". + # Normalize each diagnostic to use '-'. +@@ -108,6 +114,8 @@ my @Tests = + ["07b", '-k 2,3', {IN=>"a a b\nz a a\n"}, {OUT=>"z a a\na a b\n"}], + ["07c", '-k 2,3', {IN=>"y k b\nz k a\n"}, {OUT=>"z k a\ny k b\n"}], + ["07d", '+1 -3', {IN=>"y k b\nz k a\n"}, {OUT=>"z k a\ny k b\n"}], ++#ensure a character position of 0 includes whole field ++["07e", '-k 2,3.0', {IN=>"a a b\nz a a\n"}, {OUT=>"z a a\na a b\n"}], + # + # report an error for `.' without following char spec + ["08a", '-k 2.,3', {EXIT=>2}, +@@ -208,6 +216,15 @@ my @Tests = + # key start and key end. + ["18e", '-nb -k1.1,1.2', {IN=>" 901\n100\n"}, {OUT=>"100\n 901\n"}], + ++# When ignoring leading blanks for end position, ensure blanks from ++# next field are not included in the sort. I.E. order should not change here. ++["18f", '-k1,1b', {IN=>"a y\na z\n"}, {OUT=>"a y\na z\n"}], ++ ++# When ignoring leading blanks for start position, ensure blanks from ++# next field are not included in the sort. I.E. order should not change here. ++# This was noticed as an issue on fedora 8 (only in multibyte locales). ++["18g", '-k1b,1', {IN=>"a y\na z\n"}, {OUT=>"a y\na z\n"}, ++ {ENV => "LC_ALL=$mb_locale"}], + # This looks odd, but works properly -- 2nd keyspec is never + # used because all lines are different. + ["19a", '+0 +1nr', {IN=>"b 2\nb 1\nb 3\n"}, {OUT=>"b 1\nb 2\nb 3\n"}], diff --git a/coreutils-i18n.patch b/coreutils-i18n.patch index 2f48694..c70aa2a 100644 --- a/coreutils-i18n.patch +++ b/coreutils-i18n.patch @@ -1919,7 +1919,7 @@ diff -urNp coreutils-6.11-orig/src/join.c coreutils-6.11/src/join.c if (newlim) lim = newlim; } -@@ -1384,6 +1570,107 @@ +@@ -1384,6 +1570,113 @@ return ptr; } @@ -1931,7 +1931,10 @@ diff -urNp coreutils-6.11-orig/src/join.c coreutils-6.11/src/join.c + size_t eword = key->eword, echar = key->echar; + int i; + size_t mblength; ++ + mbstate_t state; ++ if (echar == 0) ++ eword++; /* skip all of end field. */ + + memset (&state, '\0', sizeof(mbstate_t)); + @@ -2001,24 +2004,27 @@ diff -urNp coreutils-6.11-orig/src/join.c coreutils-6.11/src/join.c + } +# 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; +} diff --git a/coreutils-selinux.patch b/coreutils-selinux.patch index 56b17f8..7dd868b 100644 --- a/coreutils-selinux.patch +++ b/coreutils-selinux.patch @@ -442,7 +442,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) +@@ -1169,7 +1175,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 +@@ -1219,7 +1226,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 @@ -451,7 +470,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 @@ -460,7 +479,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; @@ -469,7 +488,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': @@ -498,7 +517,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); @@ -511,7 +530,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; @@ -519,7 +538,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c if (command_line_arg || format_needs_stat -@@ -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; @@ -528,7 +547,7 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c { 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 f->scontext = xstrdup ("unlabeled"); } @@ -539,16 +558,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) +@@ -2741,7 +2767,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; +@@ -2761,7 +2787,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. */ +@@ -2800,7 +2826,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'); } @@ -562,7 +608,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); } @@ -571,7 +617,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); @@ -588,7 +634,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); @@ -598,7 +644,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)); @@ -608,7 +654,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); @@ -618,7 +664,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\ @@ -636,7 +682,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); } diff --git a/coreutils.spec b/coreutils.spec index 1ede2a4..5976065 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,7 +1,7 @@ Summary: The GNU core utilities: a set of tools commonly used in shell scripts Name: coreutils Version: 6.12 -Release: 17%{?dist} +Release: 20%{?dist} License: GPLv3+ Group: System Environment/Base Url: http://www.gnu.org/software/coreutils/ @@ -25,6 +25,7 @@ Patch4: coreutils-6.12-date_timerelsnumber.patch Patch5: coreutils-6.12-seqdecimalutf8.patch Patch6: coreutils-6.12-catch-known-testsuite-failures.patch Patch7: coreutils-446294-lsexitstatuses.patch +Patch8: coreutils-6.12-sort-endoffields.patch # Our patches Patch100: coreutils-6.10-configuration.patch @@ -77,6 +78,9 @@ BuildRequires: libcap-devel >= 2.0.6 Requires(post): libselinux >= 1.25.6-1 Requires: libattr +#util-linux-ng requirement is here only to prevent /bin/arch conflict +#(could be removed after F-11/F-12 split, no idea how to solve it better) +Requires: util-linux-ng >= 2.14 Requires(pre): /sbin/install-info Requires(preun): /sbin/install-info Requires(post): /sbin/install-info @@ -117,6 +121,7 @@ the old GNU fileutils, sh-utils, and textutils packages. %patch5 -p1 -b .sequtf8 %patch6 -p1 -b .tests %patch7 -p1 -b .lsexit +%patch8 -p1 -b .endfields # Our patches %patch100 -p1 -b .configure @@ -159,19 +164,17 @@ chmod a+x tests/misc/utimensat-touchcp 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 # Build at -O1 for the moment (bug #196369). -export CFLAGS="$RPM_OPT_FLAGS -fPIC -O1" +export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -fPIC -O1" %else -export CFLAGS="$RPM_OPT_FLAGS -fpic" +export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -fpic" %endif %{expand:%%global optflags %{optflags} -D_GNU_SOURCE=1} touch aclocal.m4 configure config.hin Makefile.in */Makefile.in @@ -339,6 +342,21 @@ fi /sbin/runuser %changelog +* Mon Mar 02 2009 Ondrej Vasik - 6.12-20 +- fix sort bugs (including #485715) for multibyte locales + as well + +* Thu Feb 26 2009 Ondrej Vasik - 6.12-19 +- 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) + +* Fri Nov 21 2008 Ondrej Vasik - 6.12-18 +- added requirements for util-linux-ng >= 2.14 + because of file conflict in update from F-8/F-9(#472445) +- some sed cleanup + * Mon Nov 03 2008 Ondrej Vasik - 6.12-17 - Requires: ncurses (#469277)