diff --git a/coreutils-8.25-i18n-1.patch b/coreutils-8.26-i18n-1.patch similarity index 73% rename from coreutils-8.25-i18n-1.patch rename to coreutils-8.26-i18n-1.patch index 2d68d92..485ce3d 100644 --- a/coreutils-8.25-i18n-1.patch +++ b/coreutils-8.26-i18n-1.patch @@ -1,15 +1,15 @@ Submitted by: DJ Lucas (dj_AT_linuxfromscratch_DOT_org) -Date: 2016-01-22 -Initial Package Version: 8.22 +Date: 2016-12-03 +Initial Package Version: 8.26 Upstream Status: Rejected -Origin: Based on Fedora's i18n patches at - http://pkgs.fedoraproject.org/cgit/rpms/coreutils.git/tree/ -Description: Fixes several i18n issues with various Coreutils programs +Origin: Based on Suse's i18n patches at + https://build.opensuse.org/package/show/Base:System/coreutils/ +Description: Fixes i18n issues with various Coreutils programs -diff -Naurp coreutils-8.25-orig/bootstrap.conf coreutils-8.25/bootstrap.conf ---- coreutils-8.25-orig/bootstrap.conf 2016-01-01 07:48:50.000000000 -0600 -+++ coreutils-8.25/bootstrap.conf 2016-01-22 21:23:04.634308804 -0600 -@@ -151,6 +151,7 @@ gnulib_modules=" +diff -Naurp coreutils-8.26-orig/bootstrap.conf coreutils-8.26/bootstrap.conf +--- coreutils-8.26-orig/bootstrap.conf 2016-11-06 16:15:29.000000000 -0600 ++++ coreutils-8.26/bootstrap.conf 2016-12-02 19:15:23.514391986 -0600 +@@ -152,6 +152,7 @@ gnulib_modules=" maintainer-makefile malloc-gnu manywarnings @@ -17,10 +17,10 @@ diff -Naurp coreutils-8.25-orig/bootstrap.conf coreutils-8.25/bootstrap.conf mbrlen mbrtowc mbsalign -diff -Naurp coreutils-8.25-orig/configure.ac coreutils-8.25/configure.ac ---- coreutils-8.25-orig/configure.ac 2016-01-01 07:48:50.000000000 -0600 -+++ coreutils-8.25/configure.ac 2016-01-22 21:23:04.634308804 -0600 -@@ -425,6 +425,8 @@ fi +diff -Naurp coreutils-8.26-orig/configure.ac coreutils-8.26/configure.ac +--- coreutils-8.26-orig/configure.ac 2016-11-29 12:03:45.000000000 -0600 ++++ coreutils-8.26/configure.ac 2016-12-02 19:15:23.515391902 -0600 +@@ -427,6 +427,8 @@ fi # I'm leaving it here for now. This whole thing needs to be modernized... gl_WINSIZE_IN_PTEM @@ -29,9 +29,9 @@ diff -Naurp coreutils-8.25-orig/configure.ac coreutils-8.25/configure.ac gl_HEADER_TIOCGWINSZ_IN_TERMIOS_H if test $gl_cv_sys_tiocgwinsz_needs_termios_h = no && \ -diff -Naurp coreutils-8.25-orig/lib/linebuffer.h coreutils-8.25/lib/linebuffer.h ---- coreutils-8.25-orig/lib/linebuffer.h 2016-01-01 07:45:55.000000000 -0600 -+++ coreutils-8.25/lib/linebuffer.h 2016-01-22 21:23:04.597639947 -0600 +diff -Naurp coreutils-8.26-orig/lib/linebuffer.h coreutils-8.26/lib/linebuffer.h +--- coreutils-8.26-orig/lib/linebuffer.h 2016-07-15 14:47:39.000000000 -0500 ++++ coreutils-8.26/lib/linebuffer.h 2016-12-02 19:15:23.515391902 -0600 @@ -21,6 +21,11 @@ # include @@ -54,16 +54,16 @@ diff -Naurp coreutils-8.25-orig/lib/linebuffer.h coreutils-8.25/lib/linebuffer.h }; /* Initialize linebuffer LINEBUFFER for use. */ -diff -Naurp coreutils-8.25-orig/lib/mbfile.c coreutils-8.25/lib/mbfile.c ---- coreutils-8.25-orig/lib/mbfile.c 1969-12-31 18:00:00.000000000 -0600 -+++ coreutils-8.25/lib/mbfile.c 2016-01-22 21:23:04.644309401 -0600 +diff -Naurp coreutils-8.26-orig/lib/mbfile.c coreutils-8.26/lib/mbfile.c +--- coreutils-8.26-orig/lib/mbfile.c 1969-12-31 18:00:00.000000000 -0600 ++++ coreutils-8.26/lib/mbfile.c 2016-12-02 19:15:23.515391902 -0600 @@ -0,0 +1,3 @@ +#include +#define MBFILE_INLINE _GL_EXTERN_INLINE +#include "mbfile.h" -diff -Naurp coreutils-8.25-orig/lib/mbfile.h coreutils-8.25/lib/mbfile.h ---- coreutils-8.25-orig/lib/mbfile.h 1969-12-31 18:00:00.000000000 -0600 -+++ coreutils-8.25/lib/mbfile.h 2016-01-22 21:23:04.644309401 -0600 +diff -Naurp coreutils-8.26-orig/lib/mbfile.h coreutils-8.26/lib/mbfile.h +--- coreutils-8.26-orig/lib/mbfile.h 1969-12-31 18:00:00.000000000 -0600 ++++ coreutils-8.26/lib/mbfile.h 2016-12-02 19:15:23.516391818 -0600 @@ -0,0 +1,255 @@ +/* Multibyte character I/O: macros for multi-byte encodings. + Copyright (C) 2001, 2005, 2009-2015 Free Software Foundation, Inc. @@ -320,9 +320,9 @@ diff -Naurp coreutils-8.25-orig/lib/mbfile.h coreutils-8.25/lib/mbfile.h +_GL_INLINE_HEADER_BEGIN + +#endif /* _MBFILE_H */ -diff -Naurp coreutils-8.25-orig/m4/mbfile.m4 coreutils-8.25/m4/mbfile.m4 ---- coreutils-8.25-orig/m4/mbfile.m4 1969-12-31 18:00:00.000000000 -0600 -+++ coreutils-8.25/m4/mbfile.m4 2016-01-22 21:23:04.640975869 -0600 +diff -Naurp coreutils-8.26-orig/m4/mbfile.m4 coreutils-8.26/m4/mbfile.m4 +--- coreutils-8.26-orig/m4/mbfile.m4 1969-12-31 18:00:00.000000000 -0600 ++++ coreutils-8.26/m4/mbfile.m4 2016-12-02 19:15:23.516391818 -0600 @@ -0,0 +1,14 @@ +# mbfile.m4 serial 7 +dnl Copyright (C) 2005, 2008-2015 Free Software Foundation, Inc. @@ -338,535 +338,456 @@ diff -Naurp coreutils-8.25-orig/m4/mbfile.m4 coreutils-8.25/m4/mbfile.m4 + AC_REQUIRE([AC_TYPE_MBSTATE_T]) + : +]) -diff -Naurp coreutils-8.25-orig/po/POTFILES.in coreutils-8.25/po/POTFILES.in ---- coreutils-8.25-orig/po/POTFILES.in 2016-01-01 07:48:50.000000000 -0600 -+++ coreutils-8.25/po/POTFILES.in 2016-01-22 21:23:04.634308804 -0600 -@@ -57,6 +57,7 @@ src/dirname.c - src/du.c - src/echo.c - src/env.c -+src/expand-core.c - src/expand.c - src/expr.c - src/factor.c -diff -Naurp coreutils-8.25-orig/src/cut.c coreutils-8.25/src/cut.c ---- coreutils-8.25-orig/src/cut.c 2016-01-13 05:08:59.000000000 -0600 -+++ coreutils-8.25/src/cut.c 2016-01-22 21:23:04.630975272 -0600 +diff -Naurp coreutils-8.26-orig/src/cut.c coreutils-8.26/src/cut.c +--- coreutils-8.26-orig/src/cut.c 2016-10-15 16:00:55.000000000 -0500 ++++ coreutils-8.26/src/cut.c 2016-12-02 19:15:23.517391733 -0600 @@ -28,6 +28,11 @@ #include #include #include + -+#include -+#include -+#include -+ ++/* Get mbstate_t, mbrtowc(). */ ++#if HAVE_WCHAR_H ++# include ++#endif #include "system.h" #include "error.h" -@@ -61,25 +66,16 @@ +@@ -38,6 +43,18 @@ + + #include "set-fields.h" + ++/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC ++ installation; work around this configuration error. */ ++#if !defined MB_LEN_MAX || MB_LEN_MAX < 2 ++# undef MB_LEN_MAX ++# define MB_LEN_MAX 16 ++#endif ++ ++/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */ ++#if HAVE_MBRTOWC && defined mbstate_t ++# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0) ++#endif ++ + /* The official name of this program (e.g., no 'g' prefix). */ + #define PROGRAM_NAME "cut" + +@@ -54,6 +71,52 @@ + } \ + while (0) + ++/* Refill the buffer BUF to get a multibyte character. */ ++#define REFILL_BUFFER(BUF, BUFPOS, BUFLEN, STREAM) \ ++ do \ ++ { \ ++ if (BUFLEN < MB_LEN_MAX && !feof (STREAM) && !ferror (STREAM)) \ ++ { \ ++ memmove (BUF, BUFPOS, BUFLEN); \ ++ BUFLEN += fread (BUF + BUFLEN, sizeof(char), BUFSIZ, STREAM); \ ++ BUFPOS = BUF; \ ++ } \ ++ } \ ++ while (0) ++ ++/* Get wide character on BUFPOS. BUFPOS is not included after that. ++ If byte sequence is not valid as a character, CONVFAIL is true. Otherwise false. */ ++#define GET_NEXT_WC_FROM_BUFFER(WC, BUFPOS, BUFLEN, MBLENGTH, STATE, CONVFAIL) \ ++ do \ ++ { \ ++ mbstate_t state_bak; \ ++ \ ++ if (BUFLEN < 1) \ ++ { \ ++ WC = WEOF; \ ++ break; \ ++ } \ ++ \ ++ /* Get a wide character. */ \ ++ CONVFAIL = false; \ ++ state_bak = STATE; \ ++ MBLENGTH = mbrtowc ((wchar_t *)&WC, BUFPOS, BUFLEN, &STATE); \ ++ \ ++ switch (MBLENGTH) \ ++ { \ ++ case (size_t)-1: \ ++ case (size_t)-2: \ ++ CONVFAIL = true; \ ++ STATE = state_bak; \ ++ /* Fall througn. */ \ ++ \ ++ case 0: \ ++ MBLENGTH = 1; \ ++ break; \ ++ } \ ++ } \ ++ while (0) ++ + + /* Pointer inside RP. When checking if a byte or field is selected + by a finite range, we check if it is between CURRENT_RP.LO +@@ -61,6 +124,9 @@ CURRENT_RP.HI then we make CURRENT_RP to point to the next range pair. */ static struct field_range_pair *current_rp; --/* This buffer is used to support the semantics of the -s option -- (or lack of same) when the specified field list includes (does -- not include) the first field. In both of those cases, the entire -- first field must be read into this buffer to determine whether it -- is followed by a delimiter or a newline before any of it may be -- output. Otherwise, cut_fields can do the job without using this -- buffer. */ --static char *field_1_buffer; -- --/* The number of bytes allocated for FIELD_1_BUFFER. */ --static size_t field_1_bufsize; -- - enum operating_mode ++/* Length of the delimiter given as argument to -d. */ ++size_t delimlen; ++ + /* This buffer is used to support the semantics of the -s option + (or lack of same) when the specified field list includes (does + not include) the first field. In both of those cases, the entire +@@ -77,15 +143,25 @@ enum operating_mode { undefined_mode, - /* Output characters that are in the given bytes. */ -+ /* Output the given bytes. */ ++ /* Output bytes that are at the given positions. */ byte_mode, -+ /* Output characters that are in the given positions . */ -+ char_mode, ++ /* Output characters that are at the given positions. */ ++ character_mode, + /* Output the given delimiter-separated fields. */ field_mode }; -@@ -91,12 +87,16 @@ static enum operating_mode operating_mod - with field mode. */ - static bool suppress_non_delimited; -+/* Unless true, we do not recognize multibyte characters in byte-splitting -+ mode. */ -+static bool no_break_mb_chars; + static enum operating_mode operating_mode; + ++/* If nonzero, when in byte mode, don't split multibyte characters. */ ++static int byte_mode_character_aware; + - /* If true, print all bytes, characters, or fields _except_ - those that were specified. */ - static bool complement; ++/* If nonzero, the function for single byte locale is work ++ if this program runs on multibyte locale. */ ++static int force_singlebyte_mode; ++ + /* If true do not output lines containing no delimiter characters. + Otherwise, all such lines are printed. This option is valid only + with field mode. */ +@@ -97,6 +173,9 @@ static bool complement; /* The delimiter character for field mode. */ --static unsigned char delim; -+static mbf_char_t delim; + static unsigned char delim; ++#if HAVE_WCHAR_H ++static wchar_t wcdelim; ++#endif /* The delimiter for each line/record. */ static unsigned char line_delim = '\n'; -@@ -109,7 +109,7 @@ static size_t output_delimiter_length; - - /* The output field separator string. Defaults to the 1-character - string consisting of the input delimiter. */ --static char *output_delimiter_string; -+static char const *output_delimiter_string; - - /* True if we have ever read standard input. */ - static bool have_read_stdin; -@@ -164,7 +164,7 @@ Print selected parts of lines from each +@@ -164,7 +243,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\ - -n (ignored)\n\ -+ -n with -b, don't split multibyte characters\n\ ++ -n with -b: don't split multibyte characters\n\ "), stdout); fputs (_("\ --complement complement the set of selected bytes, characters\n\ -@@ -211,6 +211,12 @@ next_item (size_t *item_idx) - current_rp++; +@@ -280,6 +359,82 @@ cut_bytes (FILE *stream) + } } -+static inline void -+next_item_n (size_t *item_idx, size_t n) -+{ -+ while (n-- > 0) -+ next_item (item_idx); -+} - /* Return nonzero if the K'th field or byte is printable. */ - - static inline bool -@@ -219,6 +225,15 @@ print_kth (size_t k) - return current_rp->lo <= k; - } - -+/* The lo and hi params should be used for the current characters byte position -+ * and byte size, respectively. */ -+static inline bool -+rp_intersect (size_t lo, size_t hi) -+{ -+ return ((current_rp->lo <= lo && current_rp->hi >= lo) -+ || (current_rp->lo <= hi && current_rp->hi >= hi)); -+} ++#if HAVE_MBRTOWC ++/* This function is in use for the following case. + - /* Return nonzero if K'th byte is the beginning of a range. */ - - static inline bool -@@ -281,23 +296,216 @@ cut_bytes (FILE *stream) - } - - /* Read from stream STREAM, printing to standard output any selected fields. */ -+extern ssize_t -+mb_getndelim2 (mbf_char_t **lineptr, size_t *linesize, size_t nmax, -+ mbf_char_t delim1, mbf_char_t delim2, mb_file_t *stream) -+{ -+/* The maximum value that getndelim2 can return without suffering from -+ overflow problems, either internally (because of pointer -+ subtraction overflow) or due to the API (because of ssize_t). */ -+#define GETNDELIM2_MAXIMUM (PTRDIFF_MAX < SSIZE_MAX ? PTRDIFF_MAX : SSIZE_MAX) ++ 1. Read from the stream STREAM, printing to standard output any selected ++ characters. + -+/* Try to add at least this many bytes when extending the buffer. -+ MIN_CHUNK must be no greater than GETNDELIM2_MAXIMUM. */ -+#define MIN_CHUNK 64 -+ size_t nchars_avail; /* Allocated but unused chars in *LINEPTR. */ -+ mbf_char_t *read_pos; /* Where we're reading into *LINEPTR. */ -+ ssize_t chars_stored = -1; -+ mbf_char_t *ptr = *lineptr; -+ size_t size = *linesize; -+ bool found_delimiter; -+ -+ if (!ptr) -+ { -+ size = nmax < MIN_CHUNK ? nmax : MIN_CHUNK; -+ ptr = malloc (size * sizeof (mbf_char_t)); -+ if (!ptr) -+ return -1; -+ } -+ -+ if (size < 0) -+ goto done; -+ -+ nchars_avail = size; -+ read_pos = ptr; -+ -+ if (nchars_avail == 0 && nmax <= size) -+ goto done; -+ -+ /* Normalize delimiters, since memchr2 doesn't handle EOF. */ -+ if (mb_iseof (delim1)) -+ mb_copy (&delim1, &delim2); -+ else if (mb_iseof (delim2)) -+ mb_copy (&delim2, &delim1); -+ -+ flockfile (stream); -+ -+ found_delimiter = false; -+ do -+ { -+ /* Here always ptr + size == read_pos + nchars_avail. -+ Also nchars_avail > 0 || size < nmax. */ -+ -+ mbf_char_t c IF_LINT (= 0); -+ { -+ mbf_getc (c, *stream); -+ if (mb_iseof (c)) -+ { -+ /* Return partial line, if any. */ -+ if (read_pos == ptr) -+ goto unlock_done; -+ else -+ break; -+ } -+ if (mb_equal (c, delim1) || mb_equal (c, delim2)) -+ found_delimiter = true; -+ } -+ -+ /* We always want at least one byte left in the buffer, since we -+ always (unless we get an error while reading the first byte) -+ NUL-terminate the line buffer. */ -+ -+ if (!nchars_avail) -+ { -+ /* Grow size proportionally, not linearly, to avoid O(n^2) -+ running time. */ -+ size_t newsize = size < MIN_CHUNK ? size + MIN_CHUNK : 2 * size; -+ mbf_char_t *newptr; -+ -+ /* Respect nmax. This handles possible integer overflow. */ -+ if (! (size < newsize && newsize <= nmax)) -+ newsize = nmax; -+ -+ if (GETNDELIM2_MAXIMUM < newsize) -+ { -+ size_t newsizemax = GETNDELIM2_MAXIMUM + 1; -+ if (size == newsizemax) -+ goto unlock_done; -+ newsize = newsizemax; -+ } -+ nchars_avail = newsize - (read_pos - ptr); -+ newptr = realloc (ptr, newsize * sizeof (mbf_char_t)); -+ if (!newptr) -+ goto unlock_done; -+ ptr = newptr; -+ size = newsize; -+ read_pos = size - nchars_avail + ptr; -+ } -+ -+ /* Here, if size < nmax, nchars_avail >= buffer_len + 1. -+ If size == nmax, nchars_avail > 0. */ -+ -+ if (1 < nchars_avail) -+ { -+ mb_copy(read_pos++, &c); -+ --nchars_avail; -+ } -+ -+ } -+ while (!found_delimiter); -+ -+ chars_stored = (read_pos - ptr); -+ -+ unlock_done: -+ funlockfile (stream); -+ -+ done: -+ *lineptr = ptr; -+ *linesize = size; -+ return chars_stored; -+} ++ 2. Read from stream STREAM, printing to standard output any selected bytes, ++ without splitting multibyte characters. */ + +static void -+cut_chars (FILE *stream) ++cut_characters_or_cut_bytes_no_split (FILE *stream) +{ -+ size_t char_idx; /* Number of chars in the line so far. */ -+ bool print_delimiter; -+ mbf_char_t c; -+ mb_file_t mbf; ++ 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. */ ++ wint_t wc; /* A gotten wide character. */ ++ size_t mblength; /* The byte size of a multibyte character which shows ++ as same character as WC. */ ++ mbstate_t state; /* State of the stream. */ ++ bool convfail = false; /* true, when conversion failed. Otherwise false. */ ++ /* Whether to begin printing delimiters between ranges for the current line. ++ Set after we've begun printing data corresponding to the first range. */ ++ bool print_delimiter = false; ++ ++ idx = 0; ++ buflen = 0; ++ bufpos = buf; ++ memset (&state, '\0', sizeof(mbstate_t)); + -+ print_delimiter = false; -+ char_idx = 0; + current_rp = frp; + -+ mbf_init (mbf, stream); -+ while (true) ++ while (1) + { -+ mbf_getc (c, mbf); ++ REFILL_BUFFER (buf, bufpos, buflen, stream); + -+ if (mb_iseq (c, line_delim)) -+ { -+ putc (line_delim, stdout); -+ char_idx = 0; -+ print_delimiter = false; ++ GET_NEXT_WC_FROM_BUFFER (wc, bufpos, buflen, mblength, state, convfail); ++ (void) convfail; /* ignore unused */ ++ ++ if (wc == WEOF) ++ { ++ if (idx > 0) ++ putchar (line_delim); ++ break; ++ } ++ else if (wc == line_delim) ++ { ++ putchar (line_delim); ++ idx = 0; ++ print_delimiter = false; + current_rp = frp; -+ } -+ else if (mb_iseof (c)) -+ { -+ if (char_idx > 0) -+ putc (line_delim, stdout); -+ break; -+ } ++ } + else -+ { -+ /* Forward by one byte. */ -+ next_item (&char_idx); ++ { ++ next_item (&idx); ++ if (print_kth (idx)) ++ { ++ if (output_delimiter_specified) ++ { ++ 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); ++ } ++ } + -+ /* Check if the current characters byte range is within -+ * the argument list. */ -+ if (rp_intersect (char_idx, char_idx + mb_len (c) - 1)) -+ { -+ if (output_delimiter_specified) -+ { -+ if (print_delimiter && is_range_start_index (char_idx)) -+ { -+ fwrite (output_delimiter_string, sizeof (char), -+ output_delimiter_length, stdout); -+ } -+ print_delimiter = true; -+ } -+ mb_putc (c, stdout); -+ } -+ -+ /* Byte mode with multibyte characters uncut (-b -n). */ -+ if (no_break_mb_chars) -+ /* Forward by an additional byte_length (c) - 1. */ -+ next_item_n (&char_idx, mb_len (c) - 1); -+ } ++ buflen -= mblength; ++ bufpos += mblength; + } +} ++#endif ++ + /* Read from stream STREAM, printing to standard output any selected fields. */ static void - cut_fields (FILE *stream) - { -- int c; +@@ -425,13 +580,211 @@ cut_fields (FILE *stream) + } + } + ++#if HAVE_MBRTOWC ++static void ++cut_fields_mb (FILE *stream) ++{ ++ int c; ++ size_t field_idx; ++ int found_any_selected_field; ++ int buffer_first_field; ++ int empty_input; ++ 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. */ ++ wint_t wc = 0; /* A gotten wide character. */ ++ size_t mblength; /* The byte size of a multibyte character which shows ++ as same character as WC. */ ++ mbstate_t state; /* State of the stream. */ ++ bool convfail = false; /* true, when conversion failed. Otherwise false. */ + -+ /* This buffer is used to support the semantics of the -s option -+ (or lack of same) when the specified field list includes (does -+ not include) the first field. In both of those cases, the entire -+ first field must be read into this buffer to determine whether it -+ is followed by a delimiter or a newline before any of it may be -+ output. Otherwise, cut_fields can do the job without using this -+ buffer. */ -+ mbf_char_t *field_1_buffer = 0; -+ /* The number of bytes allocated for FIELD_1_BUFFER. */ -+ size_t field_1_bufsize; ++ current_rp = frp; + ++ found_any_selected_field = 0; ++ field_idx = 1; ++ bufpos = buf; ++ buflen = 0; ++ memset (&state, '\0', sizeof(mbstate_t)); + -+ mbf_char_t c, d; -+ mb_file_t mbf; - size_t field_idx = 1; - bool found_any_selected_field = false; - bool buffer_first_field; - - current_rp = frp; - -- c = getc (stream); -- if (c == EOF) -+ mbf_init (mbf, stream); -+ mbf_getc (c, mbf); -+ if (mb_iseof (c)) - return; - -- ungetc (c, stream); -- c = 0; -+ mbf_ungetc (c, mbf); -+ mb_setascii (&c, 0); -+ mb_copy (&d, &delim); - - /* To support the semantics of the -s flag, we may have to buffer - all of the first field to determine whether it is 'delimited.' -@@ -312,10 +520,14 @@ cut_fields (FILE *stream) - if (field_idx == 1 && buffer_first_field) - { - ssize_t len; -- size_t n_bytes; -+ size_t n_chars; -+ mbf_char_t nl; -+ mb_setascii (&nl, line_delim); ++ c = getc (stream); ++ empty_input = (c == EOF); ++ if (c != EOF) ++ { ++ ungetc (c, stream); ++ wc = 0; ++ } ++ else ++ wc = WEOF; + -+ len = mb_getndelim2 (&field_1_buffer, &field_1_bufsize, -+ GETNLINE_NO_LIMIT, d, nl, &mbf); ++ /* To support the semantics of the -s flag, we may have to buffer ++ all of the first field to determine whether it is `delimited.' ++ But that is unnecessary if all non-delimited lines must be printed ++ 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)); + - -- len = getndelim2 (&field_1_buffer, &field_1_bufsize, 0, -- GETNLINE_NO_LIMIT, delim, line_delim, stream); - if (len < 0) - { - free (field_1_buffer); -@@ -325,15 +537,15 @@ cut_fields (FILE *stream) - xalloc_die (); - } - -- n_bytes = len; -- assert (n_bytes != 0); -+ n_chars = len; -+ //assert (n_chars != 0); - -- c = 0; -+ mb_setascii (&c, 0); - - /* If the first field extends to the end of line (it is not - delimited) and we are printing all non-delimited lines, - print this one. */ -- if (to_uchar (field_1_buffer[n_bytes - 1]) != delim) -+ if (!mb_equal (field_1_buffer[n_chars - 1], d)) - { - if (suppress_non_delimited) - { -@@ -341,26 +553,30 @@ cut_fields (FILE *stream) - } - else - { -- fwrite (field_1_buffer, sizeof (char), n_bytes, stdout); -+ for (int i = 0; i < n_chars; ++i) -+ mb_putc (field_1_buffer[i], stdout); ++ while (1) ++ { ++ if (field_idx == 1 && buffer_first_field) ++ { ++ int len = 0; + - /* Make sure the output line is newline terminated. */ -- if (field_1_buffer[n_bytes - 1] != line_delim) -+ if (!mb_iseq (field_1_buffer[n_chars - 1], line_delim)) - putchar (line_delim); -- c = line_delim; -+ mb_setascii (&c, line_delim); - } - continue; - } - if (print_kth (1)) - { - /* Print the field, but not the trailing delimiter. */ -- fwrite (field_1_buffer, sizeof (char), n_bytes - 1, stdout); -+ for (int i = 0; i < n_chars - 1; ++i) -+ mb_putc (field_1_buffer[i], stdout); - - /* With -d$'\n' don't treat the last '\n' as a delimiter. */ -- if (delim == line_delim) -+ if (mb_iseq (d, line_delim)) - { -- int last_c = getc (stream); -- if (last_c != EOF) -+ mbf_char_t last_c; -+ mbf_getc (last_c, mbf); -+ if (!mb_iseof (last_c)) - { -- ungetc (last_c, stream); -+ mbf_ungetc (last_c, mbf); - found_any_selected_field = true; - } - } -@@ -370,7 +586,8 @@ cut_fields (FILE *stream) - next_item (&field_idx); - } - -- int prev_c = c; -+ mbf_char_t prev_c; -+ mb_copy (&prev_c, &c); - - if (print_kth (field_idx)) - { -@@ -381,42 +598,46 @@ cut_fields (FILE *stream) - } - found_any_selected_field = true; - -- while ((c = getc (stream)) != delim && c != line_delim && c != EOF) -+ mbf_getc (c, mbf); -+ while (!mb_equal (c, d) && !mb_iseq (c, line_delim) && !mb_iseof (c)) - { -- putchar (c); -- prev_c = c; -+ mb_putc (c, stdout); -+ mb_copy (&prev_c, &c); -+ mbf_getc (c, mbf); - } - } - else - { -- while ((c = getc (stream)) != delim && c != line_delim && c != EOF) -+ mbf_getc (c, mbf); -+ while (!mb_equal (c, d) && !mb_iseq (c, line_delim) && !mb_iseof (c)) - { -- prev_c = c; -+ mb_copy (&prev_c, &c); -+ mbf_getc (c, mbf); - } - } - - /* With -d$'\n' don't treat the last '\n' as a delimiter. */ -- if (delim == line_delim && c == delim) -+ if (mb_iseq (d, line_delim) && mb_equal (c, d)) - { -- int last_c = getc (stream); -- if (last_c != EOF) -- ungetc (last_c, stream); -+ mbf_char_t last_c; -+ mbf_getc (last_c, mbf); -+ if (!mb_iseof (last_c)) -+ mbf_ungetc (last_c, mbf); - else -- c = last_c; -+ mb_copy (&c, &last_c); - } - -- if (c == delim) -+ if (mb_equal (c, d)) - next_item (&field_idx); -- else if (c == line_delim || c == EOF) -+ else if (mb_iseq (c, line_delim) || mb_iseof (c)) - { - if (found_any_selected_field - || !(suppress_non_delimited && field_idx == 1)) - { -- if (c == line_delim || prev_c != line_delim -- || delim == line_delim) -+ if (mb_iseq (c, line_delim) || !mb_iseq (prev_c, line_delim) || mb_iseq (d, line_delim)) - putchar (line_delim); - } -- if (c == EOF) -+ if (mb_iseof (c)) - break; - field_idx = 1; - current_rp = frp; -@@ -429,7 +650,14 @@ static void ++ while (1) ++ { ++ REFILL_BUFFER (buf, bufpos, buflen, stream); ++ ++ GET_NEXT_WC_FROM_BUFFER ++ (wc, bufpos, buflen, mblength, state, convfail); ++ ++ if (wc == WEOF) ++ break; ++ ++ field_1_buffer = xrealloc (field_1_buffer, len + mblength); ++ memcpy (field_1_buffer + len, bufpos, mblength); ++ len += mblength; ++ buflen -= mblength; ++ bufpos += mblength; ++ ++ if (!convfail && (wc == line_delim || wc == wcdelim)) ++ break; ++ } ++ ++ if (len <= 0 && wc == WEOF) ++ break; ++ ++ /* If the first field extends to the end of line (it is not ++ delimited) and we are printing all non-delimited lines, ++ print this one. */ ++ if (convfail || (!convfail && wc != wcdelim)) ++ { ++ if (suppress_non_delimited) ++ { ++ /* Empty. */ ++ } ++ else ++ { ++ fwrite (field_1_buffer, sizeof (char), len, stdout); ++ /* Make sure the output line is newline terminated. */ ++ if (convfail || (!convfail && wc != line_delim)) ++ putchar (line_delim); ++ } ++ continue; ++ } ++ ++ 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; ++ } ++ next_item (&field_idx); ++ } ++ ++ if (wc != WEOF) ++ { ++ if (print_kth (field_idx)) ++ { ++ if (found_any_selected_field) ++ { ++ fwrite (output_delimiter_string, sizeof (char), ++ output_delimiter_length, stdout); ++ } ++ found_any_selected_field = 1; ++ } ++ ++ while (1) ++ { ++ REFILL_BUFFER (buf, bufpos, buflen, stream); ++ ++ GET_NEXT_WC_FROM_BUFFER ++ (wc, bufpos, buflen, mblength, state, convfail); ++ ++ if (wc == WEOF) ++ break; ++ else if (!convfail && (wc == wcdelim || wc == line_delim)) ++ { ++ buflen -= mblength; ++ bufpos += mblength; ++ break; ++ } ++ ++ if (print_kth (field_idx)) ++ fwrite (bufpos, mblength, sizeof(char), stdout); ++ ++ buflen -= mblength; ++ bufpos += mblength; ++ } ++ } ++ ++ if ((!convfail || wc == line_delim) && buflen < 1) ++ wc = WEOF; ++ ++ if (!convfail && wc == wcdelim) ++ next_item (&field_idx); ++ else if (wc == WEOF || (!convfail && wc == line_delim)) ++ { ++ if (found_any_selected_field ++ || (!empty_input && !(suppress_non_delimited && field_idx == 1))) ++ putchar (line_delim); ++ if (wc == WEOF) ++ break; ++ field_idx = 1; ++ current_rp = frp; ++ found_any_selected_field = 0; ++ } ++ } ++} ++#endif ++ + static void cut_stream (FILE *stream) { - if (operating_mode == byte_mode) +- if (operating_mode == byte_mode) - cut_bytes (stream); ++#if HAVE_MBRTOWC ++ if (MB_CUR_MAX > 1 && !force_singlebyte_mode) + { -+ if (no_break_mb_chars) -+ cut_chars (stream); -+ else -+ cut_bytes (stream); ++ switch (operating_mode) ++ { ++ case byte_mode: ++ if (byte_mode_character_aware) ++ cut_characters_or_cut_bytes_no_split (stream); ++ else ++ cut_bytes (stream); ++ break; ++ ++ case character_mode: ++ cut_characters_or_cut_bytes_no_split (stream); ++ 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; ++ ++ default: ++ abort (); ++ } + } -+ else if (operating_mode == char_mode) -+ cut_chars (stream); else - cut_fields (stream); +- cut_fields (stream); ++#endif ++ { ++ if (operating_mode == field_mode) ++ cut_fields (stream); ++ else ++ cut_bytes (stream); ++ } } -@@ -483,6 +711,7 @@ main (int argc, char **argv) + + /* Process file FILE to standard output. +@@ -483,6 +836,7 @@ main (int argc, char **argv) bool ok; bool delim_specified = false; char *spec_list_string IF_LINT ( = NULL); -+ mbi_iterator_t iter; ++ char mbdelim[MB_LEN_MAX + 1]; initialize_main (&argc, &argv); set_program_name (argv[0]); -@@ -496,8 +725,10 @@ main (int argc, char **argv) - - /* By default, all non-delimited lines are printed. */ - suppress_non_delimited = false; -+ /* Default behaviour for -b, unless -n is also specified. */ -+ no_break_mb_chars = false; - -- delim = '\0'; -+ mb_setascii (&delim, '\0'); - have_read_stdin = false; - - while ((optc = getopt_long (argc, argv, "b:c:d:f:nsz", longopts, NULL)) != -1) -@@ -505,7 +736,6 @@ main (int argc, char **argv) +@@ -505,7 +859,6 @@ main (int argc, char **argv) switch (optc) { case 'b': @@ -874,55 +795,86 @@ diff -Naurp coreutils-8.25-orig/src/cut.c coreutils-8.25/src/cut.c /* Build the byte list. */ if (operating_mode != undefined_mode) FATAL_ERROR (_("only one type of list may be specified")); -@@ -513,6 +743,14 @@ main (int argc, char **argv) +@@ -513,6 +866,14 @@ main (int argc, char **argv) spec_list_string = optarg; break; + case 'c': -+ /* Build the char list. */ ++ /* Build the character list. */ + if (operating_mode != undefined_mode) + FATAL_ERROR (_("only one type of list may be specified")); -+ operating_mode = char_mode; ++ operating_mode = character_mode; + spec_list_string = optarg; + break; + case 'f': /* Build the field list. */ if (operating_mode != undefined_mode) -@@ -524,9 +762,17 @@ main (int argc, char **argv) +@@ -524,10 +885,38 @@ main (int argc, char **argv) case 'd': /* New delimiter. */ /* Interpret -d '' to mean 'use the NUL byte as the delimiter.' */ - if (optarg[0] != '\0' && optarg[1] != '\0') -+ mbi_init (iter, optarg, strlen (optarg)); -+ if (!mbi_avail (iter)) -+ mb_setascii (&delim, '\0'); -+ else -+ { -+ mb_copy (&delim, &mbi_cur (iter)); -+ -+ mbi_advance (iter); -+ if (mbi_avail (iter)) - FATAL_ERROR (_("the delimiter must be a single character")); +- FATAL_ERROR (_("the delimiter must be a single character")); - delim = optarg[0]; -+ } - delim_specified = true; +- delim_specified = true; ++ { ++#if HAVE_MBRTOWC ++ if(MB_CUR_MAX > 1) ++ { ++ mbstate_t state; ++ ++ memset (&state, '\0', sizeof(mbstate_t)); ++ delimlen = mbrtowc (&wcdelim, optarg, strnlen(optarg, MB_LEN_MAX), &state); ++ ++ if (delimlen == (size_t)-1 || delimlen == (size_t)-2) ++ ++force_singlebyte_mode; ++ else ++ { ++ delimlen = (delimlen < 1) ? 1 : delimlen; ++ if (wcdelim != L'\0' && *(optarg + delimlen) != '\0') ++ FATAL_ERROR (_("the delimiter must be a single character")); ++ memcpy (mbdelim, optarg, delimlen); ++ mbdelim[delimlen] = '\0'; ++ if (delimlen == 1) ++ delim = *optarg; ++ } ++ } ++ ++ if (MB_CUR_MAX <= 1 || force_singlebyte_mode) ++#endif ++ { ++ if (optarg[0] != '\0' && optarg[1] != '\0') ++ FATAL_ERROR (_("the delimiter must be a single character")); ++ delim = (unsigned char) optarg[0]; ++ } ++ delim_specified = true; ++ } break; -@@ -540,6 +786,7 @@ main (int argc, char **argv) + case OUTPUT_DELIMITER_OPTION: +@@ -540,6 +929,7 @@ main (int argc, char **argv) break; case 'n': -+ no_break_mb_chars = true; ++ byte_mode_character_aware = 1; break; case 's': -@@ -579,15 +826,12 @@ main (int argc, char **argv) +@@ -579,15 +969,34 @@ main (int argc, char **argv) | (complement ? SETFLD_COMPLEMENT : 0) ); if (!delim_specified) - delim = '\t'; -+ mb_setascii (&delim, '\t'); ++ { ++ delim = '\t'; ++#ifdef HAVE_MBRTOWC ++ wcdelim = L'\t'; ++ mbdelim[0] = '\t'; ++ mbdelim[1] = '\0'; ++ delimlen = 1; ++#endif ++ } if (output_delimiter_string == NULL) { @@ -931,15 +883,29 @@ diff -Naurp coreutils-8.25-orig/src/cut.c coreutils-8.25/src/cut.c - dummy[1] = '\0'; - output_delimiter_string = dummy; - output_delimiter_length = 1; -+ output_delimiter_string = mb_ptr (delim); -+ output_delimiter_length = mb_len (delim); ++#ifdef HAVE_MBRTOWC ++ if (MB_CUR_MAX > 1 && !force_singlebyte_mode) ++ { ++ output_delimiter_string = xstrdup(mbdelim); ++ output_delimiter_length = delimlen; ++ } ++ ++ if (MB_CUR_MAX <= 1 || force_singlebyte_mode) ++#endif ++ { ++ static char dummy[2]; ++ dummy[0] = delim; ++ dummy[1] = '\0'; ++ output_delimiter_string = dummy; ++ output_delimiter_length = 1; ++ } } if (optind == argc) -diff -Naurp coreutils-8.25-orig/src/expand.c coreutils-8.25/src/expand.c ---- coreutils-8.25-orig/src/expand.c 2016-01-01 07:48:50.000000000 -0600 -+++ coreutils-8.25/src/expand.c 2016-01-22 21:23:04.637642337 -0600 -@@ -37,12 +37,16 @@ +diff -Naurp coreutils-8.26-orig/src/expand.c coreutils-8.26/src/expand.c +--- coreutils-8.26-orig/src/expand.c 2016-11-06 16:15:30.000000000 -0600 ++++ coreutils-8.26/src/expand.c 2016-12-02 19:15:23.518391649 -0600 +@@ -37,6 +37,9 @@ #include #include #include @@ -947,197 +913,47 @@ diff -Naurp coreutils-8.25-orig/src/expand.c coreutils-8.25/src/expand.c +#include + #include "system.h" - #include "error.h" - #include "fadvise.h" --#include "quote.h" + #include "die.h" #include "xstrndup.h" - -+#include "expand-core.h" -+ - /* The official name of this program (e.g., no 'g' prefix). */ - #define PROGRAM_NAME "expand" - -@@ -58,17 +62,17 @@ static uintmax_t tab_size; - /* Array of the explicit column numbers of the tab stops; - after 'tab_list' is exhausted, each additional tab is replaced - by a space. The first column is column 0. */ --static uintmax_t *tab_list; -+uintmax_t *tab_list; - - /* The number of allocated entries in 'tab_list'. */ --static size_t n_tabs_allocated; -+size_t n_tabs_allocated; - - /* The index of the first invalid element of 'tab_list', - where the next element can be added. */ --static size_t first_free_tab; -+size_t first_free_tab; - - /* Null-terminated array of input filenames. */ --static char **file_list; -+char **file_list; - - /* Default for 'file_list' if no files are given on the command line. */ - static char *stdin_argv[] = -@@ -77,10 +81,10 @@ static char *stdin_argv[] = - }; - - /* True if we have ever read standard input. */ --static bool have_read_stdin; -+bool have_read_stdin; - - /* The desired exit status. */ --static int exit_status; -+int exit_status; - - static char const shortopts[] = "it:0::1::2::3::4::5::6::7::8::9::"; - -@@ -135,128 +139,6 @@ add_tab_stop (uintmax_t tabval) - tab_list[first_free_tab++] = tabval; - } - --/* Add the comma or blank separated list of tab stops STOPS -- to the list of tab stops. */ -- --static void --parse_tab_stops (char const *stops) --{ -- bool have_tabval = false; -- uintmax_t tabval IF_LINT ( = 0); -- char const *num_start IF_LINT ( = NULL); -- bool ok = true; -- -- for (; *stops; stops++) -- { -- if (*stops == ',' || isblank (to_uchar (*stops))) -- { -- if (have_tabval) -- add_tab_stop (tabval); -- have_tabval = false; -- } -- else if (ISDIGIT (*stops)) -- { -- if (!have_tabval) -- { -- tabval = 0; -- have_tabval = true; -- num_start = stops; -- } -- -- /* Detect overflow. */ -- if (!DECIMAL_DIGIT_ACCUMULATE (tabval, *stops - '0', uintmax_t)) -- { -- size_t len = strspn (num_start, "0123456789"); -- char *bad_num = xstrndup (num_start, len); -- error (0, 0, _("tab stop is too large %s"), quote (bad_num)); -- free (bad_num); -- ok = false; -- stops = num_start + len - 1; -- } -- } -- else -- { -- error (0, 0, _("tab size contains invalid character(s): %s"), -- quote (stops)); -- ok = false; -- break; -- } -- } -- -- if (!ok) -- exit (EXIT_FAILURE); -- -- if (have_tabval) -- add_tab_stop (tabval); --} -- --/* Check that the list of tab stops TABS, with ENTRIES entries, -- contains only nonzero, ascending values. */ -- --static void --validate_tab_stops (uintmax_t const *tabs, size_t entries) --{ -- uintmax_t prev_tab = 0; -- size_t i; -- -- for (i = 0; i < entries; i++) -- { -- if (tabs[i] == 0) -- error (EXIT_FAILURE, 0, _("tab size cannot be 0")); -- if (tabs[i] <= prev_tab) -- error (EXIT_FAILURE, 0, _("tab sizes must be ascending")); -- prev_tab = tabs[i]; -- } --} -- --/* Close the old stream pointer FP if it is non-NULL, -- and return a new one opened to read the next input file. -- Open a filename of '-' as the standard input. -- Return NULL if there are no more input files. */ -- --static FILE * --next_file (FILE *fp) --{ -- static char *prev_file; -- char *file; -- -- if (fp) -- { -- if (ferror (fp)) -- { -- error (0, errno, "%s", quotef (prev_file)); -- exit_status = EXIT_FAILURE; -- } -- if (STREQ (prev_file, "-")) -- clearerr (fp); /* Also clear EOF. */ -- else if (fclose (fp) != 0) -- { -- error (0, errno, "%s", quotef (prev_file)); -- exit_status = EXIT_FAILURE; -- } -- } -- -- while ((file = *file_list++) != NULL) -- { -- if (STREQ (file, "-")) -- { -- have_read_stdin = true; -- fp = stdin; -- } -- else -- fp = fopen (file, "r"); -- if (fp) -- { -- prev_file = file; -- fadvise (fp, FADVISE_SEQUENTIAL); -- return fp; -- } -- error (0, errno, "%s", quotef (file)); -- exit_status = EXIT_FAILURE; -- } -- return NULL; --} -- - /* Change tabs to spaces, writing to stdout. - Read each file in 'file_list', in order. */ - -@@ -265,19 +147,19 @@ expand (void) +@@ -100,19 +103,41 @@ expand (void) { /* Input stream. */ FILE *fp = next_file (NULL); + mb_file_t mbf; + mbf_char_t c; ++ /* True if the starting locale is utf8. */ ++ bool using_utf_locale; ++ ++ /* True if the first file contains BOM header. */ ++ bool found_bom; ++ using_utf_locale=check_utf_locale(); if (!fp) return; - + mbf_init (mbf, fp); ++ found_bom=check_bom(fp,&mbf); + +- while (true) ++ if (using_utf_locale == false && found_bom == true) ++ { ++ /*try using some predefined locale */ + - while (true) ++ if (set_utf_locale () != 0) { - /* Input character, or EOF. */ - int c; -- ++ error (EXIT_FAILURE, errno, _("cannot set UTF-8 locale")); ++ } ++ } ++ + ++ if (found_bom == true) ++ { ++ print_bom(); ++ } ++ ++ while (true) ++ { /* If true, perform translations. */ bool convert = true; @@ -1145,7 +961,7 @@ diff -Naurp coreutils-8.25-orig/src/expand.c coreutils-8.25/src/expand.c /* The following variables have valid values only when CONVERT is true: */ -@@ -287,17 +169,23 @@ expand (void) +@@ -122,17 +147,48 @@ expand (void) /* Index in TAB_LIST of next tab stop to examine. */ size_t tab_index = 0; @@ -1156,15 +972,40 @@ diff -Naurp coreutils-8.25-orig/src/expand.c coreutils-8.25/src/expand.c { - while ((c = getc (fp)) < 0 && (fp = next_file (fp))) - continue; -+ do { ++ while (true) { + mbf_getc (c, mbf); -+ if (mb_iseof (c)) ++ if ((mb_iseof (c)) && (fp = next_file (fp))) + { -+ mbf_init (mbf, fp = next_file (fp)); ++ mbf_init (mbf, fp); ++ if (fp!=NULL) ++ { ++ if (check_bom(fp,&mbf)==true) ++ { ++ /*Not the first file - check BOM header*/ ++ if (using_utf_locale==false && found_bom==false) ++ { ++ /*BOM header in subsequent file but not in the first one. */ ++ error (EXIT_FAILURE, errno, _("combination of files with and without BOM header")); ++ } ++ } ++ else ++ { ++ if(using_utf_locale==false && found_bom==true) ++ { ++ /*First file conatined BOM header - locale was switched to UTF ++ /*all subsequent files should contain BOM. */ ++ error (EXIT_FAILURE, errno, _("combination of files with and without BOM header")); ++ } ++ } ++ } + continue; + } ++ else ++ { ++ break; ++ } + } -+ while (false); ++ if (convert) { @@ -1173,9 +1014,9 @@ diff -Naurp coreutils-8.25-orig/src/expand.c coreutils-8.25/src/expand.c { /* Column the next input tab stop is on. */ uintmax_t next_tab_column; -@@ -328,32 +216,34 @@ expand (void) +@@ -151,32 +207,34 @@ expand (void) if (putchar (' ') < 0) - error (EXIT_FAILURE, errno, _("write error")); + die (EXIT_FAILURE, errno, _("write error")); - c = ' '; + mb_setascii (&c, ' '); @@ -1195,7 +1036,7 @@ diff -Naurp coreutils-8.25-orig/src/expand.c coreutils-8.25/src/expand.c - column++; + column += mb_width (c); if (!column) - error (EXIT_FAILURE, 0, _("input line is too long")); + die (EXIT_FAILURE, 0, _("input line is too long")); } - convert &= convert_entire_line || !! isblank (c); @@ -1209,239 +1050,170 @@ diff -Naurp coreutils-8.25-orig/src/expand.c coreutils-8.25/src/expand.c - if (putchar (c) < 0) + mb_putc (c, stdout); + if (ferror (stdout)) - error (EXIT_FAILURE, errno, _("write error")); + die (EXIT_FAILURE, errno, _("write error")); } - while (c != '\n'); + while (!mb_iseq (c, '\n')); } } -@@ -385,19 +275,19 @@ main (int argc, char **argv) - break; +diff -Naurp coreutils-8.26-orig/src/expand-common.c coreutils-8.26/src/expand-common.c +--- coreutils-8.26-orig/src/expand-common.c 2016-11-06 16:15:30.000000000 -0600 ++++ coreutils-8.26/src/expand-common.c 2016-12-02 19:15:23.518391649 -0600 +@@ -18,6 +18,7 @@ - case 't': -- parse_tab_stops (optarg); -+ parse_tab_stops (optarg, add_tab_stop); - break; + #include + #include ++#include + #include "system.h" + #include "die.h" + #include "error.h" +@@ -85,6 +86,119 @@ add_tab_stop (uintmax_t tabval) + } + } - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - if (optarg) -- parse_tab_stops (optarg - 1); -+ parse_tab_stops (optarg - 1, add_tab_stop); - else - { - char tab_stop[2]; - tab_stop[0] = c; - tab_stop[1] = '\0'; -- parse_tab_stops (tab_stop); -+ parse_tab_stops (tab_stop, add_tab_stop); - } - break; - -diff -Naurp coreutils-8.25-orig/src/expand-core.c coreutils-8.25/src/expand-core.c ---- coreutils-8.25-orig/src/expand-core.c 1969-12-31 18:00:00.000000000 -0600 -+++ coreutils-8.25/src/expand-core.c 2016-01-22 21:23:04.634308804 -0600 -@@ -0,0 +1,150 @@ -+/* expand-core.c - elementary functions for the expand and unexpand utilities -+ Copyright (C) 1989-2015 Free Software Foundation, Inc. ++extern int ++set_utf_locale (void) ++{ ++ /*try using some predefined locale */ ++ const char* predef_locales[] = {"C.UTF8","en_US.UTF8","en_GB.UTF8"}; + -+ 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. ++ const int predef_locales_count=3; ++ for (int i=0;i. */ ++extern bool ++check_bom(FILE* fp, mb_file_t *mbf) ++{ ++ int c; + -+#include + -+#include -+#include ++ c=fgetc(fp); + -+#include "system.h" -+#include "error.h" -+#include "fadvise.h" -+#include "quote.h" -+#include "xstrndup.h" ++ /*test BOM header of the first file */ ++ mbf->bufcount=0; ++ if (c == 0xEF) ++ { ++ c=fgetc(fp); ++ } ++ else ++ { ++ if (c != EOF) ++ { ++ ungetc(c,fp); ++ } ++ return false; ++ } + -+#include "expand-core.h" -+ -+/* Add the comma or blank separated list of tab stops STOPS -+ to the list of tab stops. */ ++ if (c == 0xBB) ++ { ++ c=fgetc(fp); ++ } ++ else ++ { ++ if ( c!= EOF ) ++ { ++ mbf->buf[0]=(unsigned char) 0xEF; ++ mbf->bufcount=1; ++ ungetc(c,fp); ++ return false; ++ } ++ else ++ { ++ ungetc(0xEF,fp); ++ return false; ++ } ++ } ++ if (c == 0xBF) ++ { ++ mbf->bufcount=0; ++ return true; ++ } ++ else ++ { ++ if (c != EOF) ++ { ++ mbf->buf[0]=(unsigned char) 0xEF; ++ mbf->buf[1]=(unsigned char) 0xBB; ++ mbf->bufcount=2; ++ ungetc(c,fp); ++ return false; ++ } ++ else ++ { ++ mbf->buf[0]=(unsigned char) 0xEF; ++ mbf->bufcount=1; ++ ungetc(0xBB,fp); ++ return false; ++ } ++ } ++ return false; ++} + +extern void -+parse_tab_stops (char const *stops, void (*add_tab_stop)(uintmax_t)) ++print_bom(void) +{ -+ bool have_tabval = false; -+ uintmax_t tabval IF_LINT ( = 0); -+ char const *num_start IF_LINT ( = NULL); -+ bool ok = true; -+ -+ for (; *stops; stops++) -+ { -+ if (*stops == ',' || isblank (to_uchar (*stops))) -+ { -+ if (have_tabval) -+ add_tab_stop (tabval); -+ have_tabval = false; -+ } -+ else if (ISDIGIT (*stops)) -+ { -+ if (!have_tabval) -+ { -+ tabval = 0; -+ have_tabval = true; -+ num_start = stops; -+ } -+ -+ /* Detect overflow. */ -+ if (!DECIMAL_DIGIT_ACCUMULATE (tabval, *stops - '0', uintmax_t)) -+ { -+ size_t len = strspn (num_start, "0123456789"); -+ char *bad_num = xstrndup (num_start, len); -+ error (0, 0, _("tab stop is too large %s"), quote (bad_num)); -+ free (bad_num); -+ ok = false; -+ stops = num_start + len - 1; -+ } -+ } -+ else -+ { -+ error (0, 0, _("tab size contains invalid character(s): %s"), -+ quote (stops)); -+ ok = false; -+ break; -+ } -+ } -+ -+ if (!ok) -+ exit (EXIT_FAILURE); -+ -+ if (have_tabval) -+ add_tab_stop (tabval); ++ putc (0xEF, stdout); ++ putc (0xBB, stdout); ++ putc (0xBF, stdout); +} + -+/* Check that the list of tab stops TABS, with ENTRIES entries, -+ contains only nonzero, ascending values. */ + /* Add the comma or blank separated list of tab stops STOPS + to the list of tab stops. */ + extern void +diff -Naurp coreutils-8.26-orig/src/expand-common.h coreutils-8.26/src/expand-common.h +--- coreutils-8.26-orig/src/expand-common.h 2016-11-06 16:15:30.000000000 -0600 ++++ coreutils-8.26/src/expand-common.h 2016-12-02 19:15:23.518391649 -0600 +@@ -34,6 +34,18 @@ extern size_t max_column_width; + /* The desired exit status. */ + extern int exit_status; + ++extern int ++set_utf_locale (void); ++ ++extern bool ++check_utf_locale(void); ++ ++extern bool ++check_bom(FILE* fp, mb_file_t *mbf); + +extern void -+validate_tab_stops (uintmax_t const *tabs, size_t entries) -+{ -+ uintmax_t prev_tab = 0; -+ size_t i; ++print_bom(void); + -+ for (i = 0; i < entries; i++) -+ { -+ if (tabs[i] == 0) -+ error (EXIT_FAILURE, 0, _("tab size cannot be 0")); -+ if (tabs[i] <= prev_tab) -+ error (EXIT_FAILURE, 0, _("tab sizes must be ascending")); -+ prev_tab = tabs[i]; -+ } -+} -+ -+/* Close the old stream pointer FP if it is non-NULL, -+ and return a new one opened to read the next input file. -+ Open a filename of '-' as the standard input. -+ Return NULL if there are no more input files. */ -+ -+extern FILE * -+next_file (FILE *fp) -+{ -+ static char *prev_file; -+ char *file; -+ -+ if (fp) -+ { -+ if (ferror (fp)) -+ { -+ error (0, errno, "%s", prev_file); -+ exit_status = EXIT_FAILURE; -+ } -+ if (STREQ (prev_file, "-")) -+ clearerr (fp); /* Also clear EOF. */ -+ else if (fclose (fp) != 0) -+ { -+ error (0, errno, "%s", prev_file); -+ exit_status = EXIT_FAILURE; -+ } -+ } -+ -+ while ((file = *file_list++) != NULL) -+ { -+ if (STREQ (file, "-")) -+ { -+ have_read_stdin = true; -+ fp = stdin; -+ } -+ else -+ fp = fopen (file, "r"); -+ if (fp) -+ { -+ prev_file = file; -+ fadvise (fp, FADVISE_SEQUENTIAL); -+ return fp; -+ } -+ error (0, errno, "%s", file); -+ exit_status = EXIT_FAILURE; -+ } -+ return NULL; -+} -diff -Naurp coreutils-8.25-orig/src/expand-core.h coreutils-8.25/src/expand-core.h ---- coreutils-8.25-orig/src/expand-core.h 1969-12-31 18:00:00.000000000 -0600 -+++ coreutils-8.25/src/expand-core.h 2016-01-22 21:23:04.634308804 -0600 -@@ -0,0 +1,41 @@ -+/* expand-core.h - function prototypes for the expand and unexpand utilities -+ Copyright (C) 1989-2015 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 . */ -+ -+#ifndef EXPAND_CORE_H_ -+# define EXPAND_CORE_H_ -+ -+extern size_t first_free_tab; -+ -+extern size_t n_tabs_allocated; -+ -+extern uintmax_t *tab_list; -+ -+extern int exit_status; -+ -+extern char **file_list; -+ -+extern bool have_read_stdin; -+ -+void -+parse_tab_stops (char const *stops, void (*add_tab_stop)(uintmax_t)); -+ -+void -+validate_tab_stops (uintmax_t const *tabs, size_t entries); -+ -+FILE * -+next_file (FILE *fp); -+ -+#endif /* EXPAND_CORE_H_ */ -diff -Naurp coreutils-8.25-orig/src/fold.c coreutils-8.25/src/fold.c ---- coreutils-8.25-orig/src/fold.c 2016-01-01 07:48:50.000000000 -0600 -+++ coreutils-8.25/src/fold.c 2016-01-22 21:23:04.597639947 -0600 -@@ -22,11 +22,33 @@ + /* Add tab stop TABVAL to the end of 'tab_list'. */ + extern void + add_tab_stop (uintmax_t tabval); +diff -Naurp coreutils-8.26-orig/src/fold.c coreutils-8.26/src/fold.c +--- coreutils-8.26-orig/src/fold.c 2016-11-06 16:15:30.000000000 -0600 ++++ coreutils-8.26/src/fold.c 2016-12-02 19:15:23.519391564 -0600 +@@ -22,12 +22,34 @@ #include #include @@ -1456,6 +1228,7 @@ diff -Naurp coreutils-8.25-orig/src/fold.c coreutils-8.25/src/fold.c +#endif + #include "system.h" + #include "die.h" #include "error.h" #include "fadvise.h" #include "xdectoint.h" @@ -1475,7 +1248,7 @@ diff -Naurp coreutils-8.25-orig/src/fold.c coreutils-8.25/src/fold.c #define TAB_WIDTH 8 /* The official name of this program (e.g., no 'g' prefix). */ -@@ -34,20 +56,41 @@ +@@ -35,20 +57,41 @@ #define AUTHORS proper_name ("David MacKenzie") @@ -1521,7 +1294,7 @@ diff -Naurp coreutils-8.25-orig/src/fold.c coreutils-8.25/src/fold.c {"spaces", no_argument, NULL, 's'}, {"width", required_argument, NULL, 'w'}, {GETOPT_HELP_OPTION_DECL}, -@@ -75,6 +118,7 @@ Wrap input lines in each FILE, writing t +@@ -76,6 +119,7 @@ Wrap input lines in each FILE, writing t fputs (_("\ -b, --bytes count bytes rather than columns\n\ @@ -1529,7 +1302,7 @@ diff -Naurp coreutils-8.25-orig/src/fold.c coreutils-8.25/src/fold.c -s, --spaces break at spaces\n\ -w, --width=WIDTH use WIDTH columns instead of 80\n\ "), stdout); -@@ -92,7 +136,7 @@ Wrap input lines in each FILE, writing t +@@ -93,7 +137,7 @@ Wrap input lines in each FILE, writing t static size_t adjust_column (size_t column, char c) { @@ -1538,7 +1311,7 @@ diff -Naurp coreutils-8.25-orig/src/fold.c coreutils-8.25/src/fold.c { if (c == '\b') { -@@ -115,30 +159,14 @@ adjust_column (size_t column, char c) +@@ -116,30 +160,14 @@ adjust_column (size_t column, char c) to stdout, with maximum line length WIDTH. Return true if successful. */ @@ -1571,7 +1344,7 @@ diff -Naurp coreutils-8.25-orig/src/fold.c coreutils-8.25/src/fold.c fadvise (istream, FADVISE_SEQUENTIAL); -@@ -168,6 +196,15 @@ fold_file (char const *filename, size_t +@@ -169,6 +197,15 @@ fold_file (char const *filename, size_t bool found_blank = false; size_t logical_end = offset_out; @@ -1587,7 +1360,7 @@ diff -Naurp coreutils-8.25-orig/src/fold.c coreutils-8.25/src/fold.c /* Look for the last blank. */ while (logical_end) { -@@ -214,11 +251,221 @@ fold_file (char const *filename, size_t +@@ -215,11 +252,221 @@ fold_file (char const *filename, size_t line_out[offset_out++] = c; } @@ -1698,7 +1471,7 @@ diff -Naurp coreutils-8.25-orig/src/fold.c coreutils-8.25/src/fold.c + fwrite (line_out, sizeof(char), offset_out, stdout); + START_NEW_LINE; + continue; -+ ++ + case L'\b': + increment = (column > 0) ? -1 : 0; + break; @@ -1810,7 +1583,7 @@ diff -Naurp coreutils-8.25-orig/src/fold.c coreutils-8.25/src/fold.c if (ferror (istream)) { error (0, saved_errno, "%s", quotef (filename)); -@@ -251,7 +498,8 @@ main (int argc, char **argv) +@@ -252,7 +499,8 @@ main (int argc, char **argv) atexit (close_stdout); @@ -1820,7 +1593,7 @@ diff -Naurp coreutils-8.25-orig/src/fold.c coreutils-8.25/src/fold.c while ((optc = getopt_long (argc, argv, shortopts, longopts, NULL)) != -1) { -@@ -260,7 +508,15 @@ main (int argc, char **argv) +@@ -261,7 +509,15 @@ main (int argc, char **argv) switch (optc) { case 'b': /* Count bytes rather than columns. */ @@ -1837,10 +1610,10 @@ diff -Naurp coreutils-8.25-orig/src/fold.c coreutils-8.25/src/fold.c break; case 's': /* Break at word boundaries. */ -diff -Naurp coreutils-8.25-orig/src/join.c coreutils-8.25/src/join.c ---- coreutils-8.25-orig/src/join.c 2016-01-13 05:08:59.000000000 -0600 -+++ coreutils-8.25/src/join.c 2016-01-22 21:23:04.600973479 -0600 -@@ -22,18 +22,32 @@ +diff -Naurp coreutils-8.26-orig/src/join.c coreutils-8.26/src/join.c +--- coreutils-8.26-orig/src/join.c 2016-11-06 16:15:30.000000000 -0600 ++++ coreutils-8.26/src/join.c 2016-12-02 19:15:23.520391480 -0600 +@@ -22,19 +22,33 @@ #include #include @@ -1855,6 +1628,7 @@ diff -Naurp coreutils-8.25-orig/src/join.c coreutils-8.25/src/join.c +#endif + #include "system.h" + #include "die.h" #include "error.h" #include "fadvise.h" #include "hard-locale.h" @@ -1874,7 +1648,7 @@ diff -Naurp coreutils-8.25-orig/src/join.c coreutils-8.25/src/join.c /* The official name of this program (e.g., no 'g' prefix). */ #define PROGRAM_NAME "join" -@@ -135,10 +149,12 @@ static struct outlist outlist_head; +@@ -136,10 +150,12 @@ static struct outlist outlist_head; /* Last element in 'outlist', where a new element can be added. */ static struct outlist *outlist_end = &outlist_head; @@ -1891,7 +1665,7 @@ diff -Naurp coreutils-8.25-orig/src/join.c coreutils-8.25/src/join.c /* If nonzero, check that the input is correctly ordered. */ static enum -@@ -275,13 +291,14 @@ xfields (struct line *line) +@@ -276,13 +292,14 @@ xfields (struct line *line) if (ptr == lim) return; @@ -1909,7 +1683,7 @@ diff -Naurp coreutils-8.25-orig/src/join.c coreutils-8.25/src/join.c { /* Skip leading blanks before the first field. */ while (field_sep (*ptr)) -@@ -305,6 +322,147 @@ xfields (struct line *line) +@@ -306,6 +323,147 @@ xfields (struct line *line) extract_field (line, ptr, lim - ptr); } @@ -2053,11 +1827,11 @@ diff -Naurp coreutils-8.25-orig/src/join.c coreutils-8.25/src/join.c + extract_field (line, ptr, lim - ptr); +} +#endif -+ ++ static void freeline (struct line *line) { -@@ -326,56 +484,133 @@ keycmp (struct line const *line1, struct +@@ -327,56 +485,133 @@ keycmp (struct line const *line1, struct size_t jf_1, size_t jf_2) { /* Start of field to compare in each file. */ @@ -2188,8 +1962,8 @@ diff -Naurp coreutils-8.25-orig/src/join.c coreutils-8.25/src/join.c - diff = memcmp (beg1, beg2, MIN (len1, len2)); + copy[0] = beg[0]; + copy[1] = beg[1]; -+ } -+ + } + + if (hard_LC_COLLATE) + { + diff = xmemcoll ((char *) copy[0], len[0], (char *) copy[1], len[1]); @@ -2199,14 +1973,14 @@ diff -Naurp coreutils-8.25-orig/src/join.c coreutils-8.25/src/join.c + free (copy[i]); + + return diff; - } ++ } + diff = memcmp (copy[0], copy[1], MIN (len[0], len[1])); + + if (mallocd) + for (i = 0; i < 2; i++) + free (copy[i]); + - ++ if (diff) return diff; - return len1 < len2 ? -1 : len1 != len2; @@ -2214,7 +1988,7 @@ diff -Naurp coreutils-8.25-orig/src/join.c coreutils-8.25/src/join.c } /* Check that successive input lines PREV and CURRENT from input file -@@ -467,6 +702,11 @@ get_line (FILE *fp, struct line **linep, +@@ -468,6 +703,11 @@ get_line (FILE *fp, struct line **linep, } ++line_no[which - 1]; @@ -2226,7 +2000,7 @@ diff -Naurp coreutils-8.25-orig/src/join.c coreutils-8.25/src/join.c xfields (line); if (prevline[which - 1]) -@@ -566,21 +806,28 @@ prfield (size_t n, struct line const *li +@@ -567,21 +807,28 @@ prfield (size_t n, struct line const *li /* Output all the fields in line, other than the join field. */ @@ -2258,7 +2032,7 @@ diff -Naurp coreutils-8.25-orig/src/join.c coreutils-8.25/src/join.c prfield (i, line); } } -@@ -591,7 +838,6 @@ static void +@@ -592,7 +839,6 @@ static void prjoin (struct line const *line1, struct line const *line2) { const struct outlist *outlist; @@ -2266,7 +2040,7 @@ diff -Naurp coreutils-8.25-orig/src/join.c coreutils-8.25/src/join.c size_t field; struct line const *line; -@@ -625,7 +871,7 @@ prjoin (struct line const *line1, struct +@@ -626,7 +872,7 @@ prjoin (struct line const *line1, struct o = o->next; if (o == NULL) break; @@ -2275,7 +2049,7 @@ diff -Naurp coreutils-8.25-orig/src/join.c coreutils-8.25/src/join.c } putchar (eolchar); } -@@ -1103,21 +1349,46 @@ main (int argc, char **argv) +@@ -1104,20 +1350,43 @@ main (int argc, char **argv) case 't': { @@ -2302,16 +2076,14 @@ diff -Naurp coreutils-8.25-orig/src/join.c coreutils-8.25/src/join.c + newtablen = 1; if (! newtab) - newtab = '\n'; /* '' => process the whole line. */ -+ { + newtab = (char*)"\n"; /* '' => process the whole line. */ -+ } else if (optarg[1]) { - if (STREQ (optarg, "\\0")) - newtab = '\0'; - else -- error (EXIT_FAILURE, 0, _("multi-character tab %s"), -- quote (optarg)); +- die (EXIT_FAILURE, 0, _("multi-character tab %s"), +- quote (optarg)); + if (newtablen == 1 && newtab[1]) + { + if (STREQ (newtab, "\\0")) @@ -2321,32 +2093,18 @@ diff -Naurp coreutils-8.25-orig/src/join.c coreutils-8.25/src/join.c + if (tab != NULL && strcmp (tab, newtab)) + { + free (newtab); -+ error (EXIT_FAILURE, 0, _("incompatible tabs")); ++ die (EXIT_FAILURE, 0, _("incompatible tabs")); } - if (0 <= tab && tab != newtab) -- error (EXIT_FAILURE, 0, _("incompatible tabs")); +- die (EXIT_FAILURE, 0, _("incompatible tabs")); tab = newtab; -- } + tablen = newtablen; -+ } + } break; - case 'z': -diff -Naurp coreutils-8.25-orig/src/local.mk coreutils-8.25/src/local.mk ---- coreutils-8.25-orig/src/local.mk 2016-01-01 07:48:50.000000000 -0600 -+++ coreutils-8.25/src/local.mk 2016-01-22 21:23:04.637642337 -0600 -@@ -361,6 +361,8 @@ src_coreutils_SOURCES = src/coreutils.c - - src_cp_SOURCES = src/cp.c $(copy_sources) $(selinux_sources) - src_dir_SOURCES = src/ls.c src/ls-dir.c -+src_expand_SOURCES = src/expand.c src/expand-core.c -+src_unexpand_SOURCES = src/unexpand.c src/expand-core.c - src_vdir_SOURCES = src/ls.c src/ls-vdir.c - src_id_SOURCES = src/id.c src/group-list.c - src_groups_SOURCES = src/groups.c src/group-list.c -diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c ---- coreutils-8.25-orig/src/pr.c 2016-01-01 07:48:50.000000000 -0600 -+++ coreutils-8.25/src/pr.c 2016-01-22 21:23:04.607640544 -0600 +diff -Naurp coreutils-8.26-orig/src/pr.c coreutils-8.26/src/pr.c +--- coreutils-8.26-orig/src/pr.c 2016-11-25 07:40:49.000000000 -0600 ++++ coreutils-8.26/src/pr.c 2016-12-02 19:15:23.522391311 -0600 @@ -311,6 +311,24 @@ #include @@ -2370,9 +2128,9 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c +#endif + #include "system.h" + #include "die.h" #include "error.h" - #include "fadvise.h" -@@ -323,6 +341,18 @@ +@@ -324,6 +342,18 @@ #include "xstrtol.h" #include "xdectoint.h" @@ -2391,7 +2149,7 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c /* The official name of this program (e.g., no 'g' prefix). */ #define PROGRAM_NAME "pr" -@@ -415,7 +445,20 @@ struct COLUMN +@@ -416,7 +446,20 @@ struct COLUMN typedef struct COLUMN COLUMN; @@ -2413,7 +2171,7 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c static bool read_line (COLUMN *p); static bool print_page (void); static bool print_stored (COLUMN *p); -@@ -427,6 +470,7 @@ static void add_line_number (COLUMN *p); +@@ -428,6 +471,7 @@ static void add_line_number (COLUMN *p); static void getoptnum (const char *n_str, int min, int *num, const char *errfmt); static void getoptarg (char *arg, char switch_char, char *character, @@ -2421,7 +2179,7 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c int *number); static void print_files (int number_of_files, char **av); static void init_parameters (int number_of_files); -@@ -440,7 +484,6 @@ static void store_char (char c); +@@ -441,7 +485,6 @@ static void store_char (char c); static void pad_down (unsigned int lines); static void read_rest_of_line (COLUMN *p); static void skip_read (COLUMN *p, int column_number); @@ -2429,7 +2187,7 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c static void cleanup (void); static void print_sep_string (void); static void separator_string (const char *optarg_S); -@@ -452,7 +495,7 @@ static COLUMN *column_vector; +@@ -453,7 +496,7 @@ static COLUMN *column_vector; we store the leftmost columns contiguously in buff. To print a line from buff, get the index of the first character from line_vector[i], and print up to line_vector[i + 1]. */ @@ -2438,7 +2196,7 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c /* Index of the position in buff where the next character will be stored. */ -@@ -556,7 +599,7 @@ static int chars_per_column; +@@ -557,7 +600,7 @@ static int chars_per_column; static bool untabify_input = false; /* (-e) The input tab character. */ @@ -2447,7 +2205,7 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c /* (-e) Tabstops are at chars_per_tab, 2*chars_per_tab, 3*chars_per_tab, ... where the leftmost column is 1. */ -@@ -566,7 +609,10 @@ static int chars_per_input_tab = 8; +@@ -567,7 +610,10 @@ static int chars_per_input_tab = 8; static bool tabify_output = false; /* (-i) The output tab character. */ @@ -2459,7 +2217,7 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c /* (-i) The width of the output tab. */ static int chars_per_output_tab = 8; -@@ -636,7 +682,13 @@ static int line_number; +@@ -637,7 +683,13 @@ static int line_number; static bool numbered_lines = false; /* (-n) Character which follows each line number. */ @@ -2474,18 +2232,18 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c /* (-n) line counting starts with 1st line of input file (not with 1st line of 1st page printed). */ -@@ -689,6 +741,7 @@ static bool use_col_separator = false; +@@ -690,6 +742,7 @@ static bool use_col_separator = false; -a|COLUMN|-m is a 'space' and with the -J option a 'tab'. */ - static char *col_sep_string = (char *) ""; + static char const *col_sep_string = ""; static int col_sep_length = 0; +static int col_sep_width = 0; static char *column_separator = (char *) " "; static char *line_separator = (char *) "\t"; -@@ -839,6 +892,13 @@ separator_string (const char *optarg_S) - col_sep_length = (int) strlen (optarg_S); - col_sep_string = xmalloc (col_sep_length + 1); - strcpy (col_sep_string, optarg_S); +@@ -851,6 +904,13 @@ separator_string (const char *optarg_S) + integer_overflow (); + col_sep_length = len; + col_sep_string = optarg_S; + +#if HAVE_MBRTOWC + if (MB_CUR_MAX > 1) @@ -2496,7 +2254,7 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c } int -@@ -863,6 +923,21 @@ main (int argc, char **argv) +@@ -875,6 +935,21 @@ main (int argc, char **argv) atexit (close_stdout); @@ -2517,8 +2275,8 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c + n_files = 0; file_names = (argc > 1 - ? xmalloc ((argc - 1) * sizeof (char *)) -@@ -939,8 +1014,12 @@ main (int argc, char **argv) + ? xnmalloc (argc - 1, sizeof (char *)) +@@ -951,8 +1026,12 @@ main (int argc, char **argv) break; case 'e': if (optarg) @@ -2533,7 +2291,7 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c /* Could check tab width > 0. */ untabify_input = true; break; -@@ -953,8 +1032,12 @@ main (int argc, char **argv) +@@ -965,8 +1044,12 @@ main (int argc, char **argv) break; case 'i': if (optarg) @@ -2548,7 +2306,7 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c /* Could check tab width > 0. */ tabify_output = true; break; -@@ -972,8 +1055,8 @@ main (int argc, char **argv) +@@ -984,8 +1067,8 @@ main (int argc, char **argv) case 'n': numbered_lines = true; if (optarg) @@ -2559,16 +2317,15 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c break; case 'N': skip_count = false; -@@ -997,7 +1080,7 @@ main (int argc, char **argv) - old_s = false; +@@ -1010,6 +1093,7 @@ main (int argc, char **argv) /* Reset an additional input of -s, -S dominates -s */ - col_sep_string = bad_cast (""); -- col_sep_length = 0; -+ col_sep_length = col_sep_width = 0; + col_sep_string = ""; + col_sep_length = 0; ++ col_sep_width = 0; use_col_separator = true; if (optarg) separator_string (optarg); -@@ -1152,10 +1235,45 @@ getoptnum (const char *n_str, int min, i +@@ -1166,10 +1250,45 @@ getoptnum (const char *n_str, int min, i a number. */ static void @@ -2616,7 +2373,7 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c if (*arg) { long int tmp_long; -@@ -1177,6 +1295,11 @@ static void +@@ -1191,6 +1310,11 @@ static void init_parameters (int number_of_files) { int chars_used_by_number = 0; @@ -2628,7 +2385,7 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c lines_per_body = lines_per_page - lines_per_header - lines_per_footer; if (lines_per_body <= 0) -@@ -1214,7 +1337,7 @@ init_parameters (int number_of_files) +@@ -1228,7 +1352,7 @@ init_parameters (int number_of_files) else col_sep_string = column_separator; @@ -2637,7 +2394,7 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c use_col_separator = true; } /* It's rather pointless to define a TAB separator with column -@@ -1244,11 +1367,11 @@ init_parameters (int number_of_files) +@@ -1258,11 +1382,11 @@ init_parameters (int number_of_files) + TAB_WIDTH (chars_per_input_tab, chars_per_number); */ /* Estimate chars_per_text without any margin and keep it constant. */ @@ -2651,16 +2408,16 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c /* The number is part of the column width unless we are printing files in parallel. */ -@@ -1257,7 +1380,7 @@ init_parameters (int number_of_files) +@@ -1271,7 +1395,7 @@ init_parameters (int number_of_files) } - chars_per_column = (chars_per_line - chars_used_by_number -- - (columns - 1) * col_sep_length) / columns; -+ - (columns - 1) * col_sep_width) / columns; - - if (chars_per_column < 1) - error (EXIT_FAILURE, 0, _("page width too narrow")); -@@ -1275,7 +1398,7 @@ init_parameters (int number_of_files) + int sep_chars, useful_chars; +- if (INT_MULTIPLY_WRAPV (columns - 1, col_sep_length, &sep_chars)) ++ if (INT_MULTIPLY_WRAPV (columns - 1, col_sep_width, &sep_chars)) + sep_chars = INT_MAX; + if (INT_SUBTRACT_WRAPV (chars_per_line - chars_used_by_number, sep_chars, + &useful_chars)) +@@ -1294,7 +1418,7 @@ init_parameters (int number_of_files) We've to use 8 as the lower limit, if we use chars_per_default_tab = 8 to expand a tab which is not an input_tab-char. */ free (clump_buff); @@ -2669,7 +2426,7 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c } /* Open the necessary files, -@@ -1383,7 +1506,7 @@ init_funcs (void) +@@ -1402,7 +1526,7 @@ init_funcs (void) /* Enlarge p->start_position of first column to use the same form of padding_not_printed with all columns. */ @@ -2678,7 +2435,7 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c /* This loop takes care of all but the rightmost column. */ -@@ -1417,7 +1540,7 @@ init_funcs (void) +@@ -1436,7 +1560,7 @@ init_funcs (void) } else { @@ -2687,19 +2444,19 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c h_next = h + chars_per_column; } } -@@ -1708,9 +1831,9 @@ static void +@@ -1727,9 +1851,9 @@ static void align_column (COLUMN *p) { padding_not_printed = p->start_position; -- if (padding_not_printed - col_sep_length > 0) -+ if (padding_not_printed - col_sep_width > 0) +- if (col_sep_length < padding_not_printed) ++ if (col_sep_width < padding_not_printed) { - pad_across_to (padding_not_printed - col_sep_length); + pad_across_to (padding_not_printed - col_sep_width); padding_not_printed = ANYWHERE; } -@@ -1981,13 +2104,13 @@ store_char (char c) +@@ -2004,13 +2128,13 @@ store_char (char c) /* May be too generous. */ buff = X2REALLOC (buff, &buff_allocated); } @@ -2715,7 +2472,7 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c char *s; int num_width; -@@ -2004,22 +2127,24 @@ add_line_number (COLUMN *p) +@@ -2027,22 +2151,24 @@ add_line_number (COLUMN *p) /* Tabification is assumed for multiple columns, also for n-separators, but 'default n-separator = TAB' hasn't been given priority over equal column_width also specified by POSIX. */ @@ -2744,7 +2501,7 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c output_position = POS_AFTER_TAB (chars_per_output_tab, output_position); } -@@ -2180,7 +2305,7 @@ print_white_space (void) +@@ -2203,7 +2329,7 @@ print_white_space (void) while (goal - h_old > 1 && (h_new = POS_AFTER_TAB (chars_per_output_tab, h_old)) <= goal) { @@ -2753,15 +2510,15 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c h_old = h_new; } while (++h_old <= goal) -@@ -2200,6 +2325,7 @@ print_sep_string (void) +@@ -2223,6 +2349,7 @@ print_sep_string (void) { - char *s; + char const *s = col_sep_string; int l = col_sep_length; + int not_space_flag; - s = col_sep_string; - -@@ -2213,6 +2339,7 @@ print_sep_string (void) + if (separators_not_printed <= 0) + { +@@ -2234,6 +2361,7 @@ print_sep_string (void) { for (; separators_not_printed > 0; --separators_not_printed) { @@ -2769,7 +2526,7 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c while (l-- > 0) { /* 3 types of sep_strings: spaces only, spaces and chars, -@@ -2226,12 +2353,15 @@ print_sep_string (void) +@@ -2247,12 +2375,15 @@ print_sep_string (void) } else { @@ -2786,7 +2543,7 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c /* sep_string ends with some spaces */ if (spaces_not_printed > 0) print_white_space (); -@@ -2259,7 +2389,7 @@ print_clump (COLUMN *p, int n, char *clu +@@ -2280,7 +2411,7 @@ print_clump (COLUMN *p, int n, char *clu required number of tabs and spaces. */ static void @@ -2795,7 +2552,7 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c { if (tabify_output) { -@@ -2283,6 +2413,74 @@ print_char (char c) +@@ -2304,6 +2435,74 @@ print_char (char c) putchar (c); } @@ -2870,19 +2627,19 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c /* Skip to page PAGE before printing. PAGE may be larger than total number of pages. */ -@@ -2462,9 +2660,9 @@ read_line (COLUMN *p) +@@ -2483,9 +2682,9 @@ read_line (COLUMN *p) align_empty_cols = false; } -- if (padding_not_printed - col_sep_length > 0) -+ if (padding_not_printed - col_sep_width > 0) +- if (col_sep_length < padding_not_printed) ++ if (col_sep_width < padding_not_printed) { - pad_across_to (padding_not_printed - col_sep_length); + pad_across_to (padding_not_printed - col_sep_width); padding_not_printed = ANYWHERE; } -@@ -2534,7 +2732,7 @@ print_stored (COLUMN *p) +@@ -2555,7 +2754,7 @@ print_stored (COLUMN *p) int i; int line = p->current_line++; @@ -2891,7 +2648,7 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c /* FIXME UMR: Uninitialized memory read: * This is occurring while in: -@@ -2546,7 +2744,7 @@ print_stored (COLUMN *p) +@@ -2567,7 +2766,7 @@ print_stored (COLUMN *p) xmalloc [xmalloc.c:94] init_store_cols [pr.c:1648] */ @@ -2900,19 +2657,19 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c pad_vertically = true; -@@ -2565,9 +2763,9 @@ print_stored (COLUMN *p) +@@ -2586,9 +2785,9 @@ print_stored (COLUMN *p) } } -- if (padding_not_printed - col_sep_length > 0) -+ if (padding_not_printed - col_sep_width > 0) +- if (col_sep_length < padding_not_printed) ++ if (col_sep_width < padding_not_printed) { - pad_across_to (padding_not_printed - col_sep_length); + pad_across_to (padding_not_printed - col_sep_width); padding_not_printed = ANYWHERE; } -@@ -2580,8 +2778,8 @@ print_stored (COLUMN *p) +@@ -2601,8 +2800,8 @@ print_stored (COLUMN *p) if (spaces_not_printed == 0) { output_position = p->start_position + end_vector[line]; @@ -2923,7 +2680,7 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c } return true; -@@ -2600,7 +2798,7 @@ print_stored (COLUMN *p) +@@ -2621,7 +2820,7 @@ print_stored (COLUMN *p) number of characters is 1.) */ static int @@ -2932,7 +2689,7 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c { unsigned char uc = c; char *s = clump_buff; -@@ -2610,10 +2808,10 @@ char_to_clump (char c) +@@ -2631,10 +2830,10 @@ char_to_clump (char c) int chars; int chars_per_c = 8; @@ -2945,7 +2702,7 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/src/pr.c { width = TAB_WIDTH (chars_per_c, input_position); -@@ -2694,6 +2892,164 @@ char_to_clump (char c) +@@ -2715,6 +2914,164 @@ char_to_clump (char c) return chars; } @@ -3110,9 +2867,9 @@ diff -Naurp coreutils-8.25-orig/src/pr.c coreutils-8.25/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 -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/src/sort.c ---- coreutils-8.25-orig/src/sort.c 2016-01-16 13:09:33.000000000 -0600 -+++ coreutils-8.25/src/sort.c 2016-01-22 21:23:04.610974077 -0600 +diff -Naurp coreutils-8.26-orig/src/sort.c coreutils-8.26/src/sort.c +--- coreutils-8.26-orig/src/sort.c 2016-11-06 16:15:30.000000000 -0600 ++++ coreutils-8.26/src/sort.c 2016-12-02 19:15:23.525391058 -0600 @@ -29,6 +29,14 @@ #include #include @@ -3127,8 +2884,8 @@ diff -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/src/sort.c + #include "system.h" #include "argmatch.h" - #include "error.h" -@@ -163,14 +171,39 @@ static int decimal_point; + #include "die.h" +@@ -165,14 +173,39 @@ static int decimal_point; /* Thousands separator; if -1, then there isn't one. */ static int thousands_sep; @@ -3169,7 +2926,7 @@ diff -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/src/sort.c /* The kind of blanks for '-b' to skip in various options. */ enum blanktype { bl_start, bl_end, bl_both }; -@@ -344,13 +377,11 @@ static bool reverse; +@@ -346,13 +379,11 @@ static bool reverse; they were read if all keys compare equal. */ static bool stable; @@ -3186,7 +2943,7 @@ diff -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/src/sort.c /* Flag to remove consecutive duplicate lines from the output. Only the last of a sequence of equal lines will be output. */ -@@ -810,6 +841,46 @@ reap_all (void) +@@ -811,6 +842,46 @@ reap_all (void) reap (-1); } @@ -3233,7 +2990,7 @@ diff -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/src/sort.c /* Clean up any remaining temporary files. */ static void -@@ -1254,7 +1325,7 @@ zaptemp (char const *name) +@@ -1255,7 +1326,7 @@ zaptemp (char const *name) free (node); } @@ -3242,7 +2999,7 @@ diff -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/src/sort.c static int struct_month_cmp (void const *m1, void const *m2) -@@ -1269,7 +1340,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 @@ -3251,7 +3008,7 @@ diff -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/src/sort.c { size_t i; -@@ -1281,7 +1352,7 @@ inittables (void) +@@ -1282,7 +1353,7 @@ inittables (void) fold_toupper[i] = toupper (i); } @@ -3260,7 +3017,7 @@ diff -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/src/sort.c /* If we're not in the "C" locale, read different names for months. */ if (hard_LC_TIME) { -@@ -1363,6 +1434,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); } @@ -3345,7 +3102,7 @@ diff -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/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) -@@ -1596,7 +1745,7 @@ buffer_linelim (struct buffer const *buf +@@ -1597,7 +1746,7 @@ buffer_linelim (struct buffer const *buf by KEY in LINE. */ static char * @@ -3354,7 +3111,7 @@ diff -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/src/sort.c { char *ptr = line->text, *lim = ptr + line->length - 1; size_t sword = key->sword; -@@ -1605,10 +1754,10 @@ begfield (struct line const *line, struc +@@ -1606,10 +1755,10 @@ begfield (struct line const *line, struc /* The leading field separator itself is included in a field when -t is absent. */ @@ -3367,7 +3124,7 @@ diff -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/src/sort.c ++ptr; if (ptr < lim) ++ptr; -@@ -1634,11 +1783,70 @@ begfield (struct line const *line, struc +@@ -1635,11 +1784,70 @@ begfield (struct line const *line, struc return ptr; } @@ -3439,7 +3196,7 @@ diff -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/src/sort.c { char *ptr = line->text, *lim = ptr + line->length - 1; size_t eword = key->eword, echar = key->echar; -@@ -1653,10 +1861,10 @@ limfield (struct line const *line, struc +@@ -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. */ @@ -3452,7 +3209,7 @@ diff -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/src/sort.c ++ptr; if (ptr < lim && (eword || echar)) ++ptr; -@@ -1702,10 +1910,10 @@ limfield (struct line const *line, struc +@@ -1703,10 +1911,10 @@ limfield (struct line const *line, struc */ /* Make LIM point to the end of (one byte past) the current field. */ @@ -3465,7 +3222,7 @@ diff -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/src/sort.c if (newlim) lim = newlim; } -@@ -1736,6 +1944,130 @@ limfield (struct line const *line, struc +@@ -1737,6 +1945,130 @@ limfield (struct line const *line, struc return ptr; } @@ -3596,7 +3353,7 @@ diff -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/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 -@@ -1822,8 +2154,22 @@ fillbuf (struct buffer *buf, FILE *fp, c +@@ -1823,8 +2155,22 @@ fillbuf (struct buffer *buf, FILE *fp, c else { if (key->skipsblanks) @@ -3621,7 +3378,23 @@ diff -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/src/sort.c line->keybeg = line_start; } } -@@ -1944,7 +2290,7 @@ human_numcompare (char const *a, char co +@@ -1958,12 +2304,10 @@ find_unit_order (char const *number) + < K/k < M < G < T < P < E < Z < Y */ + + static int +-human_numcompare (char const *a, char const *b) ++human_numcompare (char *a, char *b) + { +- while (blanks[to_uchar (*a)]) +- a++; +- while (blanks[to_uchar (*b)]) +- b++; ++ skipblanks(&a, a + strlen(a)); ++ skipblanks(&b, b + strlen(b)); + + int diff = find_unit_order (a) - find_unit_order (b); + return (diff ? diff : strnumcmp (a, b, decimal_point, thousands_sep)); +@@ -1974,7 +2318,7 @@ human_numcompare (char const *a, char co hideously fast. */ static int @@ -3630,7 +3403,7 @@ diff -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/src/sort.c { while (blanks[to_uchar (*a)]) a++; -@@ -1954,6 +2300,25 @@ numcompare (char const *a, char const *b +@@ -1984,6 +2328,25 @@ numcompare (char const *a, char const *b return strnumcmp (a, b, decimal_point, thousands_sep); } @@ -3656,7 +3429,7 @@ diff -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/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 -@@ -2004,7 +2369,7 @@ general_numcompare (char const *sa, char +@@ -2034,7 +2397,7 @@ general_numcompare (char const *sa, char Return 0 if the name in S is not recognized. */ static int @@ -3665,7 +3438,7 @@ diff -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/src/sort.c { size_t lo = 0; size_t hi = MONTHS_PER_YEAR; -@@ -2280,15 +2645,14 @@ debug_key (struct line const *line, stru +@@ -2310,15 +2673,14 @@ debug_key (struct line const *line, stru char saved = *lim; *lim = '\0'; @@ -3683,16 +3456,16 @@ diff -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/src/sort.c else if (key->general_numeric) ignore_value (strtold (beg, &tighter_lim)); else if (key->numeric || key->human_numeric) -@@ -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); +@@ -2452,7 +2814,7 @@ key_warnings (struct keyfield const *gke + /* Warn about significant leading blanks. */ + bool implicit_skip = key_numeric (key) || key->month; bool line_offset = key->eword == 0 && key->echar != 0; /* -k1.x,1.y */ -- if (!gkey_only && tab == TAB_DEFAULT && !line_offset -+ if (!gkey_only && !tab_length && !line_offset - && ((!key->skipsblanks && !(implicit_skip || maybe_space_aligned)) +- if (!zero_width && !gkey_only && tab == TAB_DEFAULT && !line_offset ++ if (!zero_width && !gkey_only && !tab_length && !line_offset + && ((!key->skipsblanks && !implicit_skip) || (!key->skipsblanks && key->schar) || (!key->skipeblanks && key->echar))) -@@ -2490,11 +2854,87 @@ key_warnings (struct keyfield const *gke +@@ -2510,11 +2872,87 @@ key_warnings (struct keyfield const *gke error (0, 0, _("option '-r' only applies to last-resort comparison")); } @@ -3781,7 +3554,7 @@ diff -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/src/sort.c { struct keyfield *key = keylist; -@@ -2579,7 +3019,7 @@ keycompare (struct line const *a, struct +@@ -2599,7 +3037,7 @@ keycompare (struct line const *a, struct else if (key->human_numeric) diff = human_numcompare (ta, tb); else if (key->month) @@ -3790,7 +3563,7 @@ diff -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/src/sort.c else if (key->random) diff = compare_random (ta, tlena, tb, tlenb); else if (key->version) -@@ -2695,6 +3135,211 @@ keycompare (struct line const *a, struct +@@ -2715,6 +3153,211 @@ keycompare (struct line const *a, struct return key->reverse ? -diff : diff; } @@ -4002,7 +3775,7 @@ diff -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/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. */ -@@ -2722,7 +3367,7 @@ compare (struct line const *a, struct li +@@ -2742,7 +3385,7 @@ compare (struct line const *a, struct li diff = - NONZERO (blen); else if (blen == 0) diff = 1; @@ -4011,7 +3784,7 @@ diff -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/src/sort.c { /* Note xmemcoll0 is a performance enhancement as it will not unconditionally write '\0' after the -@@ -4121,6 +4766,7 @@ set_ordering (char const *s, struct keyf +@@ -4139,6 +4782,7 @@ set_ordering (char const *s, struct keyf break; case 'f': key->translate = fold_toupper; @@ -4019,7 +3792,7 @@ diff -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/src/sort.c break; case 'g': key->general_numeric = true; -@@ -4199,7 +4845,7 @@ main (int argc, char **argv) +@@ -4218,7 +4862,7 @@ main (int argc, char **argv) initialize_exit_failure (SORT_FAILURE); hard_LC_COLLATE = hard_locale (LC_COLLATE); @@ -4028,7 +3801,7 @@ diff -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/src/sort.c hard_LC_TIME = hard_locale (LC_TIME); #endif -@@ -4220,6 +4866,29 @@ main (int argc, char **argv) +@@ -4239,6 +4883,29 @@ main (int argc, char **argv) thousands_sep = -1; } @@ -4058,7 +3831,7 @@ diff -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/src/sort.c have_read_stdin = false; inittables (); -@@ -4494,13 +5163,34 @@ main (int argc, char **argv) +@@ -4513,13 +5180,34 @@ main (int argc, char **argv) case 't': { @@ -4068,7 +3841,7 @@ diff -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/src/sort.c + size_t newtab_length = 1; + strncpy (newtab, optarg, MB_LEN_MAX); + if (! newtab[0]) - error (SORT_FAILURE, 0, _("empty tab")); + die (SORT_FAILURE, 0, _("empty tab")); - if (optarg[1]) +#if HAVE_MBRTOWC + if (MB_CUR_MAX > 1) @@ -4097,22 +3870,21 @@ diff -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/src/sort.c else { /* Provoke with 'sort -txx'. Complain about -@@ -4511,9 +5201,12 @@ main (int argc, char **argv) - quote (optarg)); +@@ -4530,9 +5218,11 @@ 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)) - error (SORT_FAILURE, 0, _("incompatible tabs")); ++ if (tab_length && (tab_length != newtab_length ++ || memcmp (tab, newtab, tab_length) != 0)) + die (SORT_FAILURE, 0, _("incompatible tabs")); - tab = newtab; + memcpy (tab, newtab, newtab_length); + tab_length = newtab_length; } break; -@@ -4751,12 +5444,10 @@ main (int argc, char **argv) +@@ -4770,12 +5460,10 @@ main (int argc, char **argv) sort (files, nfiles, outfile, nthreads); } @@ -4124,11 +3896,11 @@ diff -Naurp coreutils-8.25-orig/src/sort.c coreutils-8.25/src/sort.c -#endif if (have_read_stdin && fclose (stdin) == EOF) - die (_("close failed"), "-"); -diff -Naurp coreutils-8.25-orig/src/unexpand.c coreutils-8.25/src/unexpand.c ---- coreutils-8.25-orig/src/unexpand.c 2016-01-01 07:48:50.000000000 -0600 -+++ coreutils-8.25/src/unexpand.c 2016-01-22 21:23:04.640975869 -0600 -@@ -38,12 +38,16 @@ + sort_die (_("close failed"), "-"); +diff -Naurp coreutils-8.26-orig/src/unexpand.c coreutils-8.26/src/unexpand.c +--- coreutils-8.26-orig/src/unexpand.c 2016-11-06 16:15:30.000000000 -0600 ++++ coreutils-8.26/src/unexpand.c 2016-12-02 19:15:23.525391058 -0600 +@@ -38,6 +38,9 @@ #include #include #include @@ -4136,181 +3908,9 @@ diff -Naurp coreutils-8.25-orig/src/unexpand.c coreutils-8.25/src/unexpand.c +#include + #include "system.h" - #include "error.h" - #include "fadvise.h" --#include "quote.h" + #include "die.h" #include "xstrndup.h" - -+#include "expand-core.h" -+ - /* The official name of this program (e.g., no 'g' prefix). */ - #define PROGRAM_NAME "unexpand" - -@@ -62,17 +66,17 @@ static size_t max_column_width; - /* Array of the explicit column numbers of the tab stops; - after 'tab_list' is exhausted, the rest of the line is printed - unchanged. The first column is column 0. */ --static uintmax_t *tab_list; -+uintmax_t *tab_list; - - /* The number of allocated entries in 'tab_list'. */ --static size_t n_tabs_allocated; -+size_t n_tabs_allocated; - - /* The index of the first invalid element of 'tab_list', - where the next element can be added. */ --static size_t first_free_tab; -+size_t first_free_tab; - - /* Null-terminated array of input filenames. */ --static char **file_list; -+char **file_list; - - /* Default for 'file_list' if no files are given on the command line. */ - static char *stdin_argv[] = -@@ -81,10 +85,10 @@ static char *stdin_argv[] = - }; - - /* True if we have ever read standard input. */ --static bool have_read_stdin; -+bool have_read_stdin; - - /* The desired exit status. */ --static int exit_status; -+int exit_status; - - /* For long options that have no equivalent short option, use a - non-character as a pseudo short option, starting with CHAR_MAX + 1. */ -@@ -154,128 +158,6 @@ add_tab_stop (uintmax_t tabval) - } - } - --/* Add the comma or blank separated list of tab stops STOPS -- to the list of tab stops. */ -- --static void --parse_tab_stops (char const *stops) --{ -- bool have_tabval = false; -- uintmax_t tabval IF_LINT ( = 0); -- char const *num_start IF_LINT ( = NULL); -- bool ok = true; -- -- for (; *stops; stops++) -- { -- if (*stops == ',' || isblank (to_uchar (*stops))) -- { -- if (have_tabval) -- add_tab_stop (tabval); -- have_tabval = false; -- } -- else if (ISDIGIT (*stops)) -- { -- if (!have_tabval) -- { -- tabval = 0; -- have_tabval = true; -- num_start = stops; -- } -- -- /* Detect overflow. */ -- if (!DECIMAL_DIGIT_ACCUMULATE (tabval, *stops - '0', uintmax_t)) -- { -- size_t len = strspn (num_start, "0123456789"); -- char *bad_num = xstrndup (num_start, len); -- error (0, 0, _("tab stop is too large %s"), quote (bad_num)); -- free (bad_num); -- ok = false; -- stops = num_start + len - 1; -- } -- } -- else -- { -- error (0, 0, _("tab size contains invalid character(s): %s"), -- quote (stops)); -- ok = false; -- break; -- } -- } -- -- if (!ok) -- exit (EXIT_FAILURE); -- -- if (have_tabval) -- add_tab_stop (tabval); --} -- --/* Check that the list of tab stops TABS, with ENTRIES entries, -- contains only nonzero, ascending values. */ -- --static void --validate_tab_stops (uintmax_t const *tabs, size_t entries) --{ -- uintmax_t prev_tab = 0; -- size_t i; -- -- for (i = 0; i < entries; i++) -- { -- if (tabs[i] == 0) -- error (EXIT_FAILURE, 0, _("tab size cannot be 0")); -- if (tabs[i] <= prev_tab) -- error (EXIT_FAILURE, 0, _("tab sizes must be ascending")); -- prev_tab = tabs[i]; -- } --} -- --/* Close the old stream pointer FP if it is non-NULL, -- and return a new one opened to read the next input file. -- Open a filename of '-' as the standard input. -- Return NULL if there are no more input files. */ -- --static FILE * --next_file (FILE *fp) --{ -- static char *prev_file; -- char *file; -- -- if (fp) -- { -- if (ferror (fp)) -- { -- error (0, errno, "%s", quotef (prev_file)); -- exit_status = EXIT_FAILURE; -- } -- if (STREQ (prev_file, "-")) -- clearerr (fp); /* Also clear EOF. */ -- else if (fclose (fp) != 0) -- { -- error (0, errno, "%s", quotef (prev_file)); -- exit_status = EXIT_FAILURE; -- } -- } -- -- while ((file = *file_list++) != NULL) -- { -- if (STREQ (file, "-")) -- { -- have_read_stdin = true; -- fp = stdin; -- } -- else -- fp = fopen (file, "r"); -- if (fp) -- { -- prev_file = file; -- fadvise (fp, FADVISE_SEQUENTIAL); -- return fp; -- } -- error (0, errno, "%s", quotef (file)); -- exit_status = EXIT_FAILURE; -- } -- return NULL; --} -- - /* Change blanks to tabs, writing to stdout. - Read each file in 'file_list', in order. */ - -@@ -284,11 +166,12 @@ unexpand (void) +@@ -107,24 +110,47 @@ unexpand (void) { /* Input stream. */ FILE *fp = next_file (NULL); @@ -4321,17 +3921,37 @@ diff -Naurp coreutils-8.25-orig/src/unexpand.c coreutils-8.25/src/unexpand.c stored, not merely counted. */ - char *pending_blank; + mbf_char_t *pending_blank; ++ /* True if the starting locale is utf8. */ ++ bool using_utf_locale; ++ ++ /* True if the first file contains BOM header. */ ++ bool found_bom; ++ using_utf_locale=check_utf_locale(); if (!fp) return; -@@ -296,12 +179,14 @@ unexpand (void) ++ mbf_init (mbf, fp); ++ found_bom=check_bom(fp,&mbf); + ++ if (using_utf_locale == false && found_bom == true) ++ { ++ /*try using some predefined locale */ ++ ++ if (set_utf_locale () != 0) ++ { ++ error (EXIT_FAILURE, errno, _("cannot set UTF-8 locale")); ++ } ++ } /* The worst case is a non-blank character, then one blank, then a tab stop, then MAX_COLUMN_WIDTH - 1 blanks, then a non-blank; so allocate MAX_COLUMN_WIDTH bytes to store the blanks. */ - pending_blank = xmalloc (max_column_width); + pending_blank = xmalloc (max_column_width * sizeof (mbf_char_t)); + -+ mbf_init (mbf, fp); ++ if (found_bom == true) ++ { ++ print_bom(); ++ } while (true) { @@ -4341,21 +3961,46 @@ diff -Naurp coreutils-8.25-orig/src/unexpand.c coreutils-8.25/src/unexpand.c /* If true, perform translations. */ bool convert = true; -@@ -335,12 +220,19 @@ unexpand (void) +@@ -158,12 +184,44 @@ unexpand (void) do { - while ((c = getc (fp)) < 0 && (fp = next_file (fp))) - continue; -+ do { ++ while (true) { + mbf_getc (c, mbf); -+ if (mb_iseof (c)) ++ if ((mb_iseof (c)) && (fp = next_file (fp))) + { -+ mbf_init (mbf, fp = next_file (fp)); ++ mbf_init (mbf, fp); ++ if (fp!=NULL) ++ { ++ if (check_bom(fp,&mbf)==true) ++ { ++ /*Not the first file - check BOM header*/ ++ if (using_utf_locale==false && found_bom==false) ++ { ++ /*BOM header in subsequent file but not in the first one. */ ++ error (EXIT_FAILURE, errno, _("combination of files with and without BOM header")); ++ } ++ } ++ else ++ { ++ if(using_utf_locale==false && found_bom==true) ++ { ++ /*First file conatined BOM header - locale was switched to UTF ++ /*all subsequent files should contain BOM. */ ++ error (EXIT_FAILURE, errno, _("combination of files with and without BOM header")); ++ } ++ } ++ } + continue; + } ++ else ++ { ++ break; ++ } + } -+ while (false); ++ if (convert) { @@ -4364,9 +4009,9 @@ diff -Naurp coreutils-8.25-orig/src/unexpand.c coreutils-8.25/src/unexpand.c if (blank) { -@@ -372,16 +264,16 @@ unexpand (void) +@@ -180,16 +238,16 @@ unexpand (void) if (next_tab_column < column) - error (EXIT_FAILURE, 0, _("input line is too long")); + die (EXIT_FAILURE, 0, _("input line is too long")); - if (c == '\t') + if (mb_iseq (c, '\t')) @@ -4384,7 +4029,7 @@ diff -Naurp coreutils-8.25-orig/src/unexpand.c coreutils-8.25/src/unexpand.c if (! (prev_blank && column == next_tab_column)) { -@@ -389,13 +281,14 @@ unexpand (void) +@@ -197,13 +255,14 @@ unexpand (void) will be replaced by tabs. */ if (column == next_tab_column) one_blank_before_tab_stop = true; @@ -4401,7 +4046,7 @@ diff -Naurp coreutils-8.25-orig/src/unexpand.c coreutils-8.25/src/unexpand.c } /* Discard pending blanks, unless it was a single -@@ -403,7 +296,7 @@ unexpand (void) +@@ -211,7 +270,7 @@ unexpand (void) pending = one_blank_before_tab_stop; } } @@ -4410,16 +4055,19 @@ diff -Naurp coreutils-8.25-orig/src/unexpand.c coreutils-8.25/src/unexpand.c { /* Go back one column, and force recalculation of the next tab stop. */ -@@ -413,7 +306,7 @@ unexpand (void) +@@ -219,9 +278,9 @@ unexpand (void) + next_tab_column = column; + tab_index -= !!tab_index; } - else +- else ++ else if (!mb_iseq (c, '\n')) { - column++; + column += mb_width (c); if (!column) - error (EXIT_FAILURE, 0, _("input line is too long")); + die (EXIT_FAILURE, 0, _("input line is too long")); } -@@ -421,9 +314,13 @@ unexpand (void) +@@ -229,8 +288,11 @@ unexpand (void) if (pending) { if (pending > 1 && one_blank_before_tab_stop) @@ -4430,12 +4078,10 @@ diff -Naurp coreutils-8.25-orig/src/unexpand.c coreutils-8.25/src/unexpand.c + for (int n = 0; n < pending; ++n) + mb_putc (pending_blank[n], stdout); + if (ferror (stdout)) - error (EXIT_FAILURE, errno, _("write error")); -+ + die (EXIT_FAILURE, errno, _("write error")); pending = 0; one_blank_before_tab_stop = false; - } -@@ -432,16 +329,16 @@ unexpand (void) +@@ -240,16 +302,17 @@ unexpand (void) convert &= convert_entire_line || blank; } @@ -4445,29 +4091,20 @@ diff -Naurp coreutils-8.25-orig/src/unexpand.c coreutils-8.25/src/unexpand.c free (pending_blank); return; } -- + - if (putchar (c) < 0) + mb_putc (c, stdout); + if (ferror (stdout)) - error (EXIT_FAILURE, errno, _("write error")); + die (EXIT_FAILURE, errno, _("write error")); } - while (c != '\n'); + while (!mb_iseq (c, '\n')); } } -@@ -482,7 +379,7 @@ main (int argc, char **argv) - break; - case 't': - convert_entire_line = true; -- parse_tab_stops (optarg); -+ parse_tab_stops (optarg, add_tab_stop); - break; - case CONVERT_FIRST_ONLY_OPTION: - convert_first_only = true; -diff -Naurp coreutils-8.25-orig/src/uniq.c coreutils-8.25/src/uniq.c ---- coreutils-8.25-orig/src/uniq.c 2016-01-13 05:08:59.000000000 -0600 -+++ coreutils-8.25/src/uniq.c 2016-01-22 21:23:04.617641142 -0600 +diff -Naurp coreutils-8.26-orig/src/uniq.c coreutils-8.26/src/uniq.c +--- coreutils-8.26-orig/src/uniq.c 2016-11-06 16:15:30.000000000 -0600 ++++ coreutils-8.26/src/uniq.c 2016-12-02 19:15:23.526390974 -0600 @@ -21,6 +21,17 @@ #include #include @@ -4486,7 +4123,7 @@ diff -Naurp coreutils-8.25-orig/src/uniq.c coreutils-8.25/src/uniq.c #include "system.h" #include "argmatch.h" #include "linebuffer.h" -@@ -31,9 +42,21 @@ +@@ -32,9 +43,21 @@ #include "stdio--.h" #include "xmemcoll.h" #include "xstrtol.h" @@ -4509,7 +4146,7 @@ diff -Naurp coreutils-8.25-orig/src/uniq.c coreutils-8.25/src/uniq.c /* The official name of this program (e.g., no 'g' prefix). */ #define PROGRAM_NAME "uniq" -@@ -143,6 +166,10 @@ enum +@@ -144,6 +167,10 @@ enum GROUP_OPTION = CHAR_MAX + 1 }; @@ -4520,7 +4157,7 @@ diff -Naurp coreutils-8.25-orig/src/uniq.c coreutils-8.25/src/uniq.c static struct option const longopts[] = { {"count", no_argument, NULL, 'c'}, -@@ -252,7 +279,7 @@ size_opt (char const *opt, char const *m +@@ -260,7 +287,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 @@ -4529,7 +4166,7 @@ diff -Naurp coreutils-8.25-orig/src/uniq.c coreutils-8.25/src/uniq.c { size_t count; char const *lp = line->buffer; -@@ -272,6 +299,83 @@ find_field (struct linebuffer const *lin +@@ -280,6 +307,83 @@ find_field (struct linebuffer const *lin return line->buffer + i; } @@ -4579,7 +4216,7 @@ diff -Naurp coreutils-8.25-orig/src/uniq.c coreutils-8.25/src/uniq.c + while (pos < size) + { + MBCHAR_TO_WCHAR (wc, mblength, lp, pos, size, statep, convfail); -+ ++ + if (convfail || !(iswblank (wc) || wc == '\n')) + { + pos += mblength; @@ -4613,7 +4250,7 @@ diff -Naurp coreutils-8.25-orig/src/uniq.c coreutils-8.25/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. -@@ -280,6 +384,8 @@ find_field (struct linebuffer const *lin +@@ -288,6 +392,8 @@ find_field (struct linebuffer const *lin static bool different (char *old, char *new, size_t oldlen, size_t newlen) { @@ -4622,7 +4259,7 @@ diff -Naurp coreutils-8.25-orig/src/uniq.c coreutils-8.25/src/uniq.c if (check_chars < oldlen) oldlen = check_chars; if (check_chars < newlen) -@@ -287,15 +393,104 @@ different (char *old, char *new, size_t +@@ -295,14 +401,103 @@ different (char *old, char *new, size_t if (ignore_case) { @@ -4654,8 +4291,8 @@ diff -Naurp coreutils-8.25-orig/src/uniq.c coreutils-8.25/src/uniq.c + + return xmemcoll (copy_old, oldlen, copy_new, newlen); + - } - ++} ++ +#if HAVE_MBRTOWC +static int +different_multi (const char *old, const char *new, size_t oldlen, size_t newlen, mbstate_t oldstate, mbstate_t newstate) @@ -4726,13 +4363,12 @@ diff -Naurp coreutils-8.25-orig/src/uniq.c coreutils-8.25/src/uniq.c + free (copy[1]); + return rc; + -+} + } +#endif -+ + /* Output the line in linebuffer LINE to standard output provided that the switches say it should be output. - MATCH is true if the line matches the previous line. -@@ -359,19 +554,38 @@ check_file (const char *infile, const ch +@@ -367,19 +562,38 @@ check_file (const char *infile, const ch char *prevfield IF_LINT ( = NULL); size_t prevlen IF_LINT ( = 0); bool first_group_printed = false; @@ -4771,7 +4407,7 @@ diff -Naurp coreutils-8.25-orig/src/uniq.c coreutils-8.25/src/uniq.c new_group = (prevline->length == 0 || different (thisfield, prevfield, thislen, prevlen)); -@@ -389,6 +603,10 @@ check_file (const char *infile, const ch +@@ -397,6 +611,10 @@ check_file (const char *infile, const ch SWAP_LINES (prevline, thisline); prevfield = thisfield; prevlen = thislen; @@ -4782,7 +4418,7 @@ diff -Naurp coreutils-8.25-orig/src/uniq.c coreutils-8.25/src/uniq.c first_group_printed = true; } } -@@ -401,17 +619,26 @@ check_file (const char *infile, const ch +@@ -409,17 +627,26 @@ check_file (const char *infile, const ch size_t prevlen; uintmax_t match_count = 0; bool first_delimiter = true; @@ -4809,7 +4445,7 @@ diff -Naurp coreutils-8.25-orig/src/uniq.c coreutils-8.25/src/uniq.c if (readlinebuffer_delim (thisline, stdin, delimiter) == 0) { if (ferror (stdin)) -@@ -420,6 +647,14 @@ check_file (const char *infile, const ch +@@ -428,6 +655,14 @@ check_file (const char *infile, const ch } thisfield = find_field (thisline); thislen = thisline->length - 1 - (thisfield - thisline->buffer); @@ -4824,7 +4460,7 @@ diff -Naurp coreutils-8.25-orig/src/uniq.c coreutils-8.25/src/uniq.c match = !different (thisfield, prevfield, thislen, prevlen); match_count += match; -@@ -452,6 +687,9 @@ check_file (const char *infile, const ch +@@ -460,6 +695,9 @@ check_file (const char *infile, const ch SWAP_LINES (prevline, thisline); prevfield = thisfield; prevlen = thislen; @@ -4834,7 +4470,7 @@ diff -Naurp coreutils-8.25-orig/src/uniq.c coreutils-8.25/src/uniq.c if (!match) match_count = 0; } -@@ -498,6 +736,19 @@ main (int argc, char **argv) +@@ -506,6 +744,19 @@ main (int argc, char **argv) atexit (close_stdout); @@ -4854,10 +4490,10 @@ diff -Naurp coreutils-8.25-orig/src/uniq.c coreutils-8.25/src/uniq.c skip_chars = 0; skip_fields = 0; check_chars = SIZE_MAX; -diff -Naurp coreutils-8.25-orig/tests/expand/mb.sh coreutils-8.25/tests/expand/mb.sh ---- coreutils-8.25-orig/tests/expand/mb.sh 1969-12-31 18:00:00.000000000 -0600 -+++ coreutils-8.25/tests/expand/mb.sh 2016-01-22 21:23:04.640975869 -0600 -@@ -0,0 +1,98 @@ +diff -Naurp coreutils-8.26-orig/tests/expand/mb.sh coreutils-8.26/tests/expand/mb.sh +--- coreutils-8.26-orig/tests/expand/mb.sh 1969-12-31 18:00:00.000000000 -0600 ++++ coreutils-8.26/tests/expand/mb.sh 2016-12-02 19:15:23.526390974 -0600 +@@ -0,0 +1,183 @@ +#!/bin/sh + +# Copyright (C) 2012-2015 Free Software Foundation, Inc. @@ -4904,6 +4540,20 @@ diff -Naurp coreutils-8.25-orig/tests/expand/mb.sh coreutils-8.25/tests/expand/m +expand < in > out || fail=1 +compare exp out > /dev/null 2>&1 || fail=1 + ++#multiple files as an input ++cat <<\EOF >> exp || framework_failure_ ++1234567812345678123456781 ++. . . . ++a b c d ++. . . . ++ä ö ü ß ++. . . . ++ äöü . öüä. ä xx ++EOF ++ ++expand ./in ./in > out || fail=1 ++compare exp out > /dev/null 2>&1 || fail=1 ++ +#test characters with display widths != 1 +env printf '12345678 +e\t|ascii(1) @@ -4955,10 +4605,81 @@ diff -Naurp coreutils-8.25-orig/tests/expand/mb.sh coreutils-8.25/tests/expand/m +expand < in > out || fail=1 +compare exp out > /dev/null 2>&1 || fail=1 + ++ ++ ++#BOM header test 1 ++printf "\xEF\xBB\xBF" > in; cat <<\EOF >> in || framework_failure_ ++1234567812345678123456781 ++. . . . ++a b c d ++. . . . ++ä ö ü ß ++. . . . ++EOF ++env printf ' äöü\t. öüä. \tä xx\n' >> in || framework_failure_ ++ ++printf "\xEF\xBB\xBF" > exp; cat <<\EOF >> exp || framework_failure_ ++1234567812345678123456781 ++. . . . ++a b c d ++. . . . ++ä ö ü ß ++. . . . ++ äöü . öüä. ä xx ++EOF ++ ++ ++expand < in > out || fail=1 ++compare exp out > /dev/null 2>&1 || fail=1 ++ ++LANG=C expand < in > out || fail=1 ++compare exp out > /dev/null 2>&1 || fail=1 ++ ++LC_ALL=C expand < in > out || fail=1 ++compare exp out > /dev/null 2>&1 || fail=1 ++ ++ ++printf '\xEF\xBB\xBF' > in1; cat <<\EOF >> in1 || framework_failure_ ++1234567812345678123456781 ++. . . . ++a b c d ++. . . . ++ä ö ü ß ++. . . . ++EOF ++env printf ' äöü\t. öüä. \tä xx\n' >> in1 || framework_failure_ ++ ++ ++printf '\xEF\xBB\xBF' > exp; cat <<\EOF >> exp || framework_failure_ ++1234567812345678123456781 ++. . . . ++a b c d ++. . . . ++ä ö ü ß ++. . . . ++ äöü . öüä. ä xx ++1234567812345678123456781 ++. . . . ++a b c d ++. . . . ++ä ö ü ß ++. . . . ++ äöü . öüä. ä xx ++EOF ++ ++expand in1 in1 > out || fail=1 ++compare exp out > /dev/null 2>&1 || fail=1 ++ ++LANG=C expand in1 in1 > out || fail=1 ++compare exp out > /dev/null 2>&1 || fail=1 ++ ++LC_ALL=C expand in1 in1 > out || fail=1 ++compare exp out > /dev/null 2>&1 || fail=1 ++ +exit $fail -diff -Naurp coreutils-8.25-orig/tests/i18n/sort.sh coreutils-8.25/tests/i18n/sort.sh ---- coreutils-8.25-orig/tests/i18n/sort.sh 1969-12-31 18:00:00.000000000 -0600 -+++ coreutils-8.25/tests/i18n/sort.sh 2016-01-22 21:23:04.617641142 -0600 +diff -Naurp coreutils-8.26-orig/tests/i18n/sort.sh coreutils-8.26/tests/i18n/sort.sh +--- coreutils-8.26-orig/tests/i18n/sort.sh 1969-12-31 18:00:00.000000000 -0600 ++++ coreutils-8.26/tests/i18n/sort.sh 2016-12-02 19:15:23.527390889 -0600 @@ -0,0 +1,29 @@ +#!/bin/sh +# Verify sort's multi-byte support. @@ -4989,19 +4710,19 @@ diff -Naurp coreutils-8.25-orig/tests/i18n/sort.sh coreutils-8.25/tests/i18n/sor + + +Exit $fail -diff -Naurp coreutils-8.25-orig/tests/local.mk coreutils-8.25/tests/local.mk ---- coreutils-8.25-orig/tests/local.mk 2016-01-16 12:18:13.000000000 -0600 -+++ coreutils-8.25/tests/local.mk 2016-01-22 21:23:04.640975869 -0600 -@@ -344,6 +344,8 @@ all_tests = \ +diff -Naurp coreutils-8.26-orig/tests/local.mk coreutils-8.26/tests/local.mk +--- coreutils-8.26-orig/tests/local.mk 2016-11-22 14:04:32.000000000 -0600 ++++ coreutils-8.26/tests/local.mk 2016-12-02 19:15:23.527390889 -0600 +@@ -350,6 +350,8 @@ all_tests = \ tests/misc/sort-discrim.sh \ tests/misc/sort-files0-from.pl \ tests/misc/sort-float.sh \ + tests/misc/sort-mb-tests.sh \ + tests/i18n/sort.sh \ + tests/misc/sort-h-thousands-sep.sh \ tests/misc/sort-merge.pl \ tests/misc/sort-merge-fdlimit.sh \ - tests/misc/sort-month.sh \ -@@ -534,6 +536,7 @@ all_tests = \ +@@ -542,6 +544,7 @@ all_tests = \ tests/du/threshold.sh \ tests/du/trailing-slash.sh \ tests/du/two-args.sh \ @@ -5009,7 +4730,7 @@ diff -Naurp coreutils-8.25-orig/tests/local.mk coreutils-8.25/tests/local.mk tests/id/gnu-zero-uids.sh \ tests/id/no-context.sh \ tests/id/context.sh \ -@@ -672,6 +675,7 @@ all_tests = \ +@@ -682,6 +685,7 @@ all_tests = \ tests/touch/read-only.sh \ tests/touch/relative.sh \ tests/touch/trailing-slash.sh \ @@ -5017,9 +4738,9 @@ diff -Naurp coreutils-8.25-orig/tests/local.mk coreutils-8.25/tests/local.mk $(all_root_tests) # See tests/factor/create-test.sh. -diff -Naurp coreutils-8.25-orig/tests/misc/cut.pl coreutils-8.25/tests/misc/cut.pl ---- coreutils-8.25-orig/tests/misc/cut.pl 2016-01-16 12:18:13.000000000 -0600 -+++ coreutils-8.25/tests/misc/cut.pl 2016-01-22 21:23:04.617641142 -0600 +diff -Naurp coreutils-8.26-orig/tests/misc/cut.pl coreutils-8.26/tests/misc/cut.pl +--- coreutils-8.26-orig/tests/misc/cut.pl 2016-03-16 07:21:24.000000000 -0500 ++++ coreutils-8.26/tests/misc/cut.pl 2016-12-02 19:15:23.527390889 -0600 @@ -23,9 +23,11 @@ use strict; # Turn off localization of executable's output. @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; @@ -5042,10 +4763,10 @@ diff -Naurp coreutils-8.25-orig/tests/misc/cut.pl coreutils-8.25/tests/misc/cut. push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}]; } push @Tests, @new; -diff -Naurp coreutils-8.25-orig/tests/misc/expand.pl coreutils-8.25/tests/misc/expand.pl ---- coreutils-8.25-orig/tests/misc/expand.pl 2016-01-16 12:18:13.000000000 -0600 -+++ coreutils-8.25/tests/misc/expand.pl 2016-01-22 21:23:04.620974674 -0600 -@@ -23,6 +23,15 @@ use strict; +diff -Naurp coreutils-8.26-orig/tests/misc/expand.pl coreutils-8.26/tests/misc/expand.pl +--- coreutils-8.26-orig/tests/misc/expand.pl 2016-11-06 16:15:30.000000000 -0600 ++++ coreutils-8.26/tests/misc/expand.pl 2016-12-02 19:15:23.528390805 -0600 +@@ -27,6 +27,15 @@ my $prog = 'expand'; # Turn off localization of executable's output. @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; @@ -5061,8 +4782,17 @@ diff -Naurp coreutils-8.25-orig/tests/misc/expand.pl coreutils-8.25/tests/misc/e my @Tests = ( ['t1', '--tabs=3', {IN=>"a\tb"}, {OUT=>"a b"}], -@@ -31,6 +40,37 @@ my @Tests = - ['i2', '--tabs=3 -i', {IN=>" \ta\tb"}, {OUT=>" a\tb"}], +@@ -140,6 +149,8 @@ my @Tests = + + + # Test errors ++ # FIXME: The following tests contain ‘quoting’ specific to LC_MESSAGES ++ # So we force LC_MESSAGES=C to make them pass. + ['e1', '--tabs="a"', {IN=>''}, {OUT=>''}, {EXIT=>1}, + {ERR => "$prog: tab size contains invalid character(s): 'a'\n"}], + ['e2', "-t $UINTMAX_OFLOW", {IN=>''}, {OUT=>''}, {EXIT=>1}, +@@ -150,6 +161,37 @@ my @Tests = + {ERR => "$prog: tab sizes must be ascending\n"}], ); +if ($mb_locale ne 'C') @@ -5088,7 +4818,7 @@ diff -Naurp coreutils-8.25-orig/tests/misc/expand.pl coreutils-8.25/tests/misc/e + push @new_t, $sub; + push @$t, $sub; + } -+ push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}]; ++ push @new, ["$test_name-mb", @new_t, {ENV => "LANG=$mb_locale LC_MESSAGES=C"}]; + } + push @Tests, @new; + } @@ -5099,9 +4829,9 @@ diff -Naurp coreutils-8.25-orig/tests/misc/expand.pl coreutils-8.25/tests/misc/e my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE}; -diff -Naurp coreutils-8.25-orig/tests/misc/fold.pl coreutils-8.25/tests/misc/fold.pl ---- coreutils-8.25-orig/tests/misc/fold.pl 2016-01-16 12:18:13.000000000 -0600 -+++ coreutils-8.25/tests/misc/fold.pl 2016-01-22 21:23:04.620974674 -0600 +diff -Naurp coreutils-8.26-orig/tests/misc/fold.pl coreutils-8.26/tests/misc/fold.pl +--- coreutils-8.26-orig/tests/misc/fold.pl 2016-03-16 07:21:24.000000000 -0500 ++++ coreutils-8.26/tests/misc/fold.pl 2016-12-02 19:15:23.528390805 -0600 @@ -20,9 +20,18 @@ use strict; (my $program_name = $0) =~ s|.*/||; @@ -5171,9 +4901,9 @@ diff -Naurp coreutils-8.25-orig/tests/misc/fold.pl coreutils-8.25/tests/misc/fol -my $prog = 'fold'; my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose); exit $fail; -diff -Naurp coreutils-8.25-orig/tests/misc/join.pl coreutils-8.25/tests/misc/join.pl ---- coreutils-8.25-orig/tests/misc/join.pl 2016-01-16 12:18:13.000000000 -0600 -+++ coreutils-8.25/tests/misc/join.pl 2016-01-22 21:23:04.620974674 -0600 +diff -Naurp coreutils-8.26-orig/tests/misc/join.pl coreutils-8.26/tests/misc/join.pl +--- coreutils-8.26-orig/tests/misc/join.pl 2016-03-16 07:21:24.000000000 -0500 ++++ coreutils-8.26/tests/misc/join.pl 2016-12-02 19:15:23.528390805 -0600 @@ -25,6 +25,15 @@ my $limits = getlimits (); my $prog = 'join'; @@ -5240,9 +4970,9 @@ diff -Naurp coreutils-8.25-orig/tests/misc/join.pl coreutils-8.25/tests/misc/joi my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE}; -diff -Naurp coreutils-8.25-orig/tests/misc/sort-mb-tests.sh coreutils-8.25/tests/misc/sort-mb-tests.sh ---- coreutils-8.25-orig/tests/misc/sort-mb-tests.sh 1969-12-31 18:00:00.000000000 -0600 -+++ coreutils-8.25/tests/misc/sort-mb-tests.sh 2016-01-22 21:23:04.620974674 -0600 +diff -Naurp coreutils-8.26-orig/tests/misc/sort-mb-tests.sh coreutils-8.26/tests/misc/sort-mb-tests.sh +--- coreutils-8.26-orig/tests/misc/sort-mb-tests.sh 1969-12-31 18:00:00.000000000 -0600 ++++ coreutils-8.26/tests/misc/sort-mb-tests.sh 2016-12-02 19:15:23.528390805 -0600 @@ -0,0 +1,45 @@ +#!/bin/sh +# Verify sort's multi-byte support. @@ -5289,9 +5019,9 @@ diff -Naurp coreutils-8.25-orig/tests/misc/sort-mb-tests.sh coreutils-8.25/tests +compare exp out || { fail=1; cat out; } + +Exit $fail -diff -Naurp coreutils-8.25-orig/tests/misc/sort-merge.pl coreutils-8.25/tests/misc/sort-merge.pl ---- coreutils-8.25-orig/tests/misc/sort-merge.pl 2016-01-16 12:18:14.000000000 -0600 -+++ coreutils-8.25/tests/misc/sort-merge.pl 2016-01-22 21:23:04.624308207 -0600 +diff -Naurp coreutils-8.26-orig/tests/misc/sort-merge.pl coreutils-8.26/tests/misc/sort-merge.pl +--- coreutils-8.26-orig/tests/misc/sort-merge.pl 2016-03-16 07:21:24.000000000 -0500 ++++ coreutils-8.26/tests/misc/sort-merge.pl 2016-12-02 19:15:23.529390720 -0600 @@ -26,6 +26,15 @@ my $prog = 'sort'; # Turn off localization of executable's output. @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; @@ -5348,9 +5078,9 @@ diff -Naurp coreutils-8.25-orig/tests/misc/sort-merge.pl coreutils-8.25/tests/mi my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE}; -diff -Naurp coreutils-8.25-orig/tests/misc/sort.pl coreutils-8.25/tests/misc/sort.pl ---- coreutils-8.25-orig/tests/misc/sort.pl 2016-01-16 12:18:14.000000000 -0600 -+++ coreutils-8.25/tests/misc/sort.pl 2016-01-22 21:23:04.624308207 -0600 +diff -Naurp coreutils-8.26-orig/tests/misc/sort.pl coreutils-8.26/tests/misc/sort.pl +--- coreutils-8.26-orig/tests/misc/sort.pl 2016-03-16 07:21:24.000000000 -0500 ++++ coreutils-8.26/tests/misc/sort.pl 2016-12-02 19:15:23.529390720 -0600 @@ -24,10 +24,15 @@ my $prog = 'sort'; # Turn off localization of executable's output. @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; @@ -5415,9 +5145,9 @@ diff -Naurp coreutils-8.25-orig/tests/misc/sort.pl coreutils-8.25/tests/misc/sor my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE}; -diff -Naurp coreutils-8.25-orig/tests/misc/unexpand.pl coreutils-8.25/tests/misc/unexpand.pl ---- coreutils-8.25-orig/tests/misc/unexpand.pl 2016-01-16 12:18:14.000000000 -0600 -+++ coreutils-8.25/tests/misc/unexpand.pl 2016-01-22 21:23:04.624308207 -0600 +diff -Naurp coreutils-8.26-orig/tests/misc/unexpand.pl coreutils-8.26/tests/misc/unexpand.pl +--- coreutils-8.26-orig/tests/misc/unexpand.pl 2016-11-06 16:15:30.000000000 -0600 ++++ coreutils-8.26/tests/misc/unexpand.pl 2016-12-02 19:15:23.530390636 -0600 @@ -27,6 +27,14 @@ my $limits = getlimits (); my $prog = 'unexpand'; @@ -5433,8 +5163,8 @@ diff -Naurp coreutils-8.25-orig/tests/misc/unexpand.pl coreutils-8.25/tests/misc 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"}], +@@ -128,6 +136,37 @@ my @Tests = + ['ts2', '-t5,8', {IN=>"x\t \t y\n"}, {OUT=>"x\t\t y\n"}], ); +if ($mb_locale ne 'C') @@ -5471,9 +5201,9 @@ diff -Naurp coreutils-8.25-orig/tests/misc/unexpand.pl coreutils-8.25/tests/misc my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE}; -diff -Naurp coreutils-8.25-orig/tests/misc/uniq.pl coreutils-8.25/tests/misc/uniq.pl ---- coreutils-8.25-orig/tests/misc/uniq.pl 2016-01-16 12:18:14.000000000 -0600 -+++ coreutils-8.25/tests/misc/uniq.pl 2016-01-22 21:23:04.627641739 -0600 +diff -Naurp coreutils-8.26-orig/tests/misc/uniq.pl coreutils-8.26/tests/misc/uniq.pl +--- coreutils-8.26-orig/tests/misc/uniq.pl 2016-03-16 07:21:24.000000000 -0500 ++++ coreutils-8.26/tests/misc/uniq.pl 2016-12-02 19:15:23.530390636 -0600 @@ -23,9 +23,17 @@ my $limits = getlimits (); my $prog = 'uniq'; my $try = "Try '$prog --help' for more information.\n"; @@ -5546,9 +5276,9 @@ diff -Naurp coreutils-8.25-orig/tests/misc/uniq.pl coreutils-8.25/tests/misc/uni @Tests = add_z_variants \@Tests; @Tests = triple_test \@Tests; -diff -Naurp coreutils-8.25-orig/tests/pr/pr-tests.pl coreutils-8.25/tests/pr/pr-tests.pl ---- coreutils-8.25-orig/tests/pr/pr-tests.pl 2016-01-16 12:18:14.000000000 -0600 -+++ coreutils-8.25/tests/pr/pr-tests.pl 2016-01-22 21:23:04.627641739 -0600 +diff -Naurp coreutils-8.26-orig/tests/pr/pr-tests.pl coreutils-8.26/tests/pr/pr-tests.pl +--- coreutils-8.26-orig/tests/pr/pr-tests.pl 2016-11-25 08:01:44.000000000 -0600 ++++ coreutils-8.26/tests/pr/pr-tests.pl 2016-12-02 19:15:23.530390636 -0600 @@ -24,6 +24,15 @@ use strict; my $prog = 'pr'; my $normalize_strerror = "s/': .*/'/"; @@ -5565,9 +5295,9 @@ diff -Naurp coreutils-8.25-orig/tests/pr/pr-tests.pl coreutils-8.25/tests/pr/pr- my @tv = ( # -b option is no longer an official option. But it's still working to -@@ -467,8 +476,48 @@ push @Tests, - {IN=>{3=>"x\ty\tz\n"}}, - {OUT=>join("\t", qw(a b c m n o x y z)) . "\n"} ]; +@@ -474,8 +483,48 @@ push @Tests, + {IN=>{2=>"a\n"}}, + {OUT=>"a\t\t\t\t \t\t\ta\n"} ]; +# Add _POSIX2_VERSION=199209 to the environment of each test +# that uses an old-style option like +1. @@ -5595,7 +5325,7 @@ diff -Naurp coreutils-8.25-orig/tests/pr/pr-tests.pl coreutils-8.25/tests/pr/pr- + push @$t, $sub; + } + #temporarily skip some failing tests -+ next if ($test_name =~ "col-0" or $test_name =~ "col-inval"); ++ next if ($test_name =~ "col-0" or $test_name =~ "col-inval" or $test_name =~ "asan1"); + push @new, ["$test_name-mb", @new_t, {ENV => "LC_ALL=$mb_locale"}]; + } + push @Tests, @new; @@ -5614,10 +5344,10 @@ diff -Naurp coreutils-8.25-orig/tests/pr/pr-tests.pl coreutils-8.25/tests/pr/pr- my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE}; -diff -Naurp coreutils-8.25-orig/tests/unexpand/mb.sh coreutils-8.25/tests/unexpand/mb.sh ---- coreutils-8.25-orig/tests/unexpand/mb.sh 1969-12-31 18:00:00.000000000 -0600 -+++ coreutils-8.25/tests/unexpand/mb.sh 2016-01-22 21:23:04.640975869 -0600 -@@ -0,0 +1,97 @@ +diff -Naurp coreutils-8.26-orig/tests/unexpand/mb.sh coreutils-8.26/tests/unexpand/mb.sh +--- coreutils-8.26-orig/tests/unexpand/mb.sh 1969-12-31 18:00:00.000000000 -0600 ++++ coreutils-8.26/tests/unexpand/mb.sh 2016-12-02 19:15:23.531390552 -0600 +@@ -0,0 +1,172 @@ +#!/bin/sh + +# Copyright (C) 2012-2015 Free Software Foundation, Inc. @@ -5664,6 +5394,22 @@ diff -Naurp coreutils-8.25-orig/tests/unexpand/mb.sh coreutils-8.25/tests/unexpa +unexpand -a < in > out || fail=1 +compare exp out > /dev/null 2>&1 || fail=1 + ++ ++#multiple files as an input ++cat >> exp <<\EOF ++1234567812345678123456781 ++. . . . ++a b c d ++. . . . ++ä ö ü ß ++. . . . ++ äöü . öüä. ä xx ++EOF ++ ++ ++unexpand -a ./in ./in > out || fail=1 ++compare exp out > /dev/null 2>&1 || fail=1 ++ +#test characters with a display width larger than 1 + +env printf '12345678 @@ -5715,3 +5461,62 @@ diff -Naurp coreutils-8.25-orig/tests/unexpand/mb.sh coreutils-8.25/tests/unexpa + +unexpand -a < in > out || fail=1 +compare exp out > /dev/null 2>&1 || fail=1 ++ ++#BOM header test 1 ++printf "\xEF\xBB\xBF" > in; cat <<\EOF >> in || framework_failure_ ++1234567812345678123456781 ++. . . . ++a b c d ++. . . . ++ä ö ü ß ++. . . . ++ äöü . öüä. ä xx ++EOF ++env printf ' äöü\t. öüä. \tä xx\n' >> in || framework_failure_ ++ ++printf "\xEF\xBB\xBF" > exp; cat <<\EOF >> exp || framework_failure_ ++1234567812345678123456781 ++. . . . ++a b c d ++. . . . ++ä ö ü ß ++. . . . ++ äöü . öüä. ä xx ++EOF ++ ++unexpand < in > out || fail=1 ++compare exp out > /dev/null 2>&1 || fail=1 ++ ++LANG=C unexpand < in > out || fail=1 ++compare exp out > /dev/null 2>&1 || fail=1 ++ ++LC_ALL=C unexpand < in > out || fail=1 ++compare exp out > /dev/null 2>&1 || fail=1 ++ ++ ++printf "\xEF\xBB\xBF" > exp; cat <<\EOF >> exp || framework_failure_ ++1234567812345678123456781 ++. . . . ++a b c d ++. . . . ++ä ö ü ß ++. . . . ++ äöü . öüä. ä xx ++1234567812345678123456781 ++. . . . ++a b c d ++. . . . ++ä ö ü ß ++. . . . ++ äöü . öüä. ä xx ++EOF ++ ++ ++unexpand in in > out || fail=1 ++compare exp out > /dev/null 2>&1 || fail=1 ++ ++LANG=C unexpand in in > out || fail=1 ++compare exp out > /dev/null 2>&1 || fail=1 ++ ++LC_ALL=C unexpand in in > out || fail=1 ++compare exp out > /dev/null 2>&1 || fail=1 diff --git a/coreutils.spec b/coreutils.spec index 8cc50a4..7bbf8a2 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,7 +1,7 @@ %define i18npatch_version %version Name: coreutils -Version: 8.25 -Release: 2mamba +Version: 8.26 +Release: 1mamba Summary: A GNU set of tools commonly used in shell scripts Group: System/Tools Vendor: openmamba @@ -188,6 +188,9 @@ exit 0 #%doc THANKS THANKS-to-translators THANKStt.in %changelog +* Sat Dec 10 2016 Automatic Build System 8.26-1mamba +- automatic version update by autodist + * Tue Jul 12 2016 Silvan Calarco 8.25-2mamba - rebuilt