From 2f8deb0379df75243d9a93ae5e5f5ba8593711d8 Mon Sep 17 00:00:00 2001 From: Ondřej Vašík Date: Oct 15 2014 07:43:08 +0000 Subject: handle situation with ro /tmp in colorls scripts (#1149761) --- diff --git a/coreutils-colorls.csh b/coreutils-colorls.csh index 5ed0f68..a146dd1 100755 --- a/coreutils-colorls.csh +++ b/coreutils-colorls.csh @@ -34,7 +34,14 @@ set INCLUDE="`cat "$COLORS" | grep '^INCLUDE' | cut -d ' ' -f2-`" if ( ! -e "$COLORS" ) exit -set _tmp="`mktemp .colorlsXXX --tmpdir=/tmp`" +set _tmp="`mktemp .colorlsXXX -q --tmpdir=/tmp`" +#if mktemp fails, exit when include was active, otherwise use $COLORS file +if ( "$_tmp" == '' ) then + if ( "$INCLUDE" == '' ) then + eval "`dircolors -c $COLORS`" + endif + goto cleanup +endif if ( "$INCLUDE" != '' ) cat "$INCLUDE" >> $_tmp grep -v '^INCLUDE' "$COLORS" >> $_tmp @@ -44,6 +51,7 @@ eval "`dircolors -c $_tmp`" rm -f $_tmp if ( "$LS_COLORS" == '' ) exit +cleanup: set color_none=`sed -n '/^COLOR.*none/Ip' < $COLORS` if ( "$color_none" != '' ) then unset color_none diff --git a/coreutils-colorls.sh b/coreutils-colorls.sh index 1308da9..f9484b3 100755 --- a/coreutils-colorls.sh +++ b/coreutils-colorls.sh @@ -32,14 +32,19 @@ 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 - grep -v '^INCLUDE' "$COLORS" >> $TMP - - eval "`dircolors --sh $TMP 2>/dev/null`" - - rm -f $TMP + if [ -e "$INCLUDE" ]; + then + TMP="`mktemp .colorlsXXX -q --tmpdir=/tmp`" + [ -z "$TMP" ] && return + + cat "$INCLUDE" >> $TMP + grep -v '^INCLUDE' "$COLORS" >> $TMP + + eval "`dircolors --sh $TMP 2>/dev/null`" + rm -f $TMP + else + eval "`dircolors --sh $COLORS 2>/dev/null`" + fi [ -z "$LS_COLORS" ] && return grep -qi "^COLOR.*none" $COLORS >/dev/null 2>/dev/null && return diff --git a/coreutils.spec b/coreutils.spec index 8b5ad5b..12b5f4e 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.23 -Release: 4%{?dist} +Release: 5%{?dist} License: GPLv3+ Group: System Environment/Base Url: http://www.gnu.org/software/coreutils/ @@ -372,6 +372,9 @@ fi %{_sbindir}/chroot %changelog +* Wed Oct 15 2014 Ondrej Vasik - 8.23-5 +- handle situation with ro /tmp in colorls scripts (#1149761) + * Wed Oct 01 2014 Ondrej Vasik - 8.23-4 - fix the sorting in multibyte locales (NUL-terminate sort keys) - patch by Andreas Schwab (#1146185)