From d479a885de6bb4f926d5e1b99419a8449cd687a3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 6 Oct 2020 08:46:35 -0400 Subject: [PATCH] move cache cleanup back to before cache creation It was moved to avoid a race, but that's now avoided in another way. I prefer having it here, because this way if it somehow fails and deletes the locpath that is going to be used, at least it will get re-created. --- standalone/linux/skel/runshell | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/standalone/linux/skel/runshell b/standalone/linux/skel/runshell index 5956745496..afc78b36df 100755 --- a/standalone/linux/skel/runshell +++ b/standalone/linux/skel/runshell @@ -142,6 +142,14 @@ if [ -z "${LOCPATH+set}" ] && [ -z "$GIT_ANNEX_PACKAGE_INSTALL" ]; then LOCPATH="$HOME/.cache/git-annex/locales/$locpathbase" export LOCPATH + # Clean up locale caches when their standalone bundle no longer exists. + for localecache in $HOME/.cache/git-annex/locales/*; do + cachebase=$(cat "$localecache/base" 2>/dev/null || true) + if [ ! -d "$cachebase" ] || ! cmp "$localecache/buildid" "$cachebase/buildid" >/dev/null 2>&1 ; then + rm -rf "$localecache" >/dev/null 2>&1 || true + fi + done + if [ ! -d "$LOCPATH" ]; then locpathtmp="$HOME/.cache/git-annex/locales.tmp/$locpathbase.$$" if ! mkdir -p "$locpathtmp"; then @@ -183,14 +191,6 @@ if [ -z "${LOCPATH+set}" ] && [ -z "$GIT_ANNEX_PACKAGE_INSTALL" ]; then # in which cache the mv above would put it here. rm -rf "$LOCPATH/$locpathbase.$$" fi - - # Clean up locale caches when their standalone bundle no longer exists. - for localecache in $HOME/.cache/git-annex/locales/*; do - cachebase=$(cat "$localecache/base" 2>/dev/null || true) - if [ ! -d "$cachebase" ] || ! cmp "$localecache/buildid" "$cachebase/buildid" >/dev/null 2>&1 ; then - rm -rf "$localecache" >/dev/null 2>&1 || true - fi - done fi useproot=""