From 9ad7b671cedbafa4cf886af323f9a79353bf218e Mon Sep 17 00:00:00 2001 From: Ondrej Oprala Date: Wed, 14 Aug 2013 15:10:21 +0200 Subject: [PATCH 1/3] Fix cases where colorls scripts' TMP wasn't deleted (#988152) --- coreutils-colorls.csh | 13 ++++++++----- coreutils-colorls.sh | 9 ++++++--- coreutils.spec | 3 +++ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/coreutils-colorls.csh b/coreutils-colorls.csh index 5a54e45..d02fe85 100755 --- a/coreutils-colorls.csh +++ b/coreutils-colorls.csh @@ -10,7 +10,6 @@ endif alias ll 'ls -l' alias l. 'ls -d .*' set COLORS=/etc/DIR_COLORS -set TMP="`mktemp .colorlsXXX --tmpdir=/tmp`" if ($?TERM) then if ( -e "/etc/DIR_COLORS.256color" ) then @@ -32,10 +31,14 @@ set INCLUDE="`cat "$COLORS" | grep '^INCLUDE' | cut -d ' ' -f2-`" if ( ! -e "$COLORS" ) exit -if ( "$INCLUDE" != '' ) cat "$INCLUDE" > $TMP -cat "$COLORS" | grep -v '^INCLUDE' >> $TMP +set _tmp="`mktemp .colorlsXXX --tmpdir=/tmp`" -eval "`dircolors -c $TMP`" +if ( "$INCLUDE" != '' ) cat "$INCLUDE" > $_tmp +grep -v '^INCLUDE' "$COLORS" >> $_tmp + +eval "`dircolors -c $_tmp`" + +rm -f $_tmp if ( "$LS_COLORS" == '' ) exit set color_none=`sed -n '/^COLOR.*none/Ip' < $COLORS` @@ -44,7 +47,7 @@ if ( "$color_none" != '' ) then exit endif unset color_none -rm -f $TMP +unset _tmp finish: alias ll 'ls -l --color=auto' diff --git a/coreutils-colorls.sh b/coreutils-colorls.sh index 5347b2a..7d27940 100755 --- a/coreutils-colorls.sh +++ b/coreutils-colorls.sh @@ -12,7 +12,6 @@ if [ -z "$USER_LS_COLORS" ]; then INCLUDE= COLORS= - TMP="`mktemp .colorlsXXX --tmpdir=/tmp`" for colors in "$HOME/.dir_colors.$TERM" "$HOME/.dircolors.$TERM" \ "$HOME/.dir_colors" "$HOME/.dircolors"; do @@ -34,13 +33,17 @@ if [ -z "$USER_LS_COLORS" ]; then # Existence of $COLORS already checked above. [ -n "$COLORS" ] || return + TMP="`mktemp .colorlsXXX --tmpdir=/tmp`" + [ -e "$INCLUDE" ] && cat "$INCLUDE" > $TMP - cat "$COLORS" | grep -v '^INCLUDE' >> $TMP + grep -v '^INCLUDE' "$COLORS" >> $TMP eval "`dircolors --sh $TMP 2>/dev/null`" + + rm -f $TMP + [ -z "$LS_COLORS" ] && return grep -qi "^COLOR.*none" $COLORS >/dev/null 2>/dev/null && return - rm -f $TMP fi alias ll='ls -l --color=auto' 2>/dev/null diff --git a/coreutils.spec b/coreutils.spec index 48b39f5..61f66b9 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -375,6 +375,9 @@ fi %{_sbindir}/chroot %changelog +* Wed Aug 14 2013 Ondrej Oprala Date: Wed, 14 Aug 2013 15:27:17 +0200 Subject: [PATCH 2/3] Bump release --- coreutils.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreutils.spec b/coreutils.spec index 61f66b9..2d3ca6d 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: 11%{?dist} +Release: 12%{?dist} License: GPLv3+ Group: System Environment/Base Url: http://www.gnu.org/software/coreutils/ From b975e77327c57cc894f899e96ea12ff6265c1c15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= Date: Mon, 20 Jan 2014 10:55:34 +0100 Subject: [PATCH 3/3] 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(-) create mode 100644 coreutils-cp-nopreserve-invalidargs.patch 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?= +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 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