[coreutils/f19] Various fixes backported from rawhide

Ondrej Vasik ovasik at fedoraproject.org
Mon Jan 20 10:04:44 UTC 2014


commit b975e77327c57cc894f899e96ea12ff6265c1c15
Author: Ondřej Vašík <ovasik at redhat.com>
Date:   Mon Jan 20 10:55:34 2014 +0100

    Various fixes backported from rawhide
    
    - fix possible colorls.csh script errors for tcsh with
      noclobber set and entered include file (#1027279)
    - cp: correct error message for invalid arguments
      of '--no-preserve' (#1018206)
    - pr -e, with a mix of backspaces and TABs, could corrupt the heap
      in multibyte locales (analyzed by J.Koncicky)
    - optimization of colorls scripts by Ville Skytta (#961012)
    - cut - Fix the variables in multibyte path to work on 64 bit

 coreutils-colorls.csh                     |    7 ++++++-
 coreutils-colorls.sh                      |   11 ++++++-----
 coreutils-cp-nopreserve-invalidargs.patch |   29 +++++++++++++++++++++++++++++
 coreutils-i18n.patch                      |   18 ++++++++++++++----
 coreutils.spec                            |   14 +++++++++++++-
 5 files changed, 68 insertions(+), 11 deletions(-)
---
diff --git a/coreutils-colorls.csh b/coreutils-colorls.csh
index d02fe85..5ed0f68 100755
--- a/coreutils-colorls.csh
+++ b/coreutils-colorls.csh
@@ -1,3 +1,6 @@
+# skip everything for non-interactive shells
+if (! $?prompt) exit
+
 # color-ls initialization
 if ( $?USER_LS_COLORS ) then
   if ( "$USER_LS_COLORS" != "" ) then
@@ -33,7 +36,7 @@ if ( ! -e "$COLORS" ) exit
 
 set _tmp="`mktemp .colorlsXXX --tmpdir=/tmp`"
 
-if ( "$INCLUDE" != '' ) cat "$INCLUDE" > $_tmp
+if ( "$INCLUDE" != '' ) cat "$INCLUDE" >> $_tmp
 grep -v '^INCLUDE' "$COLORS" >> $_tmp
 
 eval "`dircolors -c $_tmp`"
@@ -48,6 +51,8 @@ if ( "$color_none" != '' ) then
 endif
 unset color_none
 unset _tmp
+unset INCLUDE
+unset COLORS
 
 finish:
 alias ll 'ls -l --color=auto'
diff --git a/coreutils-colorls.sh b/coreutils-colorls.sh
index 7d27940..1308da9 100755
--- a/coreutils-colorls.sh
+++ b/coreutils-colorls.sh
@@ -1,15 +1,14 @@
 # color-ls initialization
 
+# Skip all for noninteractive shells.
+[ -z "$PS1" ] && return
+
 #when USER_LS_COLORS defined do not override user LS_COLORS, but use them.
 if [ -z "$USER_LS_COLORS" ]; then
 
   alias ll='ls -l' 2>/dev/null
   alias l.='ls -d .*' 2>/dev/null
 
-
-  # Skip the rest for noninteractive shells.
-  [ -z "$PS1" ] && return
-
   INCLUDE=
   COLORS=
 
@@ -35,7 +34,7 @@ if [ -z "$USER_LS_COLORS" ]; then
 
   TMP="`mktemp .colorlsXXX --tmpdir=/tmp`"
 
-  [ -e "$INCLUDE" ] && cat "$INCLUDE" > $TMP
+  [ -e "$INCLUDE" ] && cat "$INCLUDE" >> $TMP
   grep -v '^INCLUDE' "$COLORS" >> $TMP
 
   eval "`dircolors --sh $TMP 2>/dev/null`"
@@ -46,6 +45,8 @@ if [ -z "$USER_LS_COLORS" ]; then
   grep -qi "^COLOR.*none" $COLORS >/dev/null 2>/dev/null && return
 fi
 
+unset TMP COLORS INCLUDE
+
 alias ll='ls -l --color=auto' 2>/dev/null
 alias l.='ls -d .* --color=auto' 2>/dev/null
 alias ls='ls --color=auto' 2>/dev/null
diff --git a/coreutils-cp-nopreserve-invalidargs.patch b/coreutils-cp-nopreserve-invalidargs.patch
new file mode 100644
index 0000000..5933b91
--- /dev/null
+++ b/coreutils-cp-nopreserve-invalidargs.patch
@@ -0,0 +1,29 @@
+From 124ab798e65b6c95a8486f6f6af9bdf69b11e1bf Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= <ovasik at redhat.com>
+Date: Fri, 11 Oct 2013 14:44:53 +0200
+Subject: [PATCH] cp: correct error message for invalid arguments of '--no-preserve'
+
+* src/cp.c (decode_preserve_arg) :
+Correct error message for invalid arguments of '--no-preserve'.
+Reported by M.Vadkerti in rhbz #1018206
+---
+ src/cp.c |    3 ++-
+ 1 files changed, 2 insertions(+), 1 deletions(-)
+
+diff --git a/src/cp.c b/src/cp.c
+index e235b32..7bc8630 100644
+--- a/src/cp.c
++++ b/src/cp.c
+@@ -854,7 +854,8 @@ decode_preserve_arg (char const *arg, struct cp_options *x, bool on_off)
+         *comma++ = 0;
+ 
+       /* process S.  */
+-      val = XARGMATCH ("--preserve", s, preserve_args, preserve_vals);
++      val = XARGMATCH (on_off ? "--preserve" : "--no-preserve",
++                       s, preserve_args, preserve_vals);
+       switch (val)
+         {
+         case PRESERVE_MODE:
+-- 
+1.7.1
+
diff --git a/coreutils-i18n.patch b/coreutils-i18n.patch
index 0e25f49..5ff6250 100644
--- a/coreutils-i18n.patch
+++ b/coreutils-i18n.patch
@@ -205,7 +205,7 @@ diff -urNp coreutils-8.21-orig/src/cut.c coreutils-8.21/src/cut.c
 +static void
 +cut_characters_or_cut_bytes_no_split (FILE *stream)
 +{
-+  int idx;                /* number of bytes or characters in the line so far. */
++  size_t idx;                /* number of bytes or characters in the line so far. */
 +  char buf[MB_LEN_MAX + BUFSIZ];  /* For spooling a read byte sequence. */
 +  char *bufpos;                /* Next read position of BUF. */
 +  size_t buflen;        /* The length of the byte sequence in buf. */
@@ -276,7 +276,7 @@ diff -urNp coreutils-8.21-orig/src/cut.c coreutils-8.21/src/cut.c
 +cut_fields_mb (FILE *stream)
 +{
 +  int c;
-+  unsigned int field_idx;
++  size_t field_idx;
 +  int found_any_selected_field;
 +  int buffer_first_field;
 +  int empty_input;
@@ -2263,7 +2263,7 @@ diff -urNp coreutils-8.21-orig/src/pr.c coreutils-8.21/src/pr.c
      {
        width = TAB_WIDTH (chars_per_c, input_position);
  
-@@ -2724,6 +2930,154 @@ char_to_clump (char c)
+@@ -2724,6 +2930,164 @@ char_to_clump (char c)
    return chars;
  }
  
@@ -2410,7 +2410,17 @@ diff -urNp coreutils-8.21-orig/src/pr.c coreutils-8.21/src/pr.c
 +      mbc_pos -= mblength;
 +    }
 +
-+  input_position += width;
++  /* Too many backspaces must put us in position 0 -- never negative. */
++  if (width < 0 && input_position == 0)
++    {
++      chars = 0;
++      input_position = 0;
++    }
++  else if (width < 0 && input_position <= -width)
++    input_position = 0;
++  else
++   input_position += width;
++
 +  return chars;
 +}
 +#endif
diff --git a/coreutils.spec b/coreutils.spec
index 2d3ca6d..b53d7a3 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.21
-Release: 12%{?dist}
+Release: 13%{?dist}
 License: GPLv3+
 Group:   System Environment/Base
 Url:     http://www.gnu.org/software/coreutils/
@@ -15,6 +15,7 @@ Source106:  coreutils-colorls.csh
 # From upstream
 Patch1: coreutils-8.21-install-strip.patch
 Patch2: coreutils-aarch64-longlong.patch
+Patch3: coreutils-cp-nopreserve-invalidargs.patch
 
 # Our patches
 #general patch to workaround koji build system issues
@@ -129,6 +130,7 @@ the old GNU fileutils, sh-utils, and textutils packages.
 # From upstream
 %patch1 -p1 -b .strip
 %patch2 -p1 -b .aarch64
+%patch3 -p1 -b .nopres
 
 # Our patches
 %patch100 -p1 -b .configure
@@ -375,6 +377,16 @@ fi
 %{_sbindir}/chroot
 
 %changelog
+* Mon Jan 20 2014 Ondrej Vasik <ovasik at redhat.com> 8.21-12
+- fix possible colorls.csh script errors for tcsh with
+  noclobber set and entered include file (#1027279)
+- cp: correct error message for invalid arguments
+  of '--no-preserve' (#1018206)
+- pr -e, with a mix of backspaces and TABs, could corrupt the heap
+  in multibyte locales (analyzed by J.Koncicky)
+- optimization of colorls scripts by Ville Skytta (#961012)
+- cut - Fix the variables in multibyte path to work on 64 bit
+
 * Wed Aug 14 2013 Ondrej Oprala <ooprala at redhat.com 8.21-12
 - fix cases when colorls scripts' TMP wasn't deleted (#988152)
 


More information about the scm-commits mailing list