Reset non-working cache dir related env settings on user switch (#651023).

Make sh profile script "nounset" clean.
This commit is contained in:
Ville Skyttä 2011-04-02 14:06:59 +03:00
parent 18f551150f
commit 0495edbe61
4 changed files with 44 additions and 20 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
ccache-2.4.tar.gz /ccache-2.4.tar.gz

View File

@ -1,16 +1,26 @@
# Use ccache by default. Users who don't want that can set the CCACHE_DISABLE # Use ccache by default. Users who don't want that can setenv the
# environment variable in their personal profile. # CCACHE_DISABLE environment variable in their personal profile.
if ( "$path" !~ *@LIBDIR@/ccache* ) then if ( "$path" !~ *@LIBDIR@/ccache* ) then
set path = ( @LIBDIR@/ccache $path ) set path = ( @LIBDIR@/ccache $path )
endif endif
# If @CACHEDIR@ is writable, use a shared cache there. Users who don't # If @CACHEDIR@ is writable, use a shared cache there, except for root.
# want that even if they have that write permission can set the CCACHE_DIR # Users who don't want that even if they have the write permission can setenv
# and unset the CCACHE_UMASK environment variables in their personal profile. # the CCACHE_DIR environment variable to another location and possibly unsetenv
# the CCACHE_UMASK environment variable in their personal profile.
if ( ! $?CCACHE_DIR && -w @CACHEDIR@ && -d @CACHEDIR@ ) then if ( $?CCACHE_DIR ) then
setenv CCACHE_DIR @CACHEDIR@ if ( ! -w "$CCACHE_DIR" ) then
setenv CCACHE_UMASK 002 # Reset broken settings maybe inherited when switching users (#651023).
unsetenv CCACHE_HARDLINK unsetenv CCACHE_DIR
unsetenv CCACHE_UMASK
endif
else if ( $uid != 0 ) then
if ( -w @CACHEDIR@ && -d @CACHEDIR@ ) then
# Set up the shared cache.
setenv CCACHE_DIR @CACHEDIR@
setenv CCACHE_UMASK 002
unsetenv CCACHE_HARDLINK
endif
endif endif

View File

@ -1,17 +1,27 @@
# Use ccache by default. Users who don't want that can set the CCACHE_DISABLE # Use ccache by default. Users who don't want that can set the CCACHE_DISABLE
# environment variable in their personal profile. # environment variable in their personal profile.
case ":$PATH:" in case ":${PATH:-}:" in
*:@LIBDIR@/ccache:*) ;; *:@LIBDIR@/ccache:*) ;;
*) PATH="@LIBDIR@/ccache:$PATH" ;; *) PATH="@LIBDIR@/ccache${PATH:+:$PATH}" ;;
esac esac
# If @CACHEDIR@ is writable, use a shared cache there. Users who don't # If @CACHEDIR@ is writable, use a shared cache there, except for root.
# want that even if they have that write permission can set the CCACHE_DIR # Users who don't want that even if they have the write permission can set
# and unset the CCACHE_UMASK environment variables in their personal profile. # the CCACHE_DIR environment variable to another location and possibly unset
# the CCACHE_UMASK environment variables in their personal profile.
if [ -z "$CCACHE_DIR" ] && [ -w @CACHEDIR@ ] && [ -d @CACHEDIR@ ] ; then if [ -n "${CCACHE_DIR:-}" ] ; then
export CCACHE_DIR=@CACHEDIR@ if [ ! -w "$CCACHE_DIR" ] ; then
export CCACHE_UMASK=002 # Reset broken settings maybe inherited when switching users (#651023).
unset CCACHE_HARDLINK unset CCACHE_DIR
unset CCACHE_UMASK
fi
elif [ "${EUID:-}" != 0 ] ; then
if [ -w @CACHEDIR@ ] && [ -d @CACHEDIR@ ] ; then
# Set up the shared cache.
export CCACHE_DIR=@CACHEDIR@
export CCACHE_UMASK=002
unset CCACHE_HARDLINK
fi
fi fi

View File

@ -6,7 +6,7 @@
Name: ccache Name: ccache
Version: 2.4 Version: 2.4
Release: 18%{?dist} Release: 19%{?dist}
Summary: C/C++ compiler cache Summary: C/C++ compiler cache
Group: Development/Tools Group: Development/Tools
@ -102,6 +102,10 @@ done
%changelog %changelog
* Sat Apr 2 2011 Ville Skyttä <ville.skytta@iki.fi> - 2.4-19
- Reset non-working cache dir related env settings on user switch (#651023).
- Make sh profile script "nounset" clean.
* Fri Jun 4 2010 Ville Skyttä <ville.skytta@iki.fi> - 2.4-18 * Fri Jun 4 2010 Ville Skyttä <ville.skytta@iki.fi> - 2.4-18
- Don't use "pathmunge" in the profile.d sh script to work around #548960. - Don't use "pathmunge" in the profile.d sh script to work around #548960.