summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build/BundledPrograms.hs2
-rw-r--r--CHANGELOG9
-rw-r--r--Makefile2
-rwxr-xr-xstandalone/linux/skel/runshell38
4 files changed, 40 insertions, 11 deletions
diff --git a/Build/BundledPrograms.hs b/Build/BundledPrograms.hs
index 69d72b461..a9a29b603 100644
--- a/Build/BundledPrograms.hs
+++ b/Build/BundledPrograms.hs
@@ -91,6 +91,8 @@ preferredBundledPrograms = catMaybes
-- used to unpack the tarball when upgrading
, Just "gunzip"
, Just "tar"
+ -- used by runshell to generate locales
+ , Just "localedef"
#endif
-- nice, ionice, and nocache are not included in the bundle;
-- we rely on the system's own version, which may better match
diff --git a/CHANGELOG b/CHANGELOG
index edc018b06..15a5de2f5 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -14,12 +14,9 @@ git-annex (6.20160924) UNRELEASED; urgency=medium
external special remotes, because running multiple git-annex commands
at the same time could already start multiple processes for the same
external special remotes.
- * Linux standalone: Add back the LOCPATH=/dev/null hack to avoid
- the system locale-archive being read. Version mismatches between the
- system locale-archive and the glibc in the bundle have been observed
- to cause git crashes. Unfortunately, this causes locales to not be
- used in the linux standalone bundle, reverting back to pre-6.20160419
- behavior.
+ * Linux standalone: Include locale files in the bundle, and generate
+ locale definition files for the locales in use when starting runshell.
+ (Currently only done for utf-8 locales.)
-- Joey Hess <id@joeyh.name> Mon, 26 Sep 2016 16:46:19 -0400
diff --git a/Makefile b/Makefile
index 92c2989b9..da5affbfe 100644
--- a/Makefile
+++ b/Makefile
@@ -143,6 +143,8 @@ linuxstandalone-nobuild: Build/Standalone Build/LinuxMkLibs
install -d "$(LINUXSTANDALONE_DEST)/templates"
install -d "$(LINUXSTANDALONE_DEST)/magic"
cp /usr/share/file/magic.mgc "$(LINUXSTANDALONE_DEST)/magic"
+ install -d "$(LINUXSTANDALONE_DEST)/i18n"
+ cp /usr/share/i18n -a "$(LINUXSTANDALONE_DEST)/i18n"
./Build/LinuxMkLibs "$(LINUXSTANDALONE_DEST)"
diff --git a/standalone/linux/skel/runshell b/standalone/linux/skel/runshell
index 6f6ba8a3e..d6bec7aa3 100755
--- a/standalone/linux/skel/runshell
+++ b/standalone/linux/skel/runshell
@@ -100,11 +100,6 @@ export ORIG_GCONV_PATH
GCONV_PATH="$base/$(cat "$base/gconvdir")"
export GCONV_PATH
-ORIG_LOCPATH="$LOCPATH"
-export ORIG_LOCPATH
-LOCPATH=/dev/null
-export LOCPATH
-
ORIG_GIT_EXEC_PATH="$GIT_EXEC_PATH"
export ORIG_GIT_EXEC_PATH
GIT_EXEC_PATH="$base/git-core"
@@ -120,6 +115,39 @@ export ORIG_MANPATH
MANPATH="$base/usr/share/man:$MANPATH"
export MANPATH
+# Avoid using system locales, which may interact badly with bundled libc.
+ORIG_LOCPATH="$LOCPATH"
+export ORIG_LOCPATH
+LOCPATH="$base/locales"
+export LOCPATH
+
+# Generate locale definition files for the locales in use,
+# using the localedef and locale files from the bundle.
+# Currently only utf-8 locales are handled.
+lastlocaleenv=""
+for localeenv in "$LANG" "$LANGUAGE" "$LC_CTYPE" "$LC_NUMERIC" "$LC_TIME" \
+ "$LC_COLLATE" "$LC_MONETARY" "$LC_MESSAGES" "$LC_PAPER" \
+ "$LC_NAME" "$LC_ADDRESS" "$LC_TELEPHONE" "$LC_MEASUREMENT" \
+ "$LC_IDENTIFICATION" "$LC_ALL"; do
+ if [ "$localeenv" != "$lastlocaleenv" ]; then
+ lastlocaleenv="$localeenv"
+ if [ ! -d "$base/locales/$localeenv" ]; then
+ if [ "${localeenv##[!.]*.}" = "utf8" ]; then
+ (
+ rm -rf "$base/locales/$localeenv.new.$$" &&
+ mkdir -p "$base/locales/$localeenv.new.$$" &&
+ # cd to $base since localedef reads files from pwd
+ cd "$base" &&
+ # Run localedef using the bundled i18n files;
+ # use LANG=C to avoid it reading the system locale archive.
+ I18NPATH="$base/i18n" LANG=C localedef -i "${localeenv%%.*}" -c -f UTF-8 "$base/locales/$localeenv.new.$$" &&
+ mv "$base/locales/$localeenv.new.$$" "$base/locales/$localeenv"
+ ) >/dev/null 2>/dev/null || true
+ fi
+ fi
+ fi
+done
+
# Indicate which variables were exported above and should be cleaned
# when running non-bundled programs.
GIT_ANNEX_STANDLONE_ENV="PATH GCONV_PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR MANPATH LOCPATH"