From e7403295f76e0e666576c56882dc18065f24b67a51b8f1f7e3127c0bfd06d9ae Mon Sep 17 00:00:00 2001 From: OBS User unknown Date: Tue, 24 Jun 2008 20:17:56 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/coreutils?expand=0&rev=27 --- coreutils.changes | 5 +++ coreutils.spec | 6 ++- i18n-limfield.diff | 98 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 i18n-limfield.diff diff --git a/coreutils.changes b/coreutils.changes index 9a4153a..b78f754 100644 --- a/coreutils.changes +++ b/coreutils.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Jun 24 15:57:01 CEST 2008 - schwab@suse.de + +- Fix sort field limit in multibyte case. + ------------------------------------------------------------------- Wed Jun 4 14:10:05 CEST 2008 - schwab@suse.de diff --git a/coreutils.spec b/coreutils.spec index ecaa0a9..937c83c 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -17,7 +17,7 @@ Url: http://www.gnu.org/software/coreutils/ License: GNU Free Documentation License, Version 1.2 (GFDL 1.2); GPL v2 or later; GPL v3 or later Group: System/Base Version: 6.12 -Release: 1 +Release: 2 Provides: fileutils sh-utils stat textutils mktemp Obsoletes: fileutils sh-utils stat textutils mktemp Obsoletes: libselinux <= 1.23.11-3 libselinux-32bit >= 9 libselinux-64bit = 9 libselinux-x86 = 9 @@ -37,6 +37,7 @@ Patch8: coreutils-sysinfo.diff Patch11: i18n-monthsort.diff Patch12: i18n-random.diff Patch16: invalid-ids.diff +Patch17: i18n-limfield.diff Patch20: coreutils-6.8-su.diff Patch21: coreutils-6.8.0-pie.diff Patch22: coreutils-5.3.0-sbin4su.diff @@ -107,6 +108,7 @@ Authors: %patch11 %patch12 %patch16 -p1 +%patch17 %patch20 %patch21 %patch22 @@ -180,6 +182,8 @@ rm -rf $RPM_BUILD_ROOT %defattr(-,root,root) %changelog +* Tue Jun 24 2008 schwab@suse.de +- Fix sort field limit in multibyte case. * Wed Jun 04 2008 schwab@suse.de - Update to coreutils 6.12. ** Bug fixes diff --git a/i18n-limfield.diff b/i18n-limfield.diff new file mode 100644 index 0000000..c0f859e --- /dev/null +++ b/i18n-limfield.diff @@ -0,0 +1,98 @@ +--- src/sort.c ++++ src/sort.c +@@ -1627,7 +1627,7 @@ limfield_mb (const struct line *line, co + GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state); + ptr += mblength; + } +- if (ptr < lim) ++ if (ptr < lim && (eword | echar)) + { + GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state); + ptr += mblength; +@@ -1638,11 +1638,6 @@ limfield_mb (const struct line *line, co + { + while (ptr < lim && ismbblank (ptr, &mblength)) + ptr += mblength; +- if (ptr < lim) +- { +- GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state); +- ptr += mblength; +- } + while (ptr < lim && !ismbblank (ptr, &mblength)) + ptr += mblength; + } +@@ -1652,20 +1647,19 @@ limfield_mb (const struct line *line, co + /* Make LIM point to the end of (one byte past) the current field. */ + if (tab != NULL) + { +- char *newlim, *p; ++ char *newlim; + +- newlim = NULL; +- for (p = ptr; p < lim;) +- { +- if (memcmp (p, tab, tab_length) == 0) +- { +- newlim = p; +- break; +- } +- +- GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state); +- p += mblength; +- } ++ for (newlim = ptr; newlim < lim;) ++ { ++ if (memcmp (newlim, tab, tab_length) == 0) ++ { ++ lim = newlim; ++ break; ++ } ++ ++ GET_BYTELEN_OF_CHAR (lim, newlim, mblength, state); ++ newlim += mblength; ++ } + } + else + { +@@ -1674,24 +1668,20 @@ limfield_mb (const struct line *line, co + + while (newlim < lim && ismbblank (newlim, &mblength)) + newlim += mblength; +- if (ptr < lim) +- { +- GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state); +- ptr += mblength; +- } + while (newlim < lim && !ismbblank (newlim, &mblength)) +- newlim += mblength; ++ newlim += mblength; + lim = newlim; + } + # endif + +- /* If we're skipping leading blanks, don't start counting characters +- until after skipping past any leading blanks. */ ++ /* If we're ignoring leading blanks when computing the End ++ of the field, don't start counting bytes until after skipping ++ past any leading blanks. */ + if (key->skipeblanks) + while (ptr < lim && ismbblank (ptr, &mblength)) + ptr += mblength; + +- memset (&state, '\0', sizeof(mbstate_t)); ++ memset (&state, '\0', sizeof (mbstate_t)); + + /* Advance PTR by ECHAR (if possible), but no further than LIM. */ + for (i = 0; i < echar; i++) +@@ -1699,9 +1689,9 @@ limfield_mb (const struct line *line, co + GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state); + + if (ptr + mblength > lim) +- break; ++ break; + else +- ptr += mblength; ++ ptr += mblength; + } + + return ptr;