diff --git a/coreutils-colorls.csh b/coreutils-colorls.csh index 11282ba..f2fe36f 100755 --- a/coreutils-colorls.csh +++ b/coreutils-colorls.csh @@ -31,7 +31,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 @@ -41,6 +48,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 5957d71..ebd02d4 100755 --- a/coreutils-colorls.sh +++ b/coreutils-colorls.sh @@ -33,14 +33,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 fe28499..9dbffd1 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -383,6 +383,7 @@ fi %changelog * Thu May 14 2015 Kamil Dudka 8.21-22 +- handle situation with ro /tmp in colorls scripts (#1149761) - fix the sorting in multibyte locales (NUL-terminate sort keys) - patch by Andreas Schwab (#1146185) - fix failed tests on ppc(backport from gnulib upstream)