From 88f721549d0703fe9d3cabb9e95cecc04dff51a9 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 4 Mar 2020 13:04:56 -0400 Subject: [PATCH] Linux standalone: Use md5sum to shorten paths in .cache/git-annex/locales md5sum is part of busybox, so is probably available unless it were compiled out. If md5sum (or cut for that matter) is not available, it will still use the whole path to $base, otherwise hash it. Of course it's possible for md5sum to be available sometimes and not others on the same system; in such an event the locales would be built twice for the same bundle. The cleanup code will delete both sets once that version of the bundle is upgraded. --- CHANGELOG | 1 + ...ne_runshell_locale_cache_fails_on_too-long_filenames.mdwn | 2 ++ standalone/linux/skel/runshell | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 5c9ecb1afc..b7b81c227a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -12,6 +12,7 @@ git-annex (8.20200227) UNRELEASED; urgency=medium * stack.yaml: Updated to lts-14.27. * git-annex config: Only allow configs be set that are ones git-annex actually supports reading from repo-global config, to avoid confusion. + * Linux standalone: Use md5sum to shorten paths in .cache/git-annex/locales -- Joey Hess Thu, 27 Feb 2020 00:44:11 -0400 diff --git a/doc/bugs/git-annex_standalone_runshell_locale_cache_fails_on_too-long_filenames.mdwn b/doc/bugs/git-annex_standalone_runshell_locale_cache_fails_on_too-long_filenames.mdwn index 0cba63f87d..c77ca745d1 100644 --- a/doc/bugs/git-annex_standalone_runshell_locale_cache_fails_on_too-long_filenames.mdwn +++ b/doc/bugs/git-annex_standalone_runshell_locale_cache_fails_on_too-long_filenames.mdwn @@ -3,3 +3,5 @@ In the standalone build of git-annex, the runshell script caches locale info in When the full path is too long, this fails with the error "filename too long". Also, if the locale info is specific to the standalone environment, maybe it could be built as part of the process that creates the standalone package, rather than built on-the-fly and cached in the user's home dir? + +> [[fixed|done]] --[[Joey]] diff --git a/standalone/linux/skel/runshell b/standalone/linux/skel/runshell index 7ef160135c..d442627594 100755 --- a/standalone/linux/skel/runshell +++ b/standalone/linux/skel/runshell @@ -129,6 +129,11 @@ ORIG_LOCPATH="$LOCPATH" export ORIG_LOCPATH if [ -z "${LOCPATH+set}" ] && [ -z "$GIT_ANNEX_PACKAGE_INSTALL" ]; then LOCPATH="$HOME/.cache/git-annex/locales/$(echo "$base" | tr / _ )" + # try to generate a short version, if md5sum is available + locpathmd5=$( (echo "$LOCPATH" | md5sum | cut -d ' ' -f 1 2>/dev/null) || true) + if [ -n "$locpathmd5" ]; then + LOCPATH="$HOME/.cache/git-annex/locales/$locpathmd5" + fi export LOCPATH # Clean up locale caches when their standalone bundle no longer exists. -- 2.39.5