[coreutils] Fix the i18n cut optimization restriction (we need UTF8 to grant uniqueness of characters and using

Ondrej Vasik ovasik at fedoraproject.org
Mon Jan 13 13:08:40 UTC 2014


commit 72a0b599c460e2647fad2e6f14b6f18f7616e7b7
Author: Ondřej Vašík <ovasik at redhat.com>
Date:   Mon Jan 13 12:49:45 2014 +0100

    Fix the i18n cut optimization restriction (we need UTF8 to grant uniqueness of characters and using strchr() approach), unset the unnecessary envvars after colorls scripts(#1051703)

 coreutils-colorls.csh |    2 ++
 coreutils-colorls.sh  |    2 ++
 coreutils-i18n.patch  |    8 ++++++--
 coreutils.spec        |    6 +++++-
 4 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/coreutils-colorls.csh b/coreutils-colorls.csh
index 38abdc7..5ed0f68 100755
--- a/coreutils-colorls.csh
+++ b/coreutils-colorls.csh
@@ -51,6 +51,8 @@ if ( "$color_none" != '' ) then
 endif
 unset color_none
 unset _tmp
+unset INCLUDE
+unset COLORS
 
 finish:
 alias ll 'ls -l --color=auto'
diff --git a/coreutils-colorls.sh b/coreutils-colorls.sh
index f1b227b..1308da9 100755
--- a/coreutils-colorls.sh
+++ b/coreutils-colorls.sh
@@ -45,6 +45,8 @@ if [ -z "$USER_LS_COLORS" ]; then
   grep -qi "^COLOR.*none" $COLORS >/dev/null 2>/dev/null && return
 fi
 
+unset TMP COLORS INCLUDE
+
 alias ll='ls -l --color=auto' 2>/dev/null
 alias l.='ls -d .* --color=auto' 2>/dev/null
 alias ls='ls --color=auto' 2>/dev/null
diff --git a/coreutils-i18n.patch b/coreutils-i18n.patch
index a0c2717..467750d 100644
--- a/coreutils-i18n.patch
+++ b/coreutils-i18n.patch
@@ -258,7 +258,7 @@ diff -urNp coreutils-8.22-orig/src/cut.c coreutils-8.22/src/cut.c
  /* Read from stream STREAM, printing to standard output any selected fields.  */
  
  static void
-@@ -629,13 +786,207 @@ cut_fields (FILE *stream)
+@@ -629,13 +786,211 @@ cut_fields (FILE *stream)
      }
  }
  
@@ -443,8 +443,12 @@ diff -urNp coreutils-8.22-orig/src/cut.c coreutils-8.22/src/cut.c
 +        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")))
++              if (loc && (strstr (loc, "UTF-8") || strstr (loc, "utf-8") ||
++                  strstr (loc, "UTF8") || strstr (loc, "utf8")))
 +                {
 +                  cut_fields (stream);
 +                  break;
diff --git a/coreutils.spec b/coreutils.spec
index cd65278..a227de7 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,7 +1,7 @@
 Summary: A set of basic GNU tools commonly used in shell scripts
 Name:    coreutils
 Version: 8.22
-Release: 9%{?dist}
+Release: 10%{?dist}
 License: GPLv3+
 Group:   System Environment/Base
 Url:     http://www.gnu.org/software/coreutils/
@@ -372,6 +372,10 @@ fi
 %{_sbindir}/chroot
 
 %changelog
+* Mon Jan 13 2014 Ondrej Vasik <ovasik at redhat.com> 8.22-10
+- unset the unnecessary envvars after colorls scripts(#1051703)
+- improve the limitation (check for both utf8 and utf-8)
+
 * Fri Jan 10 2014 Ondrej Oprala <ooprala at redhat.com> 8.22-9
 - Limit the cut optimizations to UTF-8 locales only
 


More information about the scm-commits mailing list