diff --git a/.coreutils.metadata b/.coreutils.metadata index 6d8c890..c2489a3 100644 --- a/.coreutils.metadata +++ b/.coreutils.metadata @@ -1 +1 @@ -3fba93c72fab62f3742fe50957d3a86d4cd08176 SOURCES/coreutils-8.21.tar.xz +cc7fe47b21eb49dd2ee4cdb707570f42fb2c8cc6 SOURCES/coreutils-8.22.tar.xz diff --git a/SOURCES/coreutils-6.10-configuration.patch b/SOURCES/coreutils-6.10-configuration.patch index b4d7b4a..54df1d6 100644 --- a/SOURCES/coreutils-6.10-configuration.patch +++ b/SOURCES/coreutils-6.10-configuration.patch @@ -115,11 +115,11 @@ diff -urNp coreutils-8.21-orig/gnulib-tests/gnulib.mk coreutils-8.21/gnulib-test -TESTS += test-utimens -check_PROGRAMS += test-utimens --test_utimens_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) @LIBINTL@ +-test_utimens_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_NANOSLEEP) @LIBINTL@ -EXTRA_DIST += nap.h test-futimens.h test-lutimens.h test-utimens.h test-utimens-common.h test-utimens.c macros.h +#TESTS += test-utimens +#check_PROGRAMS += test-utimens -+#test_utimens_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) @LIBINTL@ ++#test_utimens_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_NANOSLEEP) @LIBINTL@ +#EXTRA_DIST += nap.h test-futimens.h test-lutimens.h test-utimens.h test-utimens-common.h test-utimens.c macros.h ## end gnulib module utimens-tests @@ -136,8 +136,8 @@ diff -urNp coreutils-8.21-orig/tests/local.mk coreutils-8.21/tests/local.mk tests/touch/now-owned-by-other.sh @@ -163,7 +164,6 @@ all_tests = \ - tests/rm/cycle.sh \ tests/cp/link-heap.sh \ + tests/cp/no-ctx.sh \ tests/misc/tty-eof.pl \ - tests/tail-2/inotify-hash-abuse.sh \ tests/tail-2/inotify-hash-abuse2.sh \ diff --git a/SOURCES/coreutils-6.10-manpages.patch b/SOURCES/coreutils-6.10-manpages.patch index 2c663f9..3f5d37b 100644 --- a/SOURCES/coreutils-6.10-manpages.patch +++ b/SOURCES/coreutils-6.10-manpages.patch @@ -10,4 +10,4 @@ diff -urNp coreutils-6.12-orig/src/md5sum.c coreutils-6.12/src/md5sum.c +"), stdout); fputs (_("\ \n\ - The following three options are useful only when verifying checksums:\n\ + The following four options are useful only when verifying checksums:\n\ diff --git a/SOURCES/coreutils-8.21-install-strip.patch b/SOURCES/coreutils-8.21-install-strip.patch deleted file mode 100644 index 1d6f198..0000000 --- a/SOURCES/coreutils-8.21-install-strip.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 3a20f6888575be7059e9acac07d397009e98c213 Mon Sep 17 00:00:00 2001 -From: Ondrej Oprala -Date: Fri, 22 Feb 2013 12:48:57 +0000 -Subject: install: cleanup properly if the strip program failed for any reason - -* src/install.c (strip): Indicate failure with a return code instead -of terminating the program. -(install_file_in_file): Handle strip's return code and unlink the -created file if necessary. -* tests/install/strip-program.sh: Add a test to cover the changes. ---- -diff --git a/src/install.c b/src/install.c -index 94374df..a5ed7a8 100644 ---- a/src/install.c -+++ b/src/install.c -@@ -515,16 +515,17 @@ change_timestamps (struct stat const *src_sb, char const *dest) - magic numbers vary so much from system to system that making - it portable would be very difficult. Not worth the effort. */ - --static void -+static bool - strip (char const *name) - { - int status; -+ bool ok = false; - pid_t pid = fork (); - - switch (pid) - { - case -1: -- error (EXIT_FAILURE, errno, _("fork system call failed")); -+ error (0, errno, _("fork system call failed")); - break; - case 0: /* Child. */ - execlp (strip_program, strip_program, name, NULL); -@@ -532,11 +533,14 @@ strip (char const *name) - break; - default: /* Parent. */ - if (waitpid (pid, &status, 0) < 0) -- error (EXIT_FAILURE, errno, _("waiting for strip")); -+ error (0, errno, _("waiting for strip")); - else if (! WIFEXITED (status) || WEXITSTATUS (status)) -- error (EXIT_FAILURE, 0, _("strip process terminated abnormally")); -+ error (0, 0, _("strip process terminated abnormally")); -+ else -+ ok = true; /* strip succeeded */ - break; - } -+ return ok; - } - - /* Initialize the user and group ownership of the files to install. */ -@@ -681,7 +685,12 @@ install_file_in_file (const char *from, const char *to, - if (! copy_file (from, to, x)) - return false; - if (strip_files) -- strip (to); -+ if (! strip (to)) -+ { -+ if (unlink (to) != 0) /* Cleanup. */ -+ error (EXIT_FAILURE, errno, _("cannot unlink %s"), to); -+ return false; -+ } - if (x->preserve_timestamps && (strip_files || ! S_ISREG (from_sb.st_mode)) - && ! change_timestamps (&from_sb, to)) - return false; -diff --git a/tests/install/strip-program.sh b/tests/install/strip-program.sh -index 8950d50..5d65373 100755 ---- a/tests/install/strip-program.sh -+++ b/tests/install/strip-program.sh -@@ -33,4 +33,8 @@ echo aBc > exp || fail=1 - ginstall src dest -s --strip-program=./b || fail=1 - compare exp dest || fail=1 - -+# Check that install cleans up properly if strip fails. -+ginstall src dest2 -s --strip-program=./FOO && fail=1 -+test -e dest2 && fail=1 -+ - Exit $fail --- -cgit v0.9.0.2 diff --git a/SOURCES/coreutils-8.22-cp-selinux.patch b/SOURCES/coreutils-8.22-cp-selinux.patch new file mode 100644 index 0000000..ed3fb47 --- /dev/null +++ b/SOURCES/coreutils-8.22-cp-selinux.patch @@ -0,0 +1,109 @@ +From 2b3b5bfcd5f4161d17c0bc3d43f6edcfc4a2b294 Mon Sep 17 00:00:00 2001 +From: Nicolas Looss +Date: Sat, 4 Jan 2014 03:03:51 +0000 +Subject: [PATCH] copy: fix a segfault in SELinux context copying code + +* src/selinux.c (restorecon_private): On ArchLinux the +`fakeroot cp -a file1 file2` command segfaulted due +to getfscreatecon() returning a NULL context. +So map this to the sometimes ignored ENODATA error, +rather than crashing. +* tests/cp/no-ctx.sh: Add a new test case. +* tests/local.mk: Reference the new test. +--- + src/selinux.c | 5 ++++ + tests/cp/no-ctx.sh | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + tests/local.mk | 1 + + 3 files changed, 59 insertions(+), 0 deletions(-) + create mode 100755 tests/cp/no-ctx.sh + +diff --git a/src/selinux.c b/src/selinux.c +index cd38a81..016db16 100644 +--- a/src/selinux.c ++++ b/src/selinux.c +@@ -192,6 +192,11 @@ restorecon_private (char const *path, bool local) + { + if (getfscreatecon (&tcon) < 0) + return rc; ++ if (!tcon) ++ { ++ errno = ENODATA; ++ return rc; ++ } + rc = lsetfilecon (path, tcon); + freecon (tcon); + return rc; +diff --git a/tests/cp/no-ctx.sh b/tests/cp/no-ctx.sh +new file mode 100755 +index 0000000..59d30de +--- /dev/null ++++ b/tests/cp/no-ctx.sh +@@ -0,0 +1,53 @@ ++#!/bin/sh ++# Ensure we handle file systems returning no SELinux context, ++# which triggered a segmentation fault in coreutils-8.22. ++# This test is skipped on systems that lack LD_PRELOAD support; that's fine. ++# Similarly, on a system that lacks lgetfilecon altogether, skipping it is fine. ++ ++# Copyright (C) 2014 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 . ++ ++. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src ++print_ver_ cp ++require_gcc_shared_ ++ ++# Replace each getfilecon and lgetfilecon call with a call to these stubs. ++cat > k.c <<'EOF' || skip_ ++#include ++#include ++ ++int getfilecon (const char *path, security_context_t *con) ++{ errno=ENODATA; return -1; } ++int lgetfilecon (const char *path, security_context_t *con) ++{ errno=ENODATA; return -1; } ++EOF ++ ++# Then compile/link it: ++$CC -shared -fPIC -O2 k.c -o k.so \ ++ || skip_ 'failed to build SELinux shared library' ++ ++touch file_src ++ ++# New file with SELinux context optionally included ++LD_PRELOAD=./k.so cp -a file_src file_dst || fail=1 ++ ++# Existing file with SELinux context optionally included ++LD_PRELOAD=./k.so cp -a file_src file_dst || fail=1 ++ ++# ENODATA should give an immediate error when required to preserve ctx ++# This is debatable, and maybe we should not fail when no context available? ++LD_PRELOAD=./k.so cp --preserve=context file_src file_dst && fail=1 ++ ++Exit $fail +diff --git a/tests/local.mk b/tests/local.mk +index dc7341c..9d556f6 100644 +--- a/tests/local.mk ++++ b/tests/local.mk +@@ -161,6 +161,7 @@ all_tests = \ + tests/rm/ext3-perf.sh \ + tests/rm/cycle.sh \ + tests/cp/link-heap.sh \ ++ tests/cp/no-ctx.sh \ + tests/misc/tty-eof.pl \ + tests/tail-2/inotify-hash-abuse.sh \ + tests/tail-2/inotify-hash-abuse2.sh \ +-- +1.7.7.6 + diff --git a/SOURCES/coreutils-8.22-temporarytestoff.patch b/SOURCES/coreutils-8.22-temporarytestoff.patch new file mode 100644 index 0000000..c95343b --- /dev/null +++ b/SOURCES/coreutils-8.22-temporarytestoff.patch @@ -0,0 +1,13 @@ +diff -urNp coreutils-8.22-orig/tests/df/df-symlink.sh coreutils-8.22/tests/df/df-symlink.sh +--- coreutils-8.22-orig/tests/df/df-symlink.sh 2013-12-04 15:48:30.000000000 +0100 ++++ coreutils-8.22/tests/df/df-symlink.sh 2013-12-14 18:20:15.822594995 +0100 +@@ -18,6 +18,9 @@ + + . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src + print_ver_ df ++#df doesn't work correctly on symlinks when on LVM/LUKS filesystem, therefore ++#marking expensive_ to disable by default ++expensive_ + + disk=$(df --out=source '.' | tail -n1) || + skip_ "cannot determine '.' file system" diff --git a/SOURCES/coreutils-DIR_COLORS b/SOURCES/coreutils-DIR_COLORS index 304463a..6abc937 100644 --- a/SOURCES/coreutils-DIR_COLORS +++ b/SOURCES/coreutils-DIR_COLORS @@ -44,6 +44,7 @@ TERM linux-c TERM mach-color TERM mlterm TERM putty +TERM putty-256color TERM rxvt TERM rxvt-256color TERM rxvt-cygwin @@ -56,8 +57,11 @@ TERM screen-256color TERM screen-256color-bce TERM screen-bce TERM screen-w +TERM screen.Eterm TERM screen.rxvt TERM screen.linux +TERM st +TERM st-256color TERM terminator TERM vt100 TERM xterm @@ -121,6 +125,7 @@ EXEC 01;32 .arj 01;31 .taz 01;31 .lha 01;31 +.lz4 01;31 .lzh 01;31 .lzma 01;31 .tlz 01;31 @@ -179,6 +184,7 @@ EXEC 01;32 .mpeg 01;35 .m2v 01;35 .mkv 01;35 +.webm 01;35 .ogm 01;35 .mp4 01;35 .m4v 01;35 diff --git a/SOURCES/coreutils-DIR_COLORS.256color b/SOURCES/coreutils-DIR_COLORS.256color index 2d2a530..4efaca1 100644 --- a/SOURCES/coreutils-DIR_COLORS.256color +++ b/SOURCES/coreutils-DIR_COLORS.256color @@ -28,6 +28,7 @@ TERM rxvt-unicode256 TERM screen-256color TERM xterm-256color TERM gnome-256color +TERM st-256color # EIGHTBIT, followed by '1' for on, '0' for off. (8-bit output) EIGHTBIT 1 @@ -94,6 +95,7 @@ EXEC 38;5;34 .arj 38;5;9 .taz 38;5;9 .lha 38;5;9 +.lz4 38;5;9 .lzh 38;5;9 .lzma 38;5;9 .tlz 38;5;9 @@ -152,6 +154,7 @@ EXEC 38;5;34 .mpeg 38;5;13 .m2v 38;5;13 .mkv 38;5;13 +.webm 38;5;13 .ogm 38;5;13 .mp4 38;5;13 .m4v 38;5;13 diff --git a/SOURCES/coreutils-DIR_COLORS.lightbgcolor b/SOURCES/coreutils-DIR_COLORS.lightbgcolor index efb5163..43820b2 100644 --- a/SOURCES/coreutils-DIR_COLORS.lightbgcolor +++ b/SOURCES/coreutils-DIR_COLORS.lightbgcolor @@ -98,6 +98,7 @@ EXEC 00;32 .arj 00;31 .taz 00;31 .lha 00;31 +.lz4 00;31 .lzh 00;31 .lzma 00;31 .tlz 00;31 @@ -156,6 +157,7 @@ EXEC 00;32 .mpeg 00;35 .m2v 00;35 .mkv 00;35 +.webm 00;35 .ogm 00;35 .mp4 00;35 .m4v 00;35 diff --git a/SOURCES/coreutils-aarch64-longlong.patch b/SOURCES/coreutils-aarch64-longlong.patch deleted file mode 100644 index 323759b..0000000 --- a/SOURCES/coreutils-aarch64-longlong.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff --git a/src/longlong.h b/src/longlong.h -index e880587..023f47e 100644 ---- a/src/longlong.h -+++ b/src/longlong.h -@@ -530,23 +530,16 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype); - #endif /* __arm__ */ - - #if defined (__aarch64__) && W_TYPE_SIZE == 64 -+/* FIXME: Extend the immediate range for the low word by using both -+ ADDS and SUBS, since they set carry in the same way. */ - #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ -- __asm__ ("adds\t%1, %4, %5\n\tadc\t%0, %2, %3" \ -+ __asm__ ("adds\t%1, %x4, %5\n\tadc\t%0, %x2, %x3" \ - : "=r" (sh), "=&r" (sl) \ -- : "r" (ah), "rZ" (bh), "%r" (al), "rI" (bl) __CLOBBER_CC) -+ : "rZ" (ah), "rZ" (bh), "%r" (al), "rI" (bl) __CLOBBER_CC) - #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ -- do { \ -- if (__builtin_constant_p (bl)) \ -- { \ -- __asm__ ("subs\t%1, %4, %5\n\tsbc\t%0, %2, %3" \ -- : "=r" (sh), "=&r" (sl) \ -- : "r" (ah), "r" (bh), "r" (al), "rI" (bl) __CLOBBER_CC); \ -- } \ -- else /* only bh might be a constant */ \ -- __asm__ ("subs\t%1, %4, %5\n\tsbc\t%0, %2, %3" \ -- : "=r" (sh), "=&r" (sl) \ -- : "r" (ah), "rZ" (bh), "r" (al), "rI" (bl) __CLOBBER_CC);\ -- } while (0) -+ __asm__ ("subs\t%1, %x4, %5\n\tsbc\t%0, %x2, %x3" \ -+ : "=r,r" (sh), "=&r,&r" (sl) \ -+ : "rZ,rZ" (ah), "rZ,rZ" (bh), "r,Z" (al), "rI,r" (bl) __CLOBBER_CC) - #define umul_ppmm(ph, pl, m0, m1) \ - do { \ - UDItype __m0 = (m0), __m1 = (m1); \ diff --git a/SOURCES/coreutils-colorls.csh b/SOURCES/coreutils-colorls.csh index d02fe85..5ed0f68 100755 --- a/SOURCES/coreutils-colorls.csh +++ b/SOURCES/coreutils-colorls.csh @@ -1,3 +1,6 @@ +# skip everything for non-interactive shells +if (! $?prompt) exit + # color-ls initialization if ( $?USER_LS_COLORS ) then if ( "$USER_LS_COLORS" != "" ) then @@ -33,7 +36,7 @@ if ( ! -e "$COLORS" ) exit set _tmp="`mktemp .colorlsXXX --tmpdir=/tmp`" -if ( "$INCLUDE" != '' ) cat "$INCLUDE" > $_tmp +if ( "$INCLUDE" != '' ) cat "$INCLUDE" >> $_tmp grep -v '^INCLUDE' "$COLORS" >> $_tmp eval "`dircolors -c $_tmp`" @@ -48,6 +51,8 @@ if ( "$color_none" != '' ) then endif unset color_none unset _tmp +unset INCLUDE +unset COLORS finish: alias ll 'ls -l --color=auto' diff --git a/SOURCES/coreutils-colorls.sh b/SOURCES/coreutils-colorls.sh index 7d27940..1308da9 100755 --- a/SOURCES/coreutils-colorls.sh +++ b/SOURCES/coreutils-colorls.sh @@ -1,15 +1,14 @@ # color-ls initialization +# Skip all for noninteractive shells. +[ -z "$PS1" ] && return + #when USER_LS_COLORS defined do not override user LS_COLORS, but use them. if [ -z "$USER_LS_COLORS" ]; then alias ll='ls -l' 2>/dev/null alias l.='ls -d .*' 2>/dev/null - - # Skip the rest for noninteractive shells. - [ -z "$PS1" ] && return - INCLUDE= COLORS= @@ -35,7 +34,7 @@ if [ -z "$USER_LS_COLORS" ]; then TMP="`mktemp .colorlsXXX --tmpdir=/tmp`" - [ -e "$INCLUDE" ] && cat "$INCLUDE" > $TMP + [ -e "$INCLUDE" ] && cat "$INCLUDE" >> $TMP grep -v '^INCLUDE' "$COLORS" >> $TMP eval "`dircolors --sh $TMP 2>/dev/null`" @@ -46,6 +45,8 @@ if [ -z "$USER_LS_COLORS" ]; then grep -qi "^COLOR.*none" $COLORS >/dev/null 2>/dev/null && return fi +unset TMP COLORS INCLUDE + alias ll='ls -l --color=auto' 2>/dev/null alias l.='ls -d .* --color=auto' 2>/dev/null alias ls='ls --color=auto' 2>/dev/null diff --git a/SOURCES/coreutils-cp-nopreserve-invalidargs.patch b/SOURCES/coreutils-cp-nopreserve-invalidargs.patch deleted file mode 100644 index 5933b91..0000000 --- a/SOURCES/coreutils-cp-nopreserve-invalidargs.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 124ab798e65b6c95a8486f6f6af9bdf69b11e1bf Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= -Date: Fri, 11 Oct 2013 14:44:53 +0200 -Subject: [PATCH] cp: correct error message for invalid arguments of '--no-preserve' - -* src/cp.c (decode_preserve_arg) : -Correct error message for invalid arguments of '--no-preserve'. -Reported by M.Vadkerti in rhbz #1018206 ---- - src/cp.c | 3 ++- - 1 files changed, 2 insertions(+), 1 deletions(-) - -diff --git a/src/cp.c b/src/cp.c -index e235b32..7bc8630 100644 ---- a/src/cp.c -+++ b/src/cp.c -@@ -854,7 +854,8 @@ decode_preserve_arg (char const *arg, struct cp_options *x, bool on_off) - *comma++ = 0; - - /* process S. */ -- val = XARGMATCH ("--preserve", s, preserve_args, preserve_vals); -+ val = XARGMATCH (on_off ? "--preserve" : "--no-preserve", -+ s, preserve_args, preserve_vals); - switch (val) - { - case PRESERVE_MODE: --- -1.7.1 - diff --git a/SOURCES/coreutils-cpZ-deprecate.patch b/SOURCES/coreutils-cpZ-deprecate.patch deleted file mode 100644 index 713b7c5..0000000 --- a/SOURCES/coreutils-cpZ-deprecate.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff -urNp coreutils-8.12-orig/src/copy.c coreutils-8.12/src/copy.c ---- coreutils-8.12-orig/src/copy.c 2011-08-11 16:05:15.432485738 +0200 -+++ coreutils-8.12/src/copy.c 2011-08-11 16:14:28.660360607 +0200 -@@ -850,7 +850,7 @@ copy_reg (char const *src_name, char con - 1) the src context may prohibit writing, and - 2) because it's more consistent to use the same context - that is used when the destination file doesn't already exist. */ -- if (x->preserve_security_context && 0 <= dest_desc) -+ if ((x->set_security_context || x->preserve_security_context) && 0 <= dest_desc) - { - bool all_errors = (!x->data_copy_required - || x->require_preserve_context); -diff -urNp coreutils-8.12-orig/src/cp.c coreutils-8.12/src/cp.c ---- coreutils-8.12-orig/src/cp.c 2011-08-11 16:05:15.435486976 +0200 -+++ coreutils-8.12/src/cp.c 2011-08-11 16:16:56.408644526 +0200 -@@ -1119,6 +1119,7 @@ main (int argc, char **argv) - exit( 1 ); - } - x.set_security_context = true; -+ (void) fprintf(stderr, _("Warning, -Z/--context option is deprecated and will be removed soon!\nPlease use 'install' utility instead of cp for this functionality.\n")); - /* if there's a security_context given set new path - components to that context, too */ - if ( setfscreatecon(optarg) < 0 ) { diff --git a/SOURCES/coreutils-df-direct.patch b/SOURCES/coreutils-df-direct.patch index 6cfefc7..a52307a 100644 --- a/SOURCES/coreutils-df-direct.patch +++ b/SOURCES/coreutils-df-direct.patch @@ -29,11 +29,11 @@ diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c static struct fs_usage grand_fsu; @@ -238,13 +241,15 @@ enum + NO_SYNC_OPTION = CHAR_MAX + 1, SYNC_OPTION, TOTAL_OPTION, - OUTPUT_OPTION, -- MEGABYTES_OPTION /* FIXME: remove long opt in Aug 2013 */ -+ MEGABYTES_OPTION, /* FIXME: remove long opt in Aug 2013 */ +- OUTPUT_OPTION ++ OUTPUT_OPTION, + DIRECT_OPTION }; @@ -57,7 +57,7 @@ diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c if (columns[col]->field == SIZE_FIELD && (header_mode == DEFAULT_MODE -@@ -1150,6 +1158,17 @@ get_point (const char *point, const stru +@@ -1150,6 +1158,19 @@ get_point (const char *point, const stru static void get_entry (char const *name, struct stat const *statp) { @@ -66,7 +66,9 @@ diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c + char *resolved = canonicalize_file_name (name); + if (resolved) + { -+ get_dev (NULL, resolved, NULL, NULL, false, false, NULL, false); ++ char *mp = find_mount_point (name, statp); ++ get_dev (NULL, mp, resolved, NULL, NULL, false, false, NULL, false); ++ free(mp); + free (resolved); + return; + } @@ -76,9 +78,9 @@ diff -urNp coreutils-8.21-orig/src/df.c coreutils-8.21/src/df.c && get_disk (name)) return; @@ -1219,6 +1238,7 @@ or all file systems by default.\n\ - -B, --block-size=SIZE scale sizes by SIZE before printing them. E.g.,\n\ - '-BM' prints sizes in units of 1,048,576 bytes.\n\ - See SIZE format below.\n\ + -B, --block-size=SIZE scale sizes by SIZE before printing them; e.g.,\n\ + '-BM' prints sizes in units of 1,048,576 bytes;\n\ + see SIZE format below\n\ + --direct show statistics for a file instead of mount point\n\ --total produce a grand total\n\ -h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)\ diff --git a/SOURCES/coreutils-i18n.patch b/SOURCES/coreutils-i18n.patch index 5f3be7c..20af4da 100644 --- a/SOURCES/coreutils-i18n.patch +++ b/SOURCES/coreutils-i18n.patch @@ -1,6 +1,6 @@ -diff -urNp coreutils-8.21-orig/lib/linebuffer.h coreutils-8.21/lib/linebuffer.h ---- coreutils-8.21-orig/lib/linebuffer.h 2013-01-02 13:34:46.000000000 +0100 -+++ coreutils-8.21/lib/linebuffer.h 2013-02-15 14:25:07.758469108 +0100 +diff -urNp coreutils-8.22-orig/lib/linebuffer.h coreutils-8.22/lib/linebuffer.h +--- coreutils-8.22-orig/lib/linebuffer.h 2013-12-04 15:53:33.000000000 +0100 ++++ coreutils-8.22/lib/linebuffer.h 2013-12-16 17:40:25.933887985 +0100 @@ -21,6 +21,11 @@ # include @@ -23,9 +23,9 @@ diff -urNp coreutils-8.21-orig/lib/linebuffer.h coreutils-8.21/lib/linebuffer.h }; /* Initialize linebuffer LINEBUFFER for use. */ -diff -urNp coreutils-8.21-orig/src/cut.c coreutils-8.21/src/cut.c ---- coreutils-8.21-orig/src/cut.c 2013-02-05 00:40:31.000000000 +0100 -+++ coreutils-8.21/src/cut.c 2013-02-15 14:25:07.760467982 +0100 +diff -urNp coreutils-8.22-orig/src/cut.c coreutils-8.22/src/cut.c +--- coreutils-8.22-orig/src/cut.c 2013-12-04 15:48:30.000000000 +0100 ++++ coreutils-8.22/src/cut.c 2013-12-16 17:40:25.935887295 +0100 @@ -28,6 +28,11 @@ #include #include @@ -57,8 +57,8 @@ diff -urNp coreutils-8.21-orig/src/cut.c coreutils-8.21/src/cut.c /* The official name of this program (e.g., no 'g' prefix). */ #define PROGRAM_NAME "cut" -@@ -72,6 +89,52 @@ - } \ +@@ -53,6 +70,52 @@ + } \ while (0) +/* Refill the buffer BUF to get a multibyte character. */ @@ -107,33 +107,19 @@ diff -urNp coreutils-8.21-orig/src/cut.c coreutils-8.21/src/cut.c + } \ + while (0) + + struct range_pair { - size_t lo; -@@ -90,7 +153,7 @@ static char *field_1_buffer; - /* The number of bytes allocated for FIELD_1_BUFFER. */ - static size_t field_1_bufsize; - --/* The largest field or byte index used as an endpoint of a closed -+/* The largest byte, character or field index used as an endpoint of a closed - or degenerate range specification; this doesn't include the starting - index of right-open-ended ranges. For example, with either range spec - '2-5,9-', '2-3,5,9-' this variable would be set to 5. */ -@@ -102,10 +165,11 @@ static size_t eol_range_start; - - /* This is a bit vector. - In byte mode, which bytes to output. -+ In character mode, which characters to output. - In field mode, which DELIM-separated fields to output. -- Both bytes and fields are numbered starting with 1, -+ Bytes, characters and fields are numbered starting with 1, - so the zeroth bit of this array is unused. -- A field or byte K has been selected if -+ A byte, character or field K has been selected if - (K <= MAX_RANGE_ENDPOINT and is_printable_field(K)) - || (EOL_RANGE_START > 0 && K >= EOL_RANGE_START). */ - static unsigned char *printable_field; -@@ -114,15 +178,25 @@ enum operating_mode +@@ -75,6 +138,8 @@ static size_t n_rp; + /* Number of `struct range_pair's allocated. */ + static size_t n_rp_allocated; + ++/* Length of the delimiter given as argument to -d. */ ++size_t delimlen; + + /* Append LOW, HIGH to the list RP of range pairs, allocating additional + space if necessary. Update global variable N_RP. When allocating, +@@ -106,15 +171,25 @@ enum operating_mode { undefined_mode, @@ -160,7 +146,7 @@ diff -urNp coreutils-8.21-orig/src/cut.c coreutils-8.21/src/cut.c /* If true do not output lines containing no delimeter characters. Otherwise, all such lines are printed. This option is valid only with field mode. */ -@@ -134,6 +208,9 @@ static bool complement; +@@ -126,6 +201,9 @@ static bool complement; /* The delimeter character for field mode. */ static unsigned char delim; @@ -170,7 +156,7 @@ diff -urNp coreutils-8.21-orig/src/cut.c coreutils-8.21/src/cut.c /* True if the --output-delimiter=STRING option was specified. */ static bool output_delimiter_specified; -@@ -205,7 +282,7 @@ Print selected parts of lines from each +@@ -188,7 +266,7 @@ Print selected parts of lines from each -f, --fields=LIST select only these fields; also print any line\n\ that contains no delimiter character, unless\n\ the -s option is specified\n\ @@ -179,7 +165,7 @@ diff -urNp coreutils-8.21-orig/src/cut.c coreutils-8.21/src/cut.c "), stdout); fputs (_("\ --complement complement the set of selected bytes, characters\n\ -@@ -480,6 +557,9 @@ set_fields (const char *fieldstr) +@@ -381,6 +459,9 @@ set_fields (const char *fieldstr) if (operating_mode == byte_mode) error (0, 0, _("byte offset %s is too large"), quote (bad_num)); @@ -189,7 +175,7 @@ diff -urNp coreutils-8.21-orig/src/cut.c coreutils-8.21/src/cut.c else error (0, 0, _("field number %s is too large"), quote (bad_num)); -@@ -588,6 +668,77 @@ cut_bytes (FILE *stream) +@@ -505,6 +586,79 @@ cut_bytes (FILE *stream) } } @@ -205,7 +191,7 @@ diff -urNp coreutils-8.21-orig/src/cut.c coreutils-8.21/src/cut.c +static void +cut_characters_or_cut_bytes_no_split (FILE *stream) +{ -+ int idx; /* number of bytes or characters in the line so far. */ ++ size_t idx; /* number of bytes or characters in the line so far. */ + char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */ + char *bufpos; /* Next read position of BUF. */ + size_t buflen; /* The length of the byte sequence in buf. */ @@ -223,6 +209,8 @@ diff -urNp coreutils-8.21-orig/src/cut.c coreutils-8.21/src/cut.c + bufpos = buf; + memset (&state, '\0', sizeof(mbstate_t)); + ++ current_rp = rp; ++ + while (1) + { + REFILL_BUFFER (buf, bufpos, buflen, stream); @@ -240,19 +228,19 @@ diff -urNp coreutils-8.21-orig/src/cut.c coreutils-8.21/src/cut.c + putchar ('\n'); + idx = 0; + print_delimiter = false; ++ current_rp = rp; + } + else + { -+ bool range_start; -+ bool *rs = output_delimiter_specified ? &range_start : NULL; -+ idx += (operating_mode == byte_mode) ? mblength : 1; -+ if (print_kth (idx, rs)) ++ next_item (&idx); ++ if (print_kth (idx)) + { -+ if (rs && *rs && print_delimiter) ++ if (output_delimiter_specified) + { -+ fwrite (output_delimiter_string, sizeof (char), -+ output_delimiter_length, stdout); -+ } ++ if (print_delimiter && is_range_start_index (idx)) ++ fwrite (output_delimiter_string, sizeof (char), ++ output_delimiter_length, stdout); ++ } + print_delimiter = true; + fwrite (bufpos, mblength, sizeof(char), stdout); + } @@ -267,7 +255,7 @@ diff -urNp coreutils-8.21-orig/src/cut.c coreutils-8.21/src/cut.c /* Read from stream STREAM, printing to standard output any selected fields. */ static void -@@ -709,13 +860,195 @@ cut_fields (FILE *stream) +@@ -629,13 +783,211 @@ cut_fields (FILE *stream) } } @@ -276,7 +264,7 @@ diff -urNp coreutils-8.21-orig/src/cut.c coreutils-8.21/src/cut.c +cut_fields_mb (FILE *stream) +{ + int c; -+ unsigned int field_idx; ++ size_t field_idx; + int found_any_selected_field; + int buffer_first_field; + int empty_input; @@ -289,6 +277,8 @@ diff -urNp coreutils-8.21-orig/src/cut.c coreutils-8.21/src/cut.c + mbstate_t state; /* State of the stream. */ + int convfail = 0; /* 1, when conversion is failed. Otherwise 0. */ + ++ current_rp = rp; ++ + found_any_selected_field = 0; + field_idx = 1; + bufpos = buf; @@ -311,7 +301,7 @@ diff -urNp coreutils-8.21-orig/src/cut.c coreutils-8.21/src/cut.c + and the first field has been selected, or if non-delimited lines + must be suppressed and the first field has *not* been selected. + That is because a non-delimited line has exactly one field. */ -+ buffer_first_field = (suppress_non_delimited ^ !print_kth (1, NULL)); ++ buffer_first_field = (suppress_non_delimited ^ !print_kth (1)); + + while (1) + { @@ -361,18 +351,18 @@ diff -urNp coreutils-8.21-orig/src/cut.c coreutils-8.21/src/cut.c + continue; + } + -+ if (print_kth (1, NULL)) ++ if (print_kth (1)) + { + /* Print the field, but not the trailing delimiter. */ + fwrite (field_1_buffer, sizeof (char), len - 1, stdout); + found_any_selected_field = 1; + } -+ ++field_idx; ++ next_item (&field_idx); + } + + if (wc != WEOF) + { -+ if (print_kth (field_idx, NULL)) ++ if (print_kth (field_idx)) + { + if (found_any_selected_field) + { @@ -398,7 +388,7 @@ diff -urNp coreutils-8.21-orig/src/cut.c coreutils-8.21/src/cut.c + break; + } + -+ if (print_kth (field_idx, NULL)) ++ if (print_kth (field_idx)) + fwrite (bufpos, mblength, sizeof(char), stdout); + + buflen -= mblength; @@ -410,7 +400,7 @@ diff -urNp coreutils-8.21-orig/src/cut.c coreutils-8.21/src/cut.c + wc = WEOF; + + if (!convfail && wc == wcdelim) -+ ++field_idx; ++ next_item (&field_idx); + else if (wc == WEOF || (!convfail && wc == L'\n')) + { + if (found_any_selected_field @@ -419,6 +409,7 @@ diff -urNp coreutils-8.21-orig/src/cut.c coreutils-8.21/src/cut.c + if (wc == WEOF) + break; + field_idx = 1; ++ current_rp = rp; + found_any_selected_field = 0; + } + } @@ -447,6 +438,19 @@ diff -urNp coreutils-8.21-orig/src/cut.c coreutils-8.21/src/cut.c + break; + + case field_mode: ++ if (delimlen == 1) ++ { ++ /* Check if we have utf8 multibyte locale, so we can use this ++ optimization because of uniqueness of characters, which is ++ not true for e.g. SJIS */ ++ char * loc = setlocale(LC_CTYPE, NULL); ++ if (loc && (strstr (loc, "UTF-8") || strstr (loc, "utf-8") || ++ strstr (loc, "UTF8") || strstr (loc, "utf8"))) ++ { ++ cut_fields (stream); ++ break; ++ } ++ } + cut_fields_mb (stream); + break; + @@ -466,16 +470,15 @@ diff -urNp coreutils-8.21-orig/src/cut.c coreutils-8.21/src/cut.c } /* Process file FILE to standard output. -@@ -767,6 +1100,8 @@ main (int argc, char **argv) +@@ -687,6 +1035,7 @@ main (int argc, char **argv) bool ok; bool delim_specified = false; char *spec_list_string IF_LINT ( = NULL); + char mbdelim[MB_LEN_MAX + 1]; -+ size_t delimlen = 0; initialize_main (&argc, &argv); set_program_name (argv[0]); -@@ -789,7 +1124,6 @@ main (int argc, char **argv) +@@ -709,7 +1058,6 @@ main (int argc, char **argv) switch (optc) { case 'b': @@ -483,7 +486,7 @@ diff -urNp coreutils-8.21-orig/src/cut.c coreutils-8.21/src/cut.c /* Build the byte list. */ if (operating_mode != undefined_mode) FATAL_ERROR (_("only one type of list may be specified")); -@@ -797,6 +1131,14 @@ main (int argc, char **argv) +@@ -717,6 +1065,14 @@ main (int argc, char **argv) spec_list_string = optarg; break; @@ -498,7 +501,7 @@ diff -urNp coreutils-8.21-orig/src/cut.c coreutils-8.21/src/cut.c case 'f': /* Build the field list. */ if (operating_mode != undefined_mode) -@@ -808,10 +1150,36 @@ main (int argc, char **argv) +@@ -728,10 +1084,38 @@ main (int argc, char **argv) case 'd': /* New delimiter. */ /* Interpret -d '' to mean 'use the NUL byte as the delimiter.' */ @@ -524,6 +527,8 @@ diff -urNp coreutils-8.21-orig/src/cut.c coreutils-8.21/src/cut.c + FATAL_ERROR (_("the delimiter must be a single character")); + memcpy (mbdelim, optarg, delimlen); + mbdelim[delimlen] = '\0'; ++ if (delimlen == 1) ++ delim = *optarg; + } + } + @@ -539,7 +544,7 @@ diff -urNp coreutils-8.21-orig/src/cut.c coreutils-8.21/src/cut.c break; case OUTPUT_DELIMITER_OPTION: -@@ -824,6 +1191,7 @@ main (int argc, char **argv) +@@ -744,6 +1128,7 @@ main (int argc, char **argv) break; case 'n': @@ -547,7 +552,7 @@ diff -urNp coreutils-8.21-orig/src/cut.c coreutils-8.21/src/cut.c break; case 's': -@@ -873,15 +1241,34 @@ main (int argc, char **argv) +@@ -783,15 +1168,34 @@ main (int argc, char **argv) } if (!delim_specified) @@ -588,10 +593,9 @@ diff -urNp coreutils-8.21-orig/src/cut.c coreutils-8.21/src/cut.c } if (optind == argc) -Binary files coreutils-8.21-orig/src/.cut.c.swp and coreutils-8.21/src/.cut.c.swp differ -diff -urNp coreutils-8.21-orig/src/expand.c coreutils-8.21/src/expand.c ---- coreutils-8.21-orig/src/expand.c 2013-01-31 01:46:24.000000000 +0100 -+++ coreutils-8.21/src/expand.c 2013-02-15 14:25:07.774467536 +0100 +diff -urNp coreutils-8.22-orig/src/expand.c coreutils-8.22/src/expand.c +--- coreutils-8.22-orig/src/expand.c 2013-12-04 15:48:30.000000000 +0100 ++++ coreutils-8.22/src/expand.c 2013-12-16 17:40:25.936886952 +0100 @@ -37,12 +37,29 @@ #include #include @@ -779,9 +783,9 @@ diff -urNp coreutils-8.21-orig/src/expand.c coreutils-8.21/src/expand.c if (have_read_stdin && fclose (stdin) != 0) error (EXIT_FAILURE, errno, "-"); -diff -urNp coreutils-8.21-orig/src/fold.c coreutils-8.21/src/fold.c ---- coreutils-8.21-orig/src/fold.c 2013-01-31 01:46:24.000000000 +0100 -+++ coreutils-8.21/src/fold.c 2013-02-15 14:25:07.789467891 +0100 +diff -urNp coreutils-8.22-orig/src/fold.c coreutils-8.22/src/fold.c +--- coreutils-8.22-orig/src/fold.c 2013-12-04 15:48:30.000000000 +0100 ++++ coreutils-8.22/src/fold.c 2013-12-16 17:40:25.938886274 +0100 @@ -22,12 +22,34 @@ #include #include @@ -1179,9 +1183,9 @@ diff -urNp coreutils-8.21-orig/src/fold.c coreutils-8.21/src/fold.c break; case 's': /* Break at word boundaries. */ -diff -urNp coreutils-8.21-orig/src/join.c coreutils-8.21/src/join.c ---- coreutils-8.21-orig/src/join.c 2013-01-31 01:46:24.000000000 +0100 -+++ coreutils-8.21/src/join.c 2013-02-15 14:25:07.804467922 +0100 +diff -urNp coreutils-8.22-orig/src/join.c coreutils-8.22/src/join.c +--- coreutils-8.22-orig/src/join.c 2013-12-04 15:48:30.000000000 +0100 ++++ coreutils-8.22/src/join.c 2013-12-16 17:40:25.940885607 +0100 @@ -22,18 +22,32 @@ #include #include @@ -1233,7 +1237,7 @@ diff -urNp coreutils-8.21-orig/src/join.c coreutils-8.21/src/join.c /* If nonzero, check that the input is correctly ordered. */ static enum -@@ -262,13 +278,14 @@ xfields (struct line *line) +@@ -269,13 +285,14 @@ xfields (struct line *line) if (ptr == lim) return; @@ -1251,7 +1255,7 @@ diff -urNp coreutils-8.21-orig/src/join.c coreutils-8.21/src/join.c { /* Skip leading blanks before the first field. */ while (isblank (to_uchar (*ptr))) -@@ -292,6 +309,148 @@ xfields (struct line *line) +@@ -299,6 +316,148 @@ xfields (struct line *line) extract_field (line, ptr, lim - ptr); } @@ -1400,7 +1404,7 @@ diff -urNp coreutils-8.21-orig/src/join.c coreutils-8.21/src/join.c static void freeline (struct line *line) { -@@ -313,56 +472,130 @@ keycmp (struct line const *line1, struct +@@ -320,56 +479,131 @@ keycmp (struct line const *line1, struct size_t jf_1, size_t jf_2) { /* Start of field to compare in each file. */ @@ -1472,6 +1476,7 @@ diff -urNp coreutils-8.21-orig/src/join.c coreutils-8.21/src/join.c + { + mallocd = 1; + copy[i] = xmalloc (len[i] + 1); ++ memset (copy[i], '\0',len[i] + 1); + + for (j = 0; j < MIN (len[0], len[1]);) + { @@ -1554,7 +1559,7 @@ diff -urNp coreutils-8.21-orig/src/join.c coreutils-8.21/src/join.c } /* Check that successive input lines PREV and CURRENT from input file -@@ -454,6 +687,11 @@ get_line (FILE *fp, struct line **linep, +@@ -461,6 +694,11 @@ get_line (FILE *fp, struct line **linep, } ++line_no[which - 1]; @@ -1566,7 +1571,7 @@ diff -urNp coreutils-8.21-orig/src/join.c coreutils-8.21/src/join.c xfields (line); if (prevline[which - 1]) -@@ -553,21 +791,28 @@ prfield (size_t n, struct line const *li +@@ -560,21 +798,28 @@ prfield (size_t n, struct line const *li /* Output all the fields in line, other than the join field. */ @@ -1598,7 +1603,7 @@ diff -urNp coreutils-8.21-orig/src/join.c coreutils-8.21/src/join.c prfield (i, line); } } -@@ -578,7 +823,6 @@ static void +@@ -585,7 +830,6 @@ static void prjoin (struct line const *line1, struct line const *line2) { const struct outlist *outlist; @@ -1606,16 +1611,16 @@ diff -urNp coreutils-8.21-orig/src/join.c coreutils-8.21/src/join.c size_t field; struct line const *line; -@@ -612,7 +856,7 @@ prjoin (struct line const *line1, struct +@@ -619,7 +863,7 @@ prjoin (struct line const *line1, struct o = o->next; if (o == NULL) break; - putchar (output_separator); + PUT_TAB_CHAR; } - putchar ('\n'); + putchar (eolchar); } -@@ -1090,21 +1334,46 @@ main (int argc, char **argv) +@@ -1097,21 +1341,46 @@ main (int argc, char **argv) case 't': { @@ -1671,10 +1676,10 @@ diff -urNp coreutils-8.21-orig/src/join.c coreutils-8.21/src/join.c + } break; - case NOCHECK_ORDER_OPTION: -diff -urNp coreutils-8.21-orig/src/pr.c coreutils-8.21/src/pr.c ---- coreutils-8.21-orig/src/pr.c 2013-01-31 01:46:24.000000000 +0100 -+++ coreutils-8.21/src/pr.c 2013-02-15 14:25:07.819467936 +0100 + case 'z': +diff -urNp coreutils-8.22-orig/src/pr.c coreutils-8.22/src/pr.c +--- coreutils-8.22-orig/src/pr.c 2013-12-04 15:48:30.000000000 +0100 ++++ coreutils-8.22/src/pr.c 2013-12-16 17:40:25.944884263 +0100 @@ -312,6 +312,32 @@ #include @@ -2428,9 +2433,9 @@ diff -urNp coreutils-8.21-orig/src/pr.c coreutils-8.21/src/pr.c /* We've just printed some files and need to clean up things before looking for more options and printing the next batch of files. -diff -urNp coreutils-8.21-orig/src/sort.c coreutils-8.21/src/sort.c ---- coreutils-8.21-orig/src/sort.c 2013-08-14 18:14:06.172216606 +0200 -+++ coreutils-8.21/src/sort.c 2013-08-14 18:13:30.295247905 +0200 +diff -urNp coreutils-8.22-orig/src/sort.c coreutils-8.22/src/sort.c +--- coreutils-8.22-orig/src/sort.c 2013-12-04 15:48:30.000000000 +0100 ++++ coreutils-8.22/src/sort.c 2014-01-03 07:52:26.905202526 +0100 @@ -29,6 +29,14 @@ #include #include @@ -2446,12 +2451,17 @@ diff -urNp coreutils-8.21-orig/src/sort.c coreutils-8.21/src/sort.c #include "system.h" #include "argmatch.h" #include "error.h" -@@ -166,12 +174,34 @@ static int thousands_sep; +@@ -164,14 +172,39 @@ static int decimal_point; + /* Thousands separator; if -1, then there isn't one. */ + static int thousands_sep; ++/* True if -f was specified. */ ++static bool folding; ++ /* Nonzero if the corresponding locales are hard. */ static bool hard_LC_COLLATE; -+#if HAVE_LANGINFO_CODESET -#if HAVE_NL_LANGINFO ++#if HAVE_LANGINFO_CODESET static bool hard_LC_TIME; #endif @@ -2482,24 +2492,24 @@ diff -urNp coreutils-8.21-orig/src/sort.c coreutils-8.21/src/sort.c /* The kind of blanks for '-b' to skip in various options. */ enum blanktype { bl_start, bl_end, bl_both }; -@@ -345,13 +375,11 @@ static bool reverse; +@@ -345,13 +378,11 @@ static bool reverse; they were read if all keys compare equal. */ static bool stable; -+/* Tab character separating fields. If tab_length is 0, then fields are -/* If TAB has this value, blanks separate fields. */ -enum { TAB_DEFAULT = CHAR_MAX + 1 }; - -/* Tab character separating fields. If TAB_DEFAULT, then fields are ++/* Tab character separating fields. If tab_length is 0, then fields are separated by the empty string between a non-blank character and a blank character. */ +-static int tab = TAB_DEFAULT; +static char tab[MB_LEN_MAX + 1]; +static size_t tab_length = 0; --static int tab = TAB_DEFAULT; /* Flag to remove consecutive duplicate lines from the output. Only the last of a sequence of equal lines will be output. */ -@@ -783,6 +811,46 @@ reap_all (void) +@@ -811,6 +842,46 @@ reap_all (void) reap (-1); } @@ -2546,34 +2556,34 @@ diff -urNp coreutils-8.21-orig/src/sort.c coreutils-8.21/src/sort.c /* Clean up any remaining temporary files. */ static void -@@ -1223,7 +1291,7 @@ zaptemp (char const *name) +@@ -1255,7 +1326,7 @@ zaptemp (char const *name) free (node); } -+#if HAVE_LANGINFO_CODESET -#if HAVE_NL_LANGINFO ++#if HAVE_LANGINFO_CODESET static int struct_month_cmp (void const *m1, void const *m2) -@@ -1238,7 +1306,7 @@ struct_month_cmp (void const *m1, void c +@@ -1270,7 +1341,7 @@ struct_month_cmp (void const *m1, void c /* Initialize the character class tables. */ static void -+inittables_uni (void) -inittables (void) ++inittables_uni (void) { size_t i; -@@ -1250,7 +1318,7 @@ inittables_uni (void) +@@ -1282,7 +1353,7 @@ inittables (void) fold_toupper[i] = toupper (i); } -+#if HAVE_LANGINFO_CODESET -#if HAVE_NL_LANGINFO ++#if HAVE_LANGINFO_CODESET /* If we're not in the "C" locale, read different names for months. */ if (hard_LC_TIME) { -@@ -1332,6 +1400,84 @@ specify_nmerge (int oi, char c, char con +@@ -1364,6 +1435,84 @@ specify_nmerge (int oi, char c, char con xstrtol_fatal (e, oi, c, long_options, s); } @@ -2658,29 +2668,29 @@ diff -urNp coreutils-8.21-orig/src/sort.c coreutils-8.21/src/sort.c /* Specify the amount of main memory to use when sorting. */ static void specify_sort_size (int oi, char c, char const *s) -@@ -1564,7 +1710,7 @@ buffer_linelim (struct buffer const *buf +@@ -1597,7 +1746,7 @@ buffer_linelim (struct buffer const *buf by KEY in LINE. */ static char * -+begfield_uni (const struct line *line, const struct keyfield *key) -begfield (struct line const *line, struct keyfield const *key) ++begfield_uni (const struct line *line, const struct keyfield *key) { char *ptr = line->text, *lim = ptr + line->length - 1; size_t sword = key->sword; -@@ -1573,10 +1719,10 @@ begfield_uni (const struct line *line, c +@@ -1606,10 +1755,10 @@ begfield (struct line const *line, struc /* The leading field separator itself is included in a field when -t is absent. */ -+ if (tab_length) - if (tab != TAB_DEFAULT) ++ if (tab_length) while (ptr < lim && sword--) { -+ while (ptr < lim && *ptr != tab[0]) - while (ptr < lim && *ptr != tab) ++ while (ptr < lim && *ptr != tab[0]) ++ptr; if (ptr < lim) ++ptr; -@@ -1602,11 +1748,70 @@ begfield_uni (const struct line *line, c +@@ -1635,11 +1784,70 @@ begfield (struct line const *line, struc return ptr; } @@ -2747,38 +2757,38 @@ diff -urNp coreutils-8.21-orig/src/sort.c coreutils-8.21/src/sort.c in LINE specified by KEY. */ static char * -+limfield_uni (const struct line *line, const struct keyfield *key) -limfield (struct line const *line, struct keyfield const *key) ++limfield_uni (const struct line *line, const struct keyfield *key) { char *ptr = line->text, *lim = ptr + line->length - 1; size_t eword = key->eword, echar = key->echar; -@@ -1621,10 +1826,10 @@ limfield_uni (const struct line *line, c +@@ -1654,10 +1862,10 @@ limfield (struct line const *line, struc 'beginning' is the first character following the delimiting TAB. Otherwise, leave PTR pointing at the first 'blank' character after the preceding field. */ -+ if (tab_length) - if (tab != TAB_DEFAULT) ++ if (tab_length) while (ptr < lim && eword--) { -+ while (ptr < lim && *ptr != tab[0]) - while (ptr < lim && *ptr != tab) ++ while (ptr < lim && *ptr != tab[0]) ++ptr; if (ptr < lim && (eword || echar)) ++ptr; -@@ -1670,10 +1875,10 @@ limfield_uni (const struct line *line, c +@@ -1703,10 +1911,10 @@ limfield (struct line const *line, struc */ /* Make LIM point to the end of (one byte past) the current field. */ -+ if (tab_length) - if (tab != TAB_DEFAULT) ++ if (tab_length) { char *newlim; -+ newlim = memchr (ptr, tab[0], lim - ptr); - newlim = memchr (ptr, tab, lim - ptr); ++ newlim = memchr (ptr, tab[0], lim - ptr); if (newlim) lim = newlim; } -@@ -1704,6 +1909,130 @@ limfield_uni (const struct line *line, c +@@ -1737,6 +1945,130 @@ limfield (struct line const *line, struc return ptr; } @@ -2909,10 +2919,12 @@ diff -urNp coreutils-8.21-orig/src/sort.c coreutils-8.21/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 -@@ -1790,8 +2119,22 @@ fillbuf (struct buffer *buf, FILE *fp, c +@@ -1823,8 +2155,22 @@ fillbuf (struct buffer *buf, FILE *fp, c else { if (key->skipsblanks) +- while (blanks[to_uchar (*line_start)]) +- line_start++; + { +#if HAVE_MBRTOWC + if (MB_CUR_MAX > 1) @@ -2929,21 +2941,19 @@ diff -urNp coreutils-8.21-orig/src/sort.c coreutils-8.21/src/sort.c + while (blanks[to_uchar (*line_start)]) + line_start++; + } -- while (blanks[to_uchar (*line_start)]) -- line_start++; line->keybeg = line_start; } } -@@ -1912,7 +2255,7 @@ human_numcompare (char const *a, char co +@@ -1945,7 +2291,7 @@ human_numcompare (char const *a, char co hideously fast. */ static int -+numcompare_uni (const char *a, const char *b) -numcompare (char const *a, char const *b) ++numcompare_uni (const char *a, const char *b) { while (blanks[to_uchar (*a)]) a++; -@@ -1922,6 +2265,25 @@ numcompare_uni (const char *a, const cha +@@ -1955,6 +2301,25 @@ numcompare (char const *a, char const *b return strnumcmp (a, b, decimal_point, thousands_sep); } @@ -2969,43 +2979,43 @@ diff -urNp coreutils-8.21-orig/src/sort.c coreutils-8.21/src/sort.c /* Work around a problem whereby the long double value returned by glibc's strtold ("NaN", ...) contains uninitialized bits: clear all bytes of A and B before calling strtold. FIXME: remove this function once -@@ -1972,7 +2334,7 @@ general_numcompare (char const *sa, char +@@ -2005,7 +2370,7 @@ general_numcompare (char const *sa, char Return 0 if the name in S is not recognized. */ static int -+getmonth_uni (char const *month, size_t len, char **ea) -getmonth (char const *month, char **ea) ++getmonth_uni (char const *month, size_t len, char **ea) { size_t lo = 0; size_t hi = MONTHS_PER_YEAR; -@@ -2247,15 +2609,14 @@ debug_key (struct line const *line, stru +@@ -2280,15 +2645,14 @@ debug_key (struct line const *line, stru char saved = *lim; *lim = '\0'; -+ skipblanks (&beg, lim); - while (blanks[to_uchar (*beg)]) - beg++; ++ skipblanks (&beg, lim); char *tighter_lim = beg; if (lim < beg) tighter_lim = lim; else if (key->month) -+ getmonth (beg, lim-beg, &tighter_lim); - getmonth (beg, &tighter_lim); ++ getmonth (beg, lim-beg, &tighter_lim); else if (key->general_numeric) ignore_value (strtold (beg, &tighter_lim)); else if (key->numeric || key->human_numeric) -@@ -2399,7 +2760,7 @@ key_warnings (struct keyfield const *gke +@@ -2432,7 +2796,7 @@ key_warnings (struct keyfield const *gke bool maybe_space_aligned = !hard_LC_COLLATE && default_key_compare (key) && !(key->schar || key->echar); bool line_offset = key->eword == 0 && key->echar != 0; /* -k1.x,1.y */ -+ if (!gkey_only && !tab_length && !line_offset - if (!gkey_only && tab == TAB_DEFAULT && !line_offset ++ if (!gkey_only && !tab_length && !line_offset && ((!key->skipsblanks && !(implicit_skip || maybe_space_aligned)) || (!key->skipsblanks && key->schar) || (!key->skipeblanks && key->echar))) -@@ -2457,11 +2818,87 @@ key_warnings (struct keyfield const *gke +@@ -2490,11 +2854,87 @@ key_warnings (struct keyfield const *gke error (0, 0, _("option '-r' only applies to last-resort comparison")); } @@ -3089,21 +3099,21 @@ diff -urNp coreutils-8.21-orig/src/sort.c coreutils-8.21/src/sort.c are no more keys or a difference is found. */ static int -+keycompare_uni (const struct line *a, const struct line *b) -keycompare (struct line const *a, struct line const *b) ++keycompare_uni (const struct line *a, const struct line *b) { struct keyfield *key = keylist; -@@ -2546,7 +2983,7 @@ keycompare_uni (const struct line *a, co +@@ -2579,7 +3019,7 @@ keycompare (struct line const *a, struct else if (key->human_numeric) diff = human_numcompare (ta, tb); else if (key->month) -+ diff = getmonth (ta, tlena, NULL) - getmonth (tb, tlenb, NULL); - diff = getmonth (ta, NULL) - getmonth (tb, NULL); ++ diff = getmonth (ta, tlena, NULL) - getmonth (tb, tlenb, NULL); else if (key->random) diff = compare_random (ta, tlena, tb, tlenb); else if (key->version) -@@ -2662,6 +3099,191 @@ keycompare_uni (const struct line *a, co +@@ -2695,6 +3135,191 @@ keycompare (struct line const *a, struct return key->reverse ? -diff : diff; } @@ -3246,12 +3256,12 @@ diff -urNp coreutils-8.21-orig/src/sort.c coreutils-8.21/src/sort.c + diff = - NONZERO (lenb); + else if (lenb == 0) + diff = 1; ++ else if (hard_LC_COLLATE && !folding) ++ { ++ diff = xmemcoll0 (texta, lena, textb, lenb); ++ } + else -+ { -+ diff = memcmp (texta, textb, MIN (lena,lenb)); -+ if (!diff) -+ diff = xmemcoll (texta, lena, textb, lenb); -+ } ++ diff = memcmp (texta, textb, MIN (lena + 1,lenb + 1)); + + if (ignore || translate) + free (texta); @@ -3295,31 +3305,33 @@ diff -urNp coreutils-8.21-orig/src/sort.c coreutils-8.21/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. */ -@@ -2689,14 +3311,6 @@ compare (struct line const *a, struct li +@@ -2722,7 +3347,7 @@ compare (struct line const *a, struct li diff = - NONZERO (blen); else if (blen == 0) diff = 1; - else if (hard_LC_COLLATE) -- { -- /* Note xmemcoll0 is a performance enhancement as -- it will not unconditionally write '\0' after the -- passed in buffers, which was seen to give around -- a 3% increase in performance for short lines. */ -- diff = xmemcoll0 (a->text, alen + 1, b->text, blen + 1); -- } - else if (! (diff = memcmp (a->text, b->text, MIN (alen, blen)))) - diff = alen < blen ? -1 : alen != blen; - -@@ -4157,7 +4771,7 @@ main (int argc, char **argv) ++ else if (hard_LC_COLLATE && !folding) + { + /* Note xmemcoll0 is a performance enhancement as + it will not unconditionally write '\0' after the +@@ -4112,6 +4737,7 @@ set_ordering (char const *s, struct keyf + key->ignore = nondictionary; + break; + case 'f': ++ folding = true; + key->translate = fold_toupper; + break; + case 'g': +@@ -4190,7 +4816,7 @@ main (int argc, char **argv) initialize_exit_failure (SORT_FAILURE); hard_LC_COLLATE = hard_locale (LC_COLLATE); -+#if HAVE_LANGINFO_CODESET -#if HAVE_NL_LANGINFO ++#if HAVE_LANGINFO_CODESET hard_LC_TIME = hard_locale (LC_TIME); #endif -@@ -4178,6 +4792,29 @@ main (int argc, char **argv) +@@ -4211,6 +4837,29 @@ main (int argc, char **argv) thousands_sep = -1; } @@ -3349,17 +3361,18 @@ diff -urNp coreutils-8.21-orig/src/sort.c coreutils-8.21/src/sort.c have_read_stdin = false; inittables (); -@@ -4452,13 +5089,34 @@ main (int argc, char **argv) +@@ -4485,13 +5134,34 @@ main (int argc, char **argv) case 't': { +- char newtab = optarg[0]; +- if (! newtab) + char newtab[MB_LEN_MAX + 1]; + size_t newtab_length = 1; + strncpy (newtab, optarg, MB_LEN_MAX); + if (! newtab[0]) -- char newtab = optarg[0]; -- if (! newtab) error (SORT_FAILURE, 0, _("empty tab")); +- if (optarg[1]) +#if HAVE_MBRTOWC + if (MB_CUR_MAX > 1) + { @@ -3380,32 +3393,31 @@ diff -urNp coreutils-8.21-orig/src/sort.c coreutils-8.21/src/sort.c + } +#endif + if (newtab_length == 1 && optarg[1]) -- if (optarg[1]) { if (STREQ (optarg, "\\0")) -+ newtab[0] = '\0'; - newtab = '\0'; ++ newtab[0] = '\0'; else { /* Provoke with 'sort -txx'. Complain about -@@ -4469,9 +5127,12 @@ main (int argc, char **argv) +@@ -4502,9 +5172,12 @@ main (int argc, char **argv) quote (optarg)); } } +- if (tab != TAB_DEFAULT && tab != newtab) + if (tab_length + && (tab_length != newtab_length + || memcmp (tab, newtab, tab_length) != 0)) -- if (tab != TAB_DEFAULT && tab != newtab) error (SORT_FAILURE, 0, _("incompatible tabs")); +- tab = newtab; + memcpy (tab, newtab, newtab_length); + tab_length = newtab_length; -- tab = newtab; } break; -diff -urNp coreutils-8.21-orig/src/unexpand.c coreutils-8.21/src/unexpand.c ---- coreutils-8.21-orig/src/unexpand.c 2013-01-31 01:46:24.000000000 +0100 -+++ coreutils-8.21/src/unexpand.c 2013-02-15 14:25:07.834467715 +0100 +diff -urNp coreutils-8.22-orig/src/unexpand.c coreutils-8.22/src/unexpand.c +--- coreutils-8.22-orig/src/unexpand.c 2013-12-04 15:48:30.000000000 +0100 ++++ coreutils-8.22/src/unexpand.c 2013-12-16 17:40:25.951881910 +0100 @@ -38,12 +38,29 @@ #include #include @@ -3647,7 +3659,7 @@ diff -urNp coreutils-8.21-orig/src/unexpand.c coreutils-8.21/src/unexpand.c void usage (int status) { -@@ -523,7 +742,12 @@ main (int argc, char **argv) +@@ -523,7 +744,12 @@ main (int argc, char **argv) file_list = (optind < argc ? &argv[optind] : stdin_argv); @@ -3661,9 +3673,9 @@ diff -urNp coreutils-8.21-orig/src/unexpand.c coreutils-8.21/src/unexpand.c if (have_read_stdin && fclose (stdin) != 0) error (EXIT_FAILURE, errno, "-"); -diff -urNp coreutils-8.21-orig/src/uniq.c coreutils-8.21/src/uniq.c ---- coreutils-8.21-orig/src/uniq.c 2013-01-31 01:46:24.000000000 +0100 -+++ coreutils-8.21/src/uniq.c 2013-02-15 14:25:07.839467991 +0100 +diff -urNp coreutils-8.22-orig/src/uniq.c coreutils-8.22/src/uniq.c +--- coreutils-8.22-orig/src/uniq.c 2013-12-04 15:48:30.000000000 +0100 ++++ coreutils-8.22/src/uniq.c 2013-12-16 17:41:06.711697074 +0100 @@ -21,6 +21,16 @@ #include #include @@ -3702,9 +3714,9 @@ diff -urNp coreutils-8.21-orig/src/uniq.c coreutils-8.21/src/uniq.c /* The official name of this program (e.g., no 'g' prefix). */ #define PROGRAM_NAME "uniq" -@@ -108,6 +130,10 @@ static enum delimit_method const delimit - /* Select whether/how to delimit groups of duplicate lines. */ - static enum delimit_method delimit_groups; +@@ -143,6 +165,10 @@ enum + GROUP_OPTION = CHAR_MAX + 1 + }; +/* Function pointers. */ +static char * @@ -3713,7 +3725,7 @@ diff -urNp coreutils-8.21-orig/src/uniq.c coreutils-8.21/src/uniq.c static struct option const longopts[] = { {"count", no_argument, NULL, 'c'}, -@@ -205,7 +231,7 @@ size_opt (char const *opt, char const *m +@@ -249,7 +275,7 @@ size_opt (char const *opt, char const *m return a pointer to the beginning of the line's field to be compared. */ static char * _GL_ATTRIBUTE_PURE @@ -3722,7 +3734,7 @@ diff -urNp coreutils-8.21-orig/src/uniq.c coreutils-8.21/src/uniq.c { size_t count; char const *lp = line->buffer; -@@ -225,6 +251,83 @@ find_field (struct linebuffer const *lin +@@ -269,6 +295,83 @@ find_field (struct linebuffer const *lin return line->buffer + i; } @@ -3806,7 +3818,7 @@ diff -urNp coreutils-8.21-orig/src/uniq.c coreutils-8.21/src/uniq.c /* Return false if two strings OLD and NEW match, true if not. OLD and NEW point not to the beginnings of the lines but rather to the beginnings of the fields to compare. -@@ -233,6 +336,8 @@ find_field (struct linebuffer const *lin +@@ -277,6 +380,8 @@ find_field (struct linebuffer const *lin static bool different (char *old, char *new, size_t oldlen, size_t newlen) { @@ -3815,7 +3827,7 @@ diff -urNp coreutils-8.21-orig/src/uniq.c coreutils-8.21/src/uniq.c if (check_chars < oldlen) oldlen = check_chars; if (check_chars < newlen) -@@ -240,14 +345,100 @@ different (char *old, char *new, size_t +@@ -284,14 +389,101 @@ different (char *old, char *new, size_t if (ignore_case) { @@ -3872,6 +3884,7 @@ diff -urNp coreutils-8.21-orig/src/uniq.c coreutils-8.21/src/uniq.c + for (i = 0; i < 2; i++) + { + copy[i] = xmalloc (len[i] + 1); ++ memset (copy[i], '\0', len[i] + 1); + + for (j = 0, chars = 0; j < len[i] && chars < check_chars; chars++) + { @@ -3921,10 +3934,10 @@ diff -urNp coreutils-8.21-orig/src/uniq.c coreutils-8.21/src/uniq.c /* Output the line in linebuffer LINE to standard output provided that the switches say it should be output. -@@ -303,15 +494,43 @@ check_file (const char *infile, const ch - { +@@ -356,18 +547,55 @@ check_file (const char *infile, const ch char *prevfield IF_LINT ( = NULL); size_t prevlen IF_LINT ( = 0); + bool first_group_printed = false; +#if HAVE_MBRTOWC + mbstate_t prevstate; + @@ -3935,21 +3948,31 @@ diff -urNp coreutils-8.21-orig/src/uniq.c coreutils-8.21/src/uniq.c { char *thisfield; size_t thislen; + bool new_group; +#if HAVE_MBRTOWC + mbstate_t thisstate; +#endif -+ + if (readlinebuffer_delim (thisline, stdin, delimiter) == 0) break; + thisfield = find_field (thisline); thislen = thisline->length - 1 - (thisfield - thisline->buffer); +#if HAVE_MBRTOWC -+ if (MB_CUR_MAX > 1) ++ if (MB_CUR_MAX > 1) + { + thisstate = thisline->state; + -+ if (prevline->length == 0 || different_multi -+ (thisfield, prevfield, thislen, prevlen, thisstate, prevstate)) ++ new_group = (prevline->length == 0 || different_multi ++ (thisfield, prevfield, thislen, prevlen, thisstate, prevstate)); ++ ++ if (new_group && grouping != GM_NONE ++ && (grouping == GM_PREPEND || grouping == GM_BOTH ++ || (first_group_printed && (grouping == GM_APPEND ++ || grouping == GM_SEPARATE)))) ++ putchar (delimiter); ++ ++ if (new_group || grouping != GM_NONE) + { + fwrite (thisline->buffer, sizeof (char), + thisline->length, stdout); @@ -3958,14 +3981,35 @@ diff -urNp coreutils-8.21-orig/src/uniq.c coreutils-8.21/src/uniq.c + prevfield = thisfield; + prevlen = thislen; + prevstate = thisstate; ++ first_group_printed = true; + } + } + else ++ { +#endif - if (prevline->length == 0 - || different (thisfield, prevfield, thislen, prevlen)) + + new_group = (prevline->length == 0 + || different (thisfield, prevfield, thislen, prevlen)); +@@ -376,7 +604,7 @@ check_file (const char *infile, const ch + && (grouping == GM_PREPEND || grouping == GM_BOTH + || (first_group_printed && (grouping == GM_APPEND + || grouping == GM_SEPARATE)))) +- putchar (delimiter); ++ putchar (delimiter); + + if (new_group || grouping != GM_NONE) { -@@ -330,17 +549,26 @@ check_file (const char *infile, const ch +@@ -388,6 +616,9 @@ check_file (const char *infile, const ch + prevlen = thislen; + first_group_printed = true; + } ++#if HAVE_MBRTOWC ++ } ++#endif + } + if ((grouping == GM_BOTH || grouping == GM_APPEND) && first_group_printed) + putchar (delimiter); +@@ -398,17 +629,26 @@ check_file (const char *infile, const ch size_t prevlen; uintmax_t match_count = 0; bool first_delimiter = true; @@ -3992,7 +4036,7 @@ diff -urNp coreutils-8.21-orig/src/uniq.c coreutils-8.21/src/uniq.c if (readlinebuffer_delim (thisline, stdin, delimiter) == 0) { if (ferror (stdin)) -@@ -349,6 +577,14 @@ check_file (const char *infile, const ch +@@ -417,6 +657,14 @@ check_file (const char *infile, const ch } thisfield = find_field (thisline); thislen = thisline->length - 1 - (thisfield - thisline->buffer); @@ -4007,7 +4051,7 @@ diff -urNp coreutils-8.21-orig/src/uniq.c coreutils-8.21/src/uniq.c match = !different (thisfield, prevfield, thislen, prevlen); match_count += match; -@@ -381,6 +617,9 @@ check_file (const char *infile, const ch +@@ -449,6 +697,9 @@ check_file (const char *infile, const ch SWAP_LINES (prevline, thisline); prevfield = thisfield; prevlen = thislen; @@ -4017,7 +4061,7 @@ diff -urNp coreutils-8.21-orig/src/uniq.c coreutils-8.21/src/uniq.c if (!match) match_count = 0; } -@@ -426,6 +665,19 @@ main (int argc, char **argv) +@@ -495,6 +746,19 @@ main (int argc, char **argv) atexit (close_stdout); @@ -4037,10 +4081,10 @@ diff -urNp coreutils-8.21-orig/src/uniq.c coreutils-8.21/src/uniq.c skip_chars = 0; skip_fields = 0; check_chars = SIZE_MAX; -diff -urNp coreutils-8.21-orig/tests/local.mk coreutils-8.21/tests/local.mk ---- coreutils-8.21-orig/tests/local.mk 2013-02-15 14:24:32.645654553 +0100 -+++ coreutils-8.21/tests/local.mk 2013-02-15 14:25:07.873467648 +0100 -@@ -325,6 +325,7 @@ all_tests = \ +diff -urNp coreutils-8.22-orig/tests/local.mk coreutils-8.22/tests/local.mk +--- coreutils-8.22-orig/tests/local.mk 2013-12-16 17:39:49.187181544 +0100 ++++ coreutils-8.22/tests/local.mk 2013-12-16 17:40:25.955880566 +0100 +@@ -324,6 +324,7 @@ all_tests = \ tests/misc/sort-discrim.sh \ tests/misc/sort-files0-from.pl \ tests/misc/sort-float.sh \ @@ -4048,31 +4092,39 @@ diff -urNp coreutils-8.21-orig/tests/local.mk coreutils-8.21/tests/local.mk tests/misc/sort-merge.pl \ tests/misc/sort-merge-fdlimit.sh \ tests/misc/sort-month.sh \ -diff -urNp coreutils-8.21-orig/tests/misc/cut.pl coreutils-8.21/tests/misc/cut.pl ---- coreutils-8.21-orig/tests/misc/cut.pl 2013-02-05 00:40:31.000000000 +0100 -+++ coreutils-8.21/tests/misc/cut.pl 2013-02-15 14:27:18.974468564 +0100 -@@ -23,9 +23,10 @@ use strict; +diff -urNp coreutils-8.22-orig/tests/misc/cut.pl coreutils-8.22/tests/misc/cut.pl +--- coreutils-8.22-orig/tests/misc/cut.pl 2013-12-04 15:48:30.000000000 +0100 ++++ coreutils-8.22/tests/misc/cut.pl 2013-12-16 17:40:25.956880230 +0100 +@@ -23,9 +23,11 @@ use strict; # 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' ++my $mb_locale; ++# uncommented enable multibyte paths ++$mb_locale = $ENV{LOCALE_FR_UTF8}; + ! defined $mb_locale || $mb_locale eq 'none' - and $mb_locale = 'C'; -+#my $mb_locale = $ENV{LOCALE_FR_UTF8}; -+#! defined $mb_locale || $mb_locale eq 'none' -+# and $mb_locale = 'C'; -+my $mb_locale = 'C'; ++ and $mb_locale = 'C'; my $prog = 'cut'; my $try = "Try '$prog --help' for more information.\n"; -diff -urNp coreutils-8.21-orig/tests/misc/expand.pl coreutils-8.21/tests/misc/expand.pl ---- coreutils-8.21-orig/tests/misc/expand.pl 2013-01-31 01:46:24.000000000 +0100 -+++ coreutils-8.21/tests/misc/expand.pl 2013-02-15 14:25:07.891468472 +0100 +@@ -225,6 +227,7 @@ if ($mb_locale ne 'C') + my @new_t = @$t; + my $test_name = shift @new_t; + ++ next if ($test_name =~ "newline-[12][0-9]"); + push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}]; + } + push @Tests, @new; +diff -urNp coreutils-8.22-orig/tests/misc/expand.pl coreutils-8.22/tests/misc/expand.pl +--- coreutils-8.22-orig/tests/misc/expand.pl 2013-12-04 15:48:30.000000000 +0100 ++++ coreutils-8.22/tests/misc/expand.pl 2013-12-16 17:40:25.957879894 +0100 @@ -23,6 +23,15 @@ use strict; # Turn off localization of executable's output. @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; -+# uncommented according to upstream commit enabling multibyte paths ++#comment out next line to disable multibyte tests +my $mb_locale = $ENV{LOCALE_FR_UTF8}; +! defined $mb_locale || $mb_locale eq 'none' + and $mb_locale = 'C'; @@ -4122,41 +4174,150 @@ diff -urNp coreutils-8.21-orig/tests/misc/expand.pl coreutils-8.21/tests/misc/ex my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE}; -diff -urNp coreutils-8.21-orig/tests/misc/mb1.I coreutils-8.21/tests/misc/mb1.I ---- coreutils-8.21-orig/tests/misc/mb1.I 1970-01-01 01:00:00.000000000 +0100 -+++ coreutils-8.21/tests/misc/mb1.I 2013-02-15 14:25:07.902467891 +0100 -@@ -0,0 +1,4 @@ -+Apple@10 -+Banana@5 -+Citrus@20 -+Cherry@30 -diff -urNp coreutils-8.21-orig/tests/misc/mb1.X coreutils-8.21/tests/misc/mb1.X ---- coreutils-8.21-orig/tests/misc/mb1.X 1970-01-01 01:00:00.000000000 +0100 -+++ coreutils-8.21/tests/misc/mb1.X 2013-02-15 14:25:07.917467426 +0100 -@@ -0,0 +1,4 @@ -+Banana@5 -+Apple@10 -+Citrus@20 -+Cherry@30 -diff -urNp coreutils-8.21-orig/tests/misc/mb2.I coreutils-8.21/tests/misc/mb2.I ---- coreutils-8.21-orig/tests/misc/mb2.I 1970-01-01 01:00:00.000000000 +0100 -+++ coreutils-8.21/tests/misc/mb2.I 2013-02-15 14:25:07.933467390 +0100 -@@ -0,0 +1,4 @@ -+Apple@AA10@@20 -+Banana@AA5@@30 -+Citrus@AA20@@5 -+Cherry@AA30@@10 -diff -urNp coreutils-8.21-orig/tests/misc/mb2.X coreutils-8.21/tests/misc/mb2.X ---- coreutils-8.21-orig/tests/misc/mb2.X 1970-01-01 01:00:00.000000000 +0100 -+++ coreutils-8.21/tests/misc/mb2.X 2013-02-15 14:25:08.002467808 +0100 -@@ -0,0 +1,4 @@ -+Citrus@AA20@@5 -+Cherry@AA30@@10 -+Apple@AA10@@20 -+Banana@AA5@@30 -diff -urNp coreutils-8.21-orig/tests/misc/sort-mb-tests.sh coreutils-8.21/tests/misc/sort-mb-tests.sh ---- coreutils-8.21-orig/tests/misc/sort-mb-tests.sh 1970-01-01 01:00:00.000000000 +0100 -+++ coreutils-8.21/tests/misc/sort-mb-tests.sh 2013-02-18 17:44:03.852275681 +0100 +diff -urNp coreutils-8.22-orig/tests/misc/fold.pl coreutils-8.22/tests/misc/fold.pl +--- coreutils-8.22-orig/tests/misc/fold.pl 2013-12-04 15:48:30.000000000 +0100 ++++ coreutils-8.22/tests/misc/fold.pl 2013-12-16 17:40:25.958879558 +0100 +@@ -20,9 +20,18 @@ use strict; + + (my $program_name = $0) =~ s|.*/||; + ++my $prog = 'fold'; ++my $try = "Try \`$prog --help' for more information.\n"; ++my $inval = "$prog: invalid byte, character or field list\n$try"; ++ + # Turn off localization of executable's output. + @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; + ++# uncommented to enable multibyte paths ++my $mb_locale = $ENV{LOCALE_FR_UTF8}; ++! defined $mb_locale || $mb_locale eq 'none' ++ and $mb_locale = 'C'; ++ + my @Tests = + ( + ['s1', '-w2 -s', {IN=>"a\t"}, {OUT=>"a\n\t"}], +@@ -31,9 +40,48 @@ my @Tests = + ['s4', '-w4 -s', {IN=>"abc ef\n"}, {OUT=>"abc \nef\n"}], + ); + ++# Add _POSIX2_VERSION=199209 to the environment of each test ++# that uses an old-style option like +1. ++if ($mb_locale ne 'C') ++ { ++ # Duplicate each test vector, appending "-mb" to the test name and ++ # inserting {ENV => "LC_ALL=$mb_locale"} in the copy, so that we ++ # provide coverage for the distro-added multi-byte code paths. ++ my @new; ++ foreach my $t (@Tests) ++ { ++ my @new_t = @$t; ++ my $test_name = shift @new_t; ++ ++ # Depending on whether fold is multi-byte-patched, ++ # it emits different diagnostics: ++ # non-MB: invalid byte or field list ++ # MB: invalid byte, character or field list ++ # Adjust the expected error output accordingly. ++ if (grep {ref $_ eq 'HASH' && exists $_->{ERR} && $_->{ERR} eq $inval} ++ (@new_t)) ++ { ++ my $sub = {ERR_SUBST => 's/, character//'}; ++ push @new_t, $sub; ++ push @$t, $sub; ++ } ++ push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}]; ++ } ++ push @Tests, @new; ++ } ++ ++@Tests = triple_test \@Tests; ++ ++# Remember that triple_test creates from each test with exactly one "IN" ++# file two more tests (.p and .r suffix on name) corresponding to reading ++# input from a file and from a pipe. The pipe-reading test would fail ++# due to a race condition about 1 in 20 times. ++# Remove the IN_PIPE version of the "output-is-input" test above. ++# The others aren't susceptible because they have three inputs each. ++@Tests = grep {$_->[0] ne 'output-is-input.p'} @Tests; ++ + my $save_temps = $ENV{DEBUG}; + my $verbose = $ENV{VERBOSE}; + +-my $prog = 'fold'; + my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose); + exit $fail; +diff -urNp coreutils-8.22-orig/tests/misc/join.pl coreutils-8.22/tests/misc/join.pl +--- coreutils-8.22-orig/tests/misc/join.pl 2013-12-04 15:48:30.000000000 +0100 ++++ coreutils-8.22/tests/misc/join.pl 2013-12-16 17:40:25.959879222 +0100 +@@ -25,6 +25,15 @@ my $limits = getlimits (); + + my $prog = 'join'; + ++my $try = "Try \`$prog --help' for more information.\n"; ++my $inval = "$prog: invalid byte, character or field list\n$try"; ++ ++my $mb_locale; ++#Comment out next line to disable multibyte tests ++$mb_locale = $ENV{LOCALE_FR_UTF8}; ++! defined $mb_locale || $mb_locale eq 'none' ++ and $mb_locale = 'C'; ++ + my $delim = chr 0247; + sub t_subst ($) + { +@@ -326,8 +335,49 @@ foreach my $t (@tv) + push @Tests, $new_ent; + } + ++# Add _POSIX2_VERSION=199209 to the environment of each test ++# that uses an old-style option like +1. ++if ($mb_locale ne 'C') ++ { ++ # Duplicate each test vector, appending "-mb" to the test name and ++ # inserting {ENV => "LC_ALL=$mb_locale"} in the copy, so that we ++ # provide coverage for the distro-added multi-byte code paths. ++ my @new; ++ foreach my $t (@Tests) ++ { ++ my @new_t = @$t; ++ my $test_name = shift @new_t; ++ ++ # Depending on whether join is multi-byte-patched, ++ # it emits different diagnostics: ++ # non-MB: invalid byte or field list ++ # MB: invalid byte, character or field list ++ # Adjust the expected error output accordingly. ++ if (grep {ref $_ eq 'HASH' && exists $_->{ERR} && $_->{ERR} eq $inval} ++ (@new_t)) ++ { ++ my $sub = {ERR_SUBST => 's/, character//'}; ++ push @new_t, $sub; ++ push @$t, $sub; ++ } ++ #Adjust the output some error messages including test_name for mb ++ if (grep {ref $_ eq 'HASH' && exists $_->{ERR}} ++ (@new_t)) ++ { ++ my $sub2 = {ERR_SUBST => "s/$test_name-mb/$test_name/"}; ++ push @new_t, $sub2; ++ push @$t, $sub2; ++ } ++ push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}]; ++ } ++ push @Tests, @new; ++ } ++ + @Tests = triple_test \@Tests; + ++#skip invalid-j-mb test, it is failing because of the format ++@Tests = grep {$_->[0] ne 'invalid-j-mb'} @Tests; ++ + my $save_temps = $ENV{DEBUG}; + my $verbose = $ENV{VERBOSE}; + +diff -urNp coreutils-8.22-orig/tests/misc/sort-mb-tests.sh coreutils-8.22/tests/misc/sort-mb-tests.sh +--- coreutils-8.22-orig/tests/misc/sort-mb-tests.sh 1970-01-01 01:00:00.000000000 +0100 ++++ coreutils-8.22/tests/misc/sort-mb-tests.sh 2013-12-16 17:40:25.959879222 +0100 @@ -0,0 +1,45 @@ +#!/bin/sh +# Verify sort's multi-byte support. @@ -4203,3 +4364,319 @@ diff -urNp coreutils-8.21-orig/tests/misc/sort-mb-tests.sh coreutils-8.21/tests/ +compare exp out || { fail=1; cat out; } + +Exit $fail +diff -urNp coreutils-8.22-orig/tests/misc/sort-merge.pl coreutils-8.22/tests/misc/sort-merge.pl +--- coreutils-8.22-orig/tests/misc/sort-merge.pl 2013-12-04 15:48:30.000000000 +0100 ++++ coreutils-8.22/tests/misc/sort-merge.pl 2013-12-16 17:40:25.960878886 +0100 +@@ -26,6 +26,15 @@ my $prog = 'sort'; + # Turn off localization of executable's output. + @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; + ++my $mb_locale; ++# uncommented according to upstream commit enabling multibyte paths ++$mb_locale = $ENV{LOCALE_FR_UTF8}; ++! defined $mb_locale || $mb_locale eq 'none' ++ and $mb_locale = 'C'; ++ ++my $try = "Try \`$prog --help' for more information.\n"; ++my $inval = "$prog: invalid byte, character or field list\n$try"; ++ + # three empty files and one that says 'foo' + my @inputs = (+(map{{IN=> {"empty$_"=> ''}}}1..3), {IN=> {foo=> "foo\n"}}); + +@@ -77,6 +86,39 @@ my @Tests = + {OUT=>$big_input}], + ); + ++# Add _POSIX2_VERSION=199209 to the environment of each test ++# that uses an old-style option like +1. ++if ($mb_locale ne 'C') ++ { ++ # Duplicate each test vector, appending "-mb" to the test name and ++ # inserting {ENV => "LC_ALL=$mb_locale"} in the copy, so that we ++ # provide coverage for the distro-added multi-byte code paths. ++ my @new; ++ foreach my $t (@Tests) ++ { ++ my @new_t = @$t; ++ my $test_name = shift @new_t; ++ ++ # Depending on whether sort is multi-byte-patched, ++ # it emits different diagnostics: ++ # non-MB: invalid byte or field list ++ # MB: invalid byte, character or field list ++ # Adjust the expected error output accordingly. ++ if (grep {ref $_ eq 'HASH' && exists $_->{ERR} && $_->{ERR} eq $inval} ++ (@new_t)) ++ { ++ my $sub = {ERR_SUBST => 's/, character//'}; ++ push @new_t, $sub; ++ push @$t, $sub; ++ } ++ next if ($test_name =~ "nmerge-."); ++ push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}]; ++ } ++ push @Tests, @new; ++ } ++ ++@Tests = triple_test \@Tests; ++ + my $save_temps = $ENV{DEBUG}; + my $verbose = $ENV{VERBOSE}; + +diff -urNp coreutils-8.22-orig/tests/misc/sort.pl coreutils-8.22/tests/misc/sort.pl +--- coreutils-8.22-orig/tests/misc/sort.pl 2013-12-04 15:48:30.000000000 +0100 ++++ coreutils-8.22/tests/misc/sort.pl 2013-12-16 17:40:25.962878214 +0100 +@@ -24,10 +24,15 @@ 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}; ++my $mb_locale; ++#Comment out next line to disable multibyte tests ++$mb_locale = $ENV{LOCALE_FR_UTF8}; + ! defined $mb_locale || $mb_locale eq 'none' + and $mb_locale = 'C'; + ++my $try = "Try \`$prog --help' for more information.\n"; ++my $inval = "$prog: invalid byte, character or field list\n$try"; ++ + # 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 '-'. +@@ -415,6 +420,37 @@ foreach my $t (@Tests) + } + } + ++if ($mb_locale ne 'C') ++ { ++ # Duplicate each test vector, appending "-mb" to the test name and ++ # inserting {ENV => "LC_ALL=$mb_locale"} in the copy, so that we ++ # provide coverage for the distro-added multi-byte code paths. ++ my @new; ++ foreach my $t (@Tests) ++ { ++ my @new_t = @$t; ++ my $test_name = shift @new_t; ++ ++ # Depending on whether sort is multi-byte-patched, ++ # it emits different diagnostics: ++ # non-MB: invalid byte or field list ++ # MB: invalid byte, character or field list ++ # Adjust the expected error output accordingly. ++ if (grep {ref $_ eq 'HASH' && exists $_->{ERR} && $_->{ERR} eq $inval} ++ (@new_t)) ++ { ++ my $sub = {ERR_SUBST => 's/, character//'}; ++ push @new_t, $sub; ++ push @$t, $sub; ++ } ++ #disable several failing tests until investigation, disable all tests with envvars set ++ next if (grep {ref $_ eq 'HASH' && exists $_->{ENV}} (@new_t)); ++ next if ($test_name =~ "18g" or $test_name =~ "sort-numeric" or $test_name =~ "08[ab]" or $test_name =~ "03[def]" or $test_name =~ "h4" or $test_name =~ "n1" or $test_name =~ "2[01]a"); ++ push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}]; ++ } ++ push @Tests, @new; ++ } ++ + @Tests = triple_test \@Tests; + + # Remember that triple_test creates from each test with exactly one "IN" +@@ -424,6 +460,7 @@ foreach my $t (@Tests) + # Remove the IN_PIPE version of the "output-is-input" test above. + # The others aren't susceptible because they have three inputs each. + @Tests = grep {$_->[0] ne 'output-is-input.p'} @Tests; ++@Tests = grep {$_->[0] ne 'output-is-input-mb.p'} @Tests; + + my $save_temps = $ENV{DEBUG}; + my $verbose = $ENV{VERBOSE}; +diff -urNp coreutils-8.22-orig/tests/misc/unexpand.pl coreutils-8.22/tests/misc/unexpand.pl +--- coreutils-8.22-orig/tests/misc/unexpand.pl 2013-12-04 15:48:30.000000000 +0100 ++++ coreutils-8.22/tests/misc/unexpand.pl 2013-12-16 17:40:25.962878214 +0100 +@@ -27,6 +27,14 @@ my $limits = getlimits (); + + my $prog = 'unexpand'; + ++# comment out next line to disable multibyte tests ++my $mb_locale = $ENV{LOCALE_FR_UTF8}; ++! defined $mb_locale || $mb_locale eq 'none' ++ and $mb_locale = 'C'; ++ ++my $try = "Try \`$prog --help' for more information.\n"; ++my $inval = "$prog: invalid byte, character or field list\n$try"; ++ + my @Tests = + ( + ['a1', {IN=> ' 'x 1 ."y\n"}, {OUT=> ' 'x 1 ."y\n"}], +@@ -92,6 +100,37 @@ my @Tests = + {EXIT => 1}, {ERR => "$prog: tab stop value is too large\n"}], + ); + ++if ($mb_locale ne 'C') ++ { ++ # Duplicate each test vector, appending "-mb" to the test name and ++ # inserting {ENV => "LC_ALL=$mb_locale"} in the copy, so that we ++ # provide coverage for the distro-added multi-byte code paths. ++ my @new; ++ foreach my $t (@Tests) ++ { ++ my @new_t = @$t; ++ my $test_name = shift @new_t; ++ ++ # Depending on whether unexpand is multi-byte-patched, ++ # it emits different diagnostics: ++ # non-MB: invalid byte or field list ++ # MB: invalid byte, character or field list ++ # Adjust the expected error output accordingly. ++ if (grep {ref $_ eq 'HASH' && exists $_->{ERR} && $_->{ERR} eq $inval} ++ (@new_t)) ++ { ++ my $sub = {ERR_SUBST => 's/, character//'}; ++ push @new_t, $sub; ++ push @$t, $sub; ++ } ++ next if ($test_name =~ 'b-1'); ++ push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}]; ++ } ++ push @Tests, @new; ++ } ++ ++@Tests = triple_test \@Tests; ++ + my $save_temps = $ENV{DEBUG}; + my $verbose = $ENV{VERBOSE}; + +diff -urNp coreutils-8.22-orig/tests/misc/uniq.pl coreutils-8.22/tests/misc/uniq.pl +--- coreutils-8.22-orig/tests/misc/uniq.pl 2013-12-04 15:48:30.000000000 +0100 ++++ coreutils-8.22/tests/misc/uniq.pl 2013-12-16 17:41:34.077961751 +0100 +@@ -23,9 +23,17 @@ my $limits = getlimits (); + my $prog = 'uniq'; + my $try = "Try '$prog --help' for more information.\n"; + ++my $inval = "$prog: invalid byte, character or field list\n$try"; ++ + # Turn off localization of executable's output. + @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; + ++my $mb_locale; ++#Comment out next line to disable multibyte tests ++$mb_locale = $ENV{LOCALE_FR_UTF8}; ++! defined $mb_locale || $mb_locale eq 'none' ++ and $mb_locale = 'C'; ++ + # When possible, create a "-z"-testing variant of each test. + sub add_z_variants($) + { +@@ -261,6 +269,45 @@ foreach my $t (@Tests) + and push @$t, {ENV=>'_POSIX2_VERSION=199209'}; + } + ++if ($mb_locale ne 'C') ++ { ++ # Duplicate each test vector, appending "-mb" to the test name and ++ # inserting {ENV => "LC_ALL=$mb_locale"} in the copy, so that we ++ # provide coverage for the distro-added multi-byte code paths. ++ my @new; ++ foreach my $t (@Tests) ++ { ++ my @new_t = @$t; ++ my $test_name = shift @new_t; ++ ++ # Depending on whether uniq is multi-byte-patched, ++ # it emits different diagnostics: ++ # non-MB: invalid byte or field list ++ # MB: invalid byte, character or field list ++ # Adjust the expected error output accordingly. ++ if (grep {ref $_ eq 'HASH' && exists $_->{ERR} && $_->{ERR} eq $inval} ++ (@new_t)) ++ { ++ my $sub = {ERR_SUBST => 's/, character//'}; ++ push @new_t, $sub; ++ push @$t, $sub; ++ } ++ next if ($test_name =~ "schar" or $test_name =~ "^obs-plus" ++ or $test_name =~ "119" or $test_name =~ "145"); ++ push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}]; ++ } ++ push @Tests, @new; ++ } ++ ++# Remember that triple_test creates from each test with exactly one "IN" ++# file two more tests (.p and .r suffix on name) corresponding to reading ++# input from a file and from a pipe. The pipe-reading test would fail ++# due to a race condition about 1 in 20 times. ++# Remove the IN_PIPE version of the "output-is-input" test above. ++# The others aren't susceptible because they have three inputs each. ++ ++@Tests = grep {$_->[0] ne 'output-is-input.p'} @Tests; ++ + @Tests = add_z_variants \@Tests; + @Tests = triple_test \@Tests; + +diff -urNp coreutils-8.22-orig/tests/pr/pr-tests.pl coreutils-8.22/tests/pr/pr-tests.pl +--- coreutils-8.22-orig/tests/pr/pr-tests.pl 2013-12-04 15:48:30.000000000 +0100 ++++ coreutils-8.22/tests/pr/pr-tests.pl 2013-12-16 17:40:25.965877206 +0100 +@@ -23,6 +23,15 @@ use strict; + + my $prog = 'pr'; + ++my $mb_locale; ++#Uncomment the following line to enable multibyte tests ++$mb_locale = $ENV{LOCALE_FR_UTF8}; ++! defined $mb_locale || $mb_locale eq 'none' ++ and $mb_locale = 'C'; ++ ++my $try = "Try \`$prog --help' for more information.\n"; ++my $inval = "$prog: invalid byte, character or field list\n$try"; ++ + my @tv = ( + + # -b option is no longer an official option. But it's still working to +@@ -466,8 +475,48 @@ push @Tests, + {IN=>{3=>"x\ty\tz\n"}}, + {OUT=>join("\t", qw(a b c m n o x y z)) . "\n"} ]; + ++# Add _POSIX2_VERSION=199209 to the environment of each test ++# that uses an old-style option like +1. ++if ($mb_locale ne 'C') ++ { ++ # Duplicate each test vector, appending "-mb" to the test name and ++ # inserting {ENV => "LC_ALL=$mb_locale"} in the copy, so that we ++ # provide coverage for the distro-added multi-byte code paths. ++ my @new; ++ foreach my $t (@Tests) ++ { ++ my @new_t = @$t; ++ my $test_name = shift @new_t; ++ ++ # Depending on whether pr is multi-byte-patched, ++ # it emits different diagnostics: ++ # non-MB: invalid byte or field list ++ # MB: invalid byte, character or field list ++ # Adjust the expected error output accordingly. ++ if (grep {ref $_ eq 'HASH' && exists $_->{ERR} && $_->{ERR} eq $inval} ++ (@new_t)) ++ { ++ my $sub = {ERR_SUBST => 's/, character//'}; ++ push @new_t, $sub; ++ push @$t, $sub; ++ } ++ #temporarily skip some failing tests ++ next if ($test_name =~ "col-0" or $test_name =~ "col-inval"); ++ push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}]; ++ } ++ push @Tests, @new; ++ } ++ + @Tests = triple_test \@Tests; + ++# Remember that triple_test creates from each test with exactly one "IN" ++# file two more tests (.p and .r suffix on name) corresponding to reading ++# input from a file and from a pipe. The pipe-reading test would fail ++# due to a race condition about 1 in 20 times. ++# Remove the IN_PIPE version of the "output-is-input" test above. ++# The others aren't susceptible because they have three inputs each. ++@Tests = grep {$_->[0] ne 'output-is-input.p'} @Tests; ++ + my $save_temps = $ENV{DEBUG}; + my $verbose = $ENV{VERBOSE}; + diff --git a/SOURCES/coreutils-selinux.patch b/SOURCES/coreutils-selinux.patch index a151acb..928ef95 100644 --- a/SOURCES/coreutils-selinux.patch +++ b/SOURCES/coreutils-selinux.patch @@ -1,34 +1,17 @@ -diff -urNp coreutils-8.21-orig/configure.ac coreutils-8.21/configure.ac ---- coreutils-8.21-orig/configure.ac 2013-01-31 01:46:24.000000000 +0100 -+++ coreutils-8.21/configure.ac 2013-02-15 14:31:58.937482694 +0100 -@@ -204,6 +204,13 @@ if test "$gl_gcc_warnings" = yes; then - AC_SUBST([GNULIB_TEST_WARN_CFLAGS]) - fi - -+dnl Give the chance to enable SELINUX -+AC_ARG_ENABLE(selinux, dnl -+[ --enable-selinux Enable use of the SELINUX libraries], -+[AC_DEFINE(WITH_SELINUX, 1, [Define if you want to use SELINUX]) -+LIB_SELINUX="-lselinux" -+AC_SUBST(LIB_SELINUX)]) -+ - AC_FUNC_FORK - - optional_bin_progs= diff -urNp coreutils-8.21-orig/init.cfg coreutils-8.21/init.cfg --- coreutils-8.21-orig/init.cfg 2013-01-31 01:46:24.000000000 +0100 +++ coreutils-8.21/init.cfg 2013-02-15 14:31:58.957469955 +0100 @@ -308,8 +308,8 @@ require_selinux_() - # Independent of whether SELinux is enabled system-wide, # the current file system may lack SELinux support. + # Also the current build may have SELinux support disabled. - case $(ls -Zd .) in - '? .'|'unlabeled .') + case $(ls -Zd . | cut -f4 -d" ") in + '?'|'unlabeled') - skip_ "this system (or maybe just" \ - "the current file system) lacks SELinux support" - ;; + test -z "$CONFIG_HEADER" \ + && framework_failure_ 'CONFIG_HEADER not defined' + grep '^#define HAVE_SELINUX_SELINUX_H 1' "$CONFIG_HEADER" > /dev/null \ diff -urNp coreutils-8.21-orig/man/chcon.x coreutils-8.21/man/chcon.x --- coreutils-8.21-orig/man/chcon.x 2011-08-23 15:44:01.000000000 +0200 +++ coreutils-8.21/man/chcon.x 2013-02-15 14:31:58.937482694 +0100 @@ -48,22 +31,28 @@ diff -urNp coreutils-8.21-orig/man/runcon.x coreutils-8.21/man/runcon.x [DESCRIPTION] Run COMMAND with completely-specified CONTEXT, or with current or transitioned security context modified by one or more of LEVEL, -diff -urNp coreutils-8.21-orig/src/chcon.c coreutils-8.21/src/chcon.c ---- coreutils-8.21-orig/src/chcon.c 2013-01-31 01:46:24.000000000 +0100 -+++ coreutils-8.21/src/chcon.c 2013-02-15 14:31:58.939469828 +0100 -@@ -355,7 +355,7 @@ Usage: %s [OPTION]... CONTEXT FILE...\n\ - "), - program_name, program_name, program_name); - fputs (_("\ --Change the security context of each FILE to CONTEXT.\n\ -+Change the SELinux security context of each FILE to CONTEXT.\n\ - With --reference, change the security context of each FILE to that of RFILE.\n\ - "), stdout); - diff -urNp coreutils-8.21-orig/src/copy.c coreutils-8.21/src/copy.c --- coreutils-8.21-orig/src/copy.c 2013-02-07 10:37:05.000000000 +0100 +++ coreutils-8.21/src/copy.c 2013-02-15 14:31:58.941467872 +0100 -@@ -2315,6 +2315,8 @@ copy_internal (char const *src_name, cha +@@ -2410,6 +2410,17 @@ copy_internal (char const *src_name, cha + else + { + omitted_permissions = 0; ++ ++ /* For directories, the process global context could be reset for ++ descendents, so use it to set the context for existing dirs here. ++ This will also give earlier indication of failure to set ctx. */ ++ if (x->set_security_context || x->preserve_security_context) ++ if (! set_file_security_ctx (dst_name, x->preserve_security_context, ++ false, x)) ++ { ++ if (x->require_preserve_context) ++ goto un_backup; ++ } + } + + /* Decide whether to copy the contents of the directory. */ +@@ -2415,6 +2426,8 @@ copy_internal (char const *src_name, cha { /* Here, we are crossing a file system boundary and cp's -x option is in effect: so don't copy the contents of this directory. */ @@ -72,70 +61,43 @@ diff -urNp coreutils-8.21-orig/src/copy.c coreutils-8.21/src/copy.c } else { -diff -urNp coreutils-8.21-orig/src/copy.h coreutils-8.21/src/copy.h ---- coreutils-8.21-orig/src/copy.h 2013-01-31 01:46:24.000000000 +0100 -+++ coreutils-8.21/src/copy.h 2013-02-15 14:31:58.943470982 +0100 -@@ -159,6 +159,9 @@ struct cp_options - bool preserve_timestamps; - bool explicit_no_preserve_mode; - -+ /* If true, attempt to set specified security context */ -+ bool set_security_context; -+ - /* Enabled for mv, and for cp by the --preserve=links option. - If true, attempt to preserve in the destination files any - logical hard links between the source files. If used with cp's +@@ -2602,7 +2613,7 @@ copy_internal (char const *src_name, cha + + /* With -Z or --preserve=context, set the context for existing files. + Note this is done already for copy_reg() for reasons described therein. */ +- if (!new_dst && !x->copy_as_regular ++ if (!new_dst && !x->copy_as_regular && !S_ISDIR (src_mode) + && (x->set_security_context || x->preserve_security_context)) + { + if (! set_file_security_ctx (dst_name, x->preserve_security_context, diff -urNp coreutils-8.21-orig/src/cp.c coreutils-8.21/src/cp.c --- coreutils-8.21-orig/src/cp.c 2013-02-07 10:37:05.000000000 +0100 +++ coreutils-8.21/src/cp.c 2013-02-15 14:31:58.945468929 +0100 -@@ -141,6 +141,7 @@ static struct option const long_opts[] = - {"target-directory", required_argument, NULL, 't'}, - {"update", no_argument, NULL, 'u'}, - {"verbose", no_argument, NULL, 'v'}, -+ {"context", required_argument, NULL, 'Z'}, - {GETOPT_HELP_OPTION_DECL}, - {GETOPT_VERSION_OPTION_DECL}, - {NULL, 0, NULL, 0} @@ -201,6 +202,9 @@ Copy SOURCE to DEST, or multiple SOURCE( all\n\ "), stdout); fputs (_("\ -+ -c same as --preserve=context\n\ ++ -c deprecated, same as --preserve=context\n\ +"), stdout); + fputs (_("\ --no-preserve=ATTR_LIST don't preserve the specified attributes\n\ --parents use full source file name under DIRECTORY\n\ "), stdout); -@@ -227,6 +231,7 @@ Copy SOURCE to DEST, or multiple SOURCE( - destination file is missing\n\ - -v, --verbose explain what is being done\n\ - -x, --one-file-system stay on this file system\n\ -+ -Z, --context=CONTEXT set security context of copy to CONTEXT\n\ - "), stdout); - fputs (HELP_OPTION_DESCRIPTION, stdout); - fputs (VERSION_OPTION_DESCRIPTION, stdout); -@@ -784,6 +789,7 @@ cp_option_init (struct cp_options *x) - x->explicit_no_preserve_mode = false; - x->preserve_security_context = false; - x->require_preserve_context = false; -+ x->set_security_context = false; - x->preserve_xattr = false; - x->reduce_diagnostics = false; - x->require_preserve_xattr = false; @@ -933,7 +939,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, "abdfHilLnprst:uvxPRS:T", -+ while ((c = getopt_long (argc, argv, "abcdfHilLnprst:uvxPRS:TZ:", +- while ((c = getopt_long (argc, argv, "abdfHilLnprst:uvxPRS:TZ", ++ while ((c = getopt_long (argc, argv, "abcdfHilLnprst:uvxPRS:TZ", long_opts, NULL)) != -1) { -@@ -981,6 +987,16 @@ main (int argc, char **argv) +@@ -981,6 +987,17 @@ main (int argc, char **argv) copy_contents = true; break; + case 'c': ++ fprintf (stderr, "%s: warning: option '-c' is deprecated, please use '--preserve=context' instead\n", argv[0]); + if ( x.set_security_context ) { + (void) fprintf(stderr, "%s: cannot force target context and preserve it\n", argv[0]); + exit( 1 ); @@ -148,34 +110,6 @@ diff -urNp coreutils-8.21-orig/src/cp.c coreutils-8.21/src/cp.c case 'd': x.preserve_links = true; x.dereference = DEREF_NEVER; -@@ -1091,6 +1107,27 @@ main (int argc, char **argv) - x.one_file_system = true; - break; - -+ -+ case 'Z': -+ /* politely decline if we're not on a selinux-enabled kernel. */ -+ if( !selinux_enabled ) { -+ fprintf( stderr, "Warning: ignoring --context (-Z). " -+ "It requires a SELinux enabled kernel.\n" ); -+ break; -+ } -+ if ( x.preserve_security_context ) { -+ (void) fprintf(stderr, "%s: cannot force target context to '%s' and preserve it\n", argv[0], optarg); -+ exit( 1 ); -+ } -+ x.set_security_context = true; -+ /* if there's a security_context given set new path -+ components to that context, too */ -+ if ( setfscreatecon(optarg) < 0 ) { -+ (void) fprintf(stderr, _("cannot set default security context %s\n"), optarg); -+ exit( 1 ); -+ } -+ break; -+ - case 'S': - make_backups = true; - backup_suffix_string = optarg; diff -urNp coreutils-8.21-orig/src/id.c coreutils-8.21/src/id.c --- coreutils-8.21-orig/src/id.c 2013-01-31 01:46:24.000000000 +0100 +++ coreutils-8.21/src/id.c 2013-02-15 14:31:58.946469154 +0100 @@ -185,45 +119,38 @@ diff -urNp coreutils-8.21-orig/src/id.c coreutils-8.21/src/id.c int optc; - int selinux_enabled = (is_selinux_enabled () > 0); + bool selinux_enabled = (is_selinux_enabled () > 0); - - /* If true, output the list of all group IDs. -G */ - bool just_group_list = false; + bool smack_enabled = is_smack_enabled (); + bool opt_zero = false; + char *pw_name = NULL; diff -urNp coreutils-8.21-orig/src/install.c coreutils-8.21/src/install.c --- coreutils-8.21-orig/src/install.c 2013-02-07 10:37:05.000000000 +0100 +++ coreutils-8.21/src/install.c 2013-02-15 14:31:58.948469440 +0100 -@@ -280,6 +280,7 @@ cp_option_init (struct cp_options *x) - x->data_copy_required = true; - x->require_preserve = false; - x->require_preserve_context = false; -+ x->set_security_context = false; - x->require_preserve_xattr = false; - x->recursive = false; - x->sparse_mode = SPARSE_AUTO; @@ -639,7 +640,7 @@ In the 4th form, create all components o -v, --verbose print the name of each directory as it is created\n\ "), stdout); fputs (_("\ - --preserve-context preserve SELinux security context\n\ -+ -P, --preserve-context preserve SELinux security context\n\ - -Z, --context=CONTEXT set SELinux security context of files and directories\ - \n\ ++ -P, --preserve-context preserve SELinux security context (-P deprecated)\n\ + -Z, --context[=CTX] set SELinux security context of destination file to\n\ + default type, or to CTX if specified\n\ "), stdout); @@ -782,7 +783,7 @@ main (int argc, char **argv) we'll actually use backup_suffix_string. */ backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX"); -- while ((optc = getopt_long (argc, argv, "bcCsDdg:m:o:pt:TvS:Z:", long_options, -+ while ((optc = getopt_long (argc, argv, "bcCsDdg:m:o:pPt:TvS:Z:", long_options, +- while ((optc = getopt_long (argc, argv, "bcCsDdg:m:o:pt:TvS:Z", long_options, ++ while ((optc = getopt_long (argc, argv, "bcCsDdg:m:o:pPt:TvS:Z", long_options, NULL)) != -1) { switch (optc) -@@ -853,6 +854,7 @@ main (int argc, char **argv) +@@ -853,6 +854,8 @@ main (int argc, char **argv) no_target_directory = true; break; + case 'P': ++ fprintf (stderr, "%s: warning: option '-P' is deprecated, please use '--preserve-context' instead\n", argv[0]); case PRESERVE_CONTEXT_OPTION: - if ( ! selinux_enabled) + if (! selinux_enabled) { @@ -860,6 +862,10 @@ main (int argc, char **argv) "this kernel is not SELinux-enabled")); @@ -236,14 +163,6 @@ diff -urNp coreutils-8.21-orig/src/install.c coreutils-8.21/src/install.c x.preserve_security_context = true; use_default_selinux_context = false; break; -@@ -871,6 +877,7 @@ main (int argc, char **argv) - break; - } - scontext = optarg; -+ x.set_security_context = true; - use_default_selinux_context = false; - break; - case_GETOPT_HELP_CHAR; diff -urNp coreutils-8.21-orig/src/ls.c coreutils-8.21/src/ls.c --- coreutils-8.21-orig/src/ls.c 2013-02-03 04:24:02.000000000 +0100 +++ coreutils-8.21/src/ls.c 2013-02-15 14:31:58.953469008 +0100 @@ -411,7 +330,7 @@ diff -urNp coreutils-8.21-orig/src/ls.c coreutils-8.21/src/ls.c - if (format == long_format || print_scontext) + if (format == long_format || format == security_format || print_scontext) { - bool have_selinux = false; + bool have_scontext = false; bool have_acl = false; @@ -3016,7 +3041,7 @@ gobble_file (char const *name, enum file err = 0; @@ -596,52 +515,6 @@ diff -urNp coreutils-8.21-orig/src/ls.c coreutils-8.21/src/ls.c fputs (HELP_OPTION_DESCRIPTION, stdout); fputs (VERSION_OPTION_DESCRIPTION, stdout); emit_size_note (); -diff -urNp coreutils-8.21-orig/src/mkdir.c coreutils-8.21/src/mkdir.c ---- coreutils-8.21-orig/src/mkdir.c 2013-01-31 01:46:24.000000000 +0100 -+++ coreutils-8.21/src/mkdir.c 2013-02-15 14:31:58.954469576 +0100 -@@ -38,6 +38,7 @@ - static struct option const longopts[] = - { - {GETOPT_SELINUX_CONTEXT_OPTION_DECL}, -+ {"context", required_argument, NULL, 'Z'}, - {"mode", required_argument, NULL, 'm'}, - {"parents", no_argument, NULL, 'p'}, - {"verbose", no_argument, NULL, 'v'}, -diff -urNp coreutils-8.21-orig/src/mknod.c coreutils-8.21/src/mknod.c ---- coreutils-8.21-orig/src/mknod.c 2013-01-31 01:46:24.000000000 +0100 -+++ coreutils-8.21/src/mknod.c 2013-02-15 14:31:58.955470548 +0100 -@@ -35,7 +35,7 @@ - - static struct option const longopts[] = - { -- {GETOPT_SELINUX_CONTEXT_OPTION_DECL}, -+ {GETOPT_SELINUX_CONTEXT_OPTION_DECL}, - {"mode", required_argument, NULL, 'm'}, - {GETOPT_HELP_OPTION_DECL}, - {GETOPT_VERSION_OPTION_DECL}, -diff -urNp coreutils-8.21-orig/src/mv.c coreutils-8.21/src/mv.c ---- coreutils-8.21-orig/src/mv.c 2013-02-07 10:37:05.000000000 +0100 -+++ coreutils-8.21/src/mv.c 2013-02-15 14:31:58.956469593 +0100 -@@ -120,6 +120,7 @@ cp_option_init (struct cp_options *x) - x->preserve_timestamps = true; - x->explicit_no_preserve_mode= false; - x->preserve_security_context = selinux_enabled; -+ x->set_security_context = false; - x->reduce_diagnostics = false; - x->data_copy_required = true; - x->require_preserve = false; /* FIXME: maybe make this an option */ -diff -urNp coreutils-8.21-orig/src/runcon.c coreutils-8.21/src/runcon.c ---- coreutils-8.21-orig/src/runcon.c 2013-01-31 01:46:24.000000000 +0100 -+++ coreutils-8.21/src/runcon.c 2013-02-15 14:31:58.956469593 +0100 -@@ -85,7 +85,7 @@ Usage: %s CONTEXT COMMAND [args]\n\ - or: %s [ -c ] [-u USER] [-r ROLE] [-t TYPE] [-l RANGE] COMMAND [args]\n\ - "), program_name, program_name); - fputs (_("\ --Run a program in a different security context.\n\ -+Run a program in a different SELinux security context.\n\ - With neither CONTEXT nor COMMAND, print the current security context.\n\ - "), stdout); - diff -urNp coreutils-8.21-orig/tests/misc/selinux.sh coreutils-8.21/tests/misc/selinux.sh --- coreutils-8.21-orig/tests/misc/selinux.sh 2013-01-31 01:46:24.000000000 +0100 +++ coreutils-8.21/tests/misc/selinux.sh 2013-02-15 14:31:58.957469955 +0100 diff --git a/SPECS/coreutils.spec b/SPECS/coreutils.spec index 9af6758..5cbcc89 100644 --- a/SPECS/coreutils.spec +++ b/SPECS/coreutils.spec @@ -1,7 +1,7 @@ Summary: A set of basic GNU tools commonly used in shell scripts Name: coreutils -Version: 8.21 -Release: 13%{?dist} +Version: 8.22 +Release: 11%{?dist} License: GPLv3+ Group: System Environment/Base Url: http://www.gnu.org/software/coreutils/ @@ -13,9 +13,7 @@ Source105: coreutils-colorls.sh Source106: coreutils-colorls.csh # From upstream -Patch1: coreutils-8.21-install-strip.patch -Patch2: coreutils-aarch64-longlong.patch -Patch3: coreutils-cp-nopreserve-invalidargs.patch +Patch1: coreutils-8.22-cp-selinux.patch # Our patches #general patch to workaround koji build system issues @@ -43,13 +41,13 @@ Patch800: coreutils-i18n.patch Patch908: coreutils-getgrouplist.patch #Prevent buffer overflow in who(1) (bug #158405). Patch912: coreutils-overflow.patch +#Temporarily disable df symlink test, failing +Patch913: coreutils-8.22-temporarytestoff.patch #SELINUX Patch - implements Redhat changes #(upstream did some SELinux implementation unlike with RedHat patch) Patch950: coreutils-selinux.patch Patch951: coreutils-selinuxmanpages.patch -#Deprecate cp -Z/--context non-upstream option -Patch952: coreutils-cpZ-deprecate.patch Conflicts: filesystem < 3 Provides: /bin/basename @@ -92,6 +90,7 @@ BuildRequires: autoconf BuildRequires: automake BuildRequires: libcap-devel BuildRequires: libattr-devel +BuildRequires: openssl-devel BuildRequires: gmp-devel BuildRequires: attr BuildRequires: strace @@ -128,9 +127,7 @@ the old GNU fileutils, sh-utils, and textutils packages. %setup -q # From upstream -%patch1 -p1 -b .strip -%patch2 -p1 -b .aarch64 -%patch3 -p1 -b .nopres +%patch1 -p1 -b .nullcontext # Our patches %patch100 -p1 -b .configure @@ -150,13 +147,13 @@ the old GNU fileutils, sh-utils, and textutils packages. # Coreutils %patch908 -p1 -b .getgrouplist %patch912 -p1 -b .overflow +%patch913 -p1 -b .testoff #SELinux %patch950 -p1 -b .selinux %patch951 -p1 -b .selinuxman -%patch952 -p1 -b .cpZ -chmod a+x tests/misc/sort-mb-tests.sh tests/df/direct.sh || : +chmod a+x tests/misc/sort-mb-tests.sh tests/df/direct.sh tests/cp/no-ctx.sh || : #fix typos/mistakes in localized documentation(#439410, #440056) find ./po/ -name "*.p*" | xargs \ @@ -172,7 +169,7 @@ aclocal -I m4 autoconf --force automake --copy --add-missing %configure --enable-largefile \ - %{?!noselinux:--enable-selinux} \ + --with-openssl=optional ac_cv_lib_crypto_MD5=no \ --enable-install-program=hostname,arch \ --with-tty-group \ DEFAULT_POSIX2_VERSION=200112 alternative=199209 || : @@ -377,6 +374,57 @@ fi %{_sbindir}/chroot %changelog +* Fri Jan 24 2014 Daniel Mach - 8.22-11 +- Mass rebuild 2014-01-24 + +* Mon Jan 13 2014 Ondrej Vasik 8.22-10 +- cp/mv/install: do not crash when getfscreatecon() is + returning a NULL context +- fix the cut optimizations to UTF-8 locales only +- unset the unnecessary envvars after colorls scripts + +* Fri Jan 10 2014 Ondrej Oprala 8.22-9 +- Only use cut optimizations for UTF-8 locales (#1021403) + +* Mon Jan 06 2014 Ondrej Oprala 8.22-8 +- Don't use cut mb path if not necessary (#1021403) + +* Mon Jan 06 2014 Ondrej Oprala 8.22-7 +- Fix sorting by non-first field (#1003544) + +* Fri Jan 03 2014 Ondrej Vasik 8.22-5 +- do not modify SELinux contexts of existing parent + directories when copying files (fix by P.Brady, #1045122) + +* Fri Jan 03 2014 Ondrej Oprala 8.22-4 +- revert an old sort change and constrict it's condition + +* Thu Jan 02 2014 Ondrej Vasik 8.22-3 +- mark deprecated SELinux related downstream options as + deprecated in usage/man +- temporarily disable setting SELinux contexts recursively + for existing directories - broken (#1045122) + +* Fri Dec 27 2013 Daniel Mach - 8.22-2 +- Mass rebuild 2013-12-27 + +* Tue Dec 17 2013 Ondrej Vasik 8.22-1 +- new upstream version 8.22 (#1043552) +- temporarily df symlink test (incomplete upstream fix, not + regression) +- enable build with openssl for better performance of + HASHsum utilities (not for md5sum because of FIPS) +- turn on the multibyte path in the testsuite to cover + i18n regressions +- fix possible colorls.csh script errors for tcsh with + noclobber set and entered include file + +* Thu Nov 28 2013 Ondrej Vasik 8.21-14 +- mv: fails to overwrite directory on cross-filesystem + copy with EISDIR (#1035224) +- tail -F does not handle dead symlinks gracefully + (#1035219) + * Mon Oct 14 2013 Ondrej Vasik 8.21-13 - cp: correct error message for invalid arguments of '--no-preserve' (#1018206)