diff --git a/coreutils-i18n.patch b/coreutils-i18n.patch index e8803ae..9ba6bb4 100644 --- a/coreutils-i18n.patch +++ b/coreutils-i18n.patch @@ -75,7 +75,7 @@ diff -urNp coreutils-8.13-orig/src/cut.c coreutils-8.13/src/cut.c + while (0) + +/* Get wide character on BUFPOS. BUFPOS is not included after that. -+ If byte sequence is not valid as a character, CONVFAIL is 1. Otherwise 0. */ ++ If byte sequence is not valid as a character, CONVFAIL is 1. Otherwise 0. */ +#define GET_NEXT_WC_FROM_BUFFER(WC, BUFPOS, BUFLEN, MBLENGTH, STATE, CONVFAIL) \ + do \ + { \ @@ -226,7 +226,7 @@ diff -urNp coreutils-8.13-orig/src/cut.c coreutils-8.13/src/cut.c } max_range_endpoint = 0; -@@ -582,6 +664,63 @@ cut_bytes (FILE *stream) +@@ -582,6 +664,77 @@ cut_bytes (FILE *stream) } } @@ -234,11 +234,11 @@ diff -urNp coreutils-8.13-orig/src/cut.c coreutils-8.13/src/cut.c +/* This function is in use for the following case. + + 1. Read from the stream STREAM, printing to standard output any selected -+ characters. ++ characters. + + 2. Read from stream STREAM, printing to standard output any selected bytes, + without splitting multibyte characters. */ -+ ++ +static void +cut_characters_or_cut_bytes_no_split (FILE *stream) +{ @@ -251,6 +251,9 @@ diff -urNp coreutils-8.13-orig/src/cut.c coreutils-8.13/src/cut.c + as same character as WC. */ + mbstate_t state; /* State of the stream. */ + int convfail = 0; /* 1, when conversion is failed. Otherwise 0. */ ++ /* 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; @@ -273,12 +276,23 @@ diff -urNp coreutils-8.13-orig/src/cut.c coreutils-8.13/src/cut.c + { + putchar ('\n'); + idx = 0; ++ print_delimiter = false; + } + else + { ++ bool range_start; ++ bool *rs = output_delimiter_specified ? &range_start : NULL; + idx += (operating_mode == byte_mode) ? mblength : 1; -+ if (print_kth (idx, NULL)) -+ fwrite (bufpos, mblength, sizeof(char), stdout); ++ if (print_kth (idx, rs)) ++ { ++ if (rs && *rs && print_delimiter) ++ { ++ fwrite (output_delimiter_string, sizeof (char), ++ output_delimiter_length, stdout); ++ } ++ print_delimiter = true; ++ fwrite (bufpos, mblength, sizeof(char), stdout); ++ } + } + + buflen -= mblength; @@ -286,11 +300,11 @@ diff -urNp coreutils-8.13-orig/src/cut.c coreutils-8.13/src/cut.c + } +} +#endif -+ ++ /* Read from stream STREAM, printing to standard output any selected fields. */ static void -@@ -704,13 +843,192 @@ cut_fields (FILE *stream) +@@ -704,13 +843,195 @@ cut_fields (FILE *stream) } } @@ -310,7 +324,7 @@ diff -urNp coreutils-8.13-orig/src/cut.c coreutils-8.13/src/cut.c + size_t mblength; /* The byte size of a multibyte character which shows + as same character as WC. */ + mbstate_t state; /* State of the stream. */ -+ int convfail; /* 1, when conversion is failed. Otherwise 0. */ ++ int convfail = 0; /* 1, when conversion is failed. Otherwise 0. */ + + found_any_selected_field = 0; + field_idx = 1; @@ -321,7 +335,10 @@ diff -urNp coreutils-8.13-orig/src/cut.c coreutils-8.13/src/cut.c + c = getc (stream); + empty_input = (c == EOF); + if (c != EOF) ++ { + ungetc (c, stream); ++ wc = 0; ++ } + else + wc = WEOF; + @@ -607,7 +624,7 @@ diff -urNp coreutils-8.13-orig/src/cut.c coreutils-8.13/src/cut.c + if (MB_CUR_MAX <= 1 || force_singlebyte_mode) +#endif + { -+ static char dummy[2]; ++ static char dummy[2]; + dummy[0] = delim; + dummy[1] = '\0'; + output_delimiter_string = dummy; @@ -1551,7 +1568,7 @@ diff -urNp coreutils-8.13-orig/src/join.c coreutils-8.13/src/join.c - return xmemcoll (beg1, len1, beg2, len2); - diff = memcmp (beg1, beg2, MIN (len1, len2)); + copy[0] = (unsigned char *) beg[0]; -+ copy[1] = (unsigned char *) beg[1]; ++ copy[1] = (unsigned char *) beg[1]; } + if (hard_LC_COLLATE) @@ -1632,7 +1649,7 @@ diff -urNp coreutils-8.13-orig/src/join.c coreutils-8.13/src/join.c case 't': { - unsigned char newtab = optarg[0]; -+ char *newtab; ++ char *newtab = NULL; + size_t newtablen; + newtab = xstrdup (optarg); +#if HAVE_MBRTOWC @@ -1654,7 +1671,8 @@ diff -urNp coreutils-8.13-orig/src/join.c coreutils-8.13/src/join.c + newtablen = 1; if (! newtab) + { - newtab = '\n'; /* '' => process the whole line. */ +- newtab = '\n'; /* '' => process the whole line. */ ++ newtab = "\n"; /* '' => process the whole line. */ + } else if (optarg[1]) { @@ -3085,7 +3103,7 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/src/sort.c else if (key->random) diff = compare_random (ta, tlena, tb, tlenb); else if (key->version) -@@ -2632,6 +3066,179 @@ keycompare (struct line const *a, struct +@@ -2632,6 +3066,180 @@ keycompare (struct line const *a, struct return key->reverse ? -diff : diff; } @@ -3167,7 +3185,8 @@ diff -urNp coreutils-8.13-orig/src/sort.c coreutils-8.13/src/sort.c + if (MBLENGTH == (size_t)-2 || MBLENGTH == (size_t)-1) \ + STATE = state_bak; \ + if (!ignore) \ -+ COPY[NEW_LEN++] = TEXT[i++]; \ ++ COPY[NEW_LEN++] = TEXT[i]; \ ++ i++; \ + continue; \ + } \ + \ diff --git a/coreutils.spec b/coreutils.spec index 9fc1d6a..5558b2e 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -324,8 +324,15 @@ fi - new upstream release 8.13 - temporarily disable recently added multibyte checks in misc/cut test +- fix the SUSE fix for cut output-delimiter - drop coreutils-libs subpackage, no longer needed +* Mon Sep 05 2011 Ondrej Vasik - 8.12-7 +- incorporate some i18n patch fixes from OpenSUSE: + - fix cut output-delimiter option + - prevent infinite loop in sort when ignoring chars + - prevent using unitialized variable in cut + * Tue Aug 23 2011 Ondrej Vasik - 8.12-6 - su: fix shell suspend in tcsh (#597928)