Fix cases where colorls scripts' TMP wasn't deleted (#988152)

This commit is contained in:
Ondrej Oprala 2013-08-14 15:10:21 +02:00
commit 9ad7b671ce
3 changed files with 17 additions and 8 deletions

View file

@ -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'

View file

@ -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

View file

@ -375,6 +375,9 @@ fi
%{_sbindir}/chroot
%changelog
* Wed Aug 14 2013 Ondrej Oprala <ooprala@redhat.com 8.21-12
- fix cases when colorls scripts' TMP wasn't deleted (#988152)
* Fri Apr 05 2013 Ondrej Oprala <ooprala@redhat.com 8.21-11
- Fix tmp file location in colorls scripts (#948008)