From f991c8c526b0380367152c9ea81907b9a4033bc9 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 10 Jul 2018 13:26:35 -0400 Subject: [PATCH] fall back to /tmp for LOCPATH if HOME does not exist or not writable In this case, we can't clean up old locale caches, but presumably the system has something to clean up /tmp eventually. --- standalone/linux/skel/runshell | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/standalone/linux/skel/runshell b/standalone/linux/skel/runshell index f2c4f8887b..76b92cb9c7 100755 --- a/standalone/linux/skel/runshell +++ b/standalone/linux/skel/runshell @@ -126,6 +126,13 @@ unset LD_PRELOAD ORIG_LOCPATH="$LOCPATH" export ORIG_LOCPATH LOCPATH="$HOME/.cache/git-annex/locales/$(echo "$base" | tr / _ )" +if ! mkdir -p "$LOCPATH" 2>/dev/null; then + tlocpath=$(mktemp -d -p /tmp annexlocalesXXXXXXXXX 2>/dev/null || true) + if [ -z "$tlocpath" ]; then + tlocpath="/tmp/annexlocales.$$" + fi + LOCPATH="$tlocpath/locales/$(echo "$base" | tr / _ )" +fi export LOCPATH # Clean up locale caches when their standalone bundle no longer exists.