From 5863d14fd2aa941d53b4480b9191f8f8e438d96a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 5 Oct 2020 13:42:43 -0400 Subject: [PATCH] runshell: fix some mess left in a race This seems to be the best way to deal with the race; if the first and second runshell are running very close together, the first will generate the locale directory, and a second test -d would still leave a race window. --- standalone/linux/skel/runshell | 3 +++ 1 file changed, 3 insertions(+) diff --git a/standalone/linux/skel/runshell b/standalone/linux/skel/runshell index c730153deb..90f262ca65 100755 --- a/standalone/linux/skel/runshell +++ b/standalone/linux/skel/runshell @@ -189,6 +189,9 @@ if [ -z "${LOCPATH+set}" ] && [ -z "$GIT_ANNEX_PACKAGE_INSTALL" ]; then # use LANG=C to avoid it reading the system locale archive. I18NPATH="$base/i18n" LANG=C localedef -i "${localeenv%%.*}" -c -f UTF-8 "$LOCPATH/$localeenv.new.$$" && mv "$LOCPATH/$localeenv.new.$$" "$LOCPATH/$localeenv" + # In a race, LOCPATH may get created by another process, + # in which cache the mv above would put it here. + rm -rf "$LOCPATH/$localeenv/$localeenv.new.$$" ) >/dev/null 2>/dev/null || true fi fi -- 2.30.2