diff options
-rw-r--r-- | debian/changelog | 3 | ||||
-rw-r--r-- | doc/bugs/linux_standalone_git_annex_won__39__t_work_in_a_directory_whose_path_contains_:_or___59__.mdwn | 7 | ||||
-rwxr-xr-x | standalone/linux/skel/runshell | 25 |
3 files changed, 33 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog index 1f951dec5..f6ea3c467 100644 --- a/debian/changelog +++ b/debian/changelog @@ -19,6 +19,9 @@ git-annex (5.20150732) UNRELEASED; urgency=medium * proxy: Fix behavior when run in subdirectory of git repo. * Windows: Fix bug that caused git-annex sync to fail due to missing environment variable. + * Linux standalone: Work around problem that prevented it from working + properly if unpacked into a directory that contains ":" or ";" in its + name. -- Joey Hess <id@joeyh.name> Fri, 31 Jul 2015 12:31:39 -0400 diff --git a/doc/bugs/linux_standalone_git_annex_won__39__t_work_in_a_directory_whose_path_contains_:_or___59__.mdwn b/doc/bugs/linux_standalone_git_annex_won__39__t_work_in_a_directory_whose_path_contains_:_or___59__.mdwn index 52fcf6eb7..934416df6 100644 --- a/doc/bugs/linux_standalone_git_annex_won__39__t_work_in_a_directory_whose_path_contains_:_or___59__.mdwn +++ b/doc/bugs/linux_standalone_git_annex_won__39__t_work_in_a_directory_whose_path_contains_:_or___59__.mdwn @@ -39,3 +39,10 @@ git-annex: get: 1 failed # End of transcript or log. """]] + +> Actually, this bug is fixable. And I have! I made it detect the problem +> path, and then fall back to making a directory in /tmp, symlinking the +> git-annex.linux directory into it, and using that as its base directory. +> +> Of course, that's a suboptimal configuration, but better than having some +> configurations where it doesn't work. --[[Joey]] diff --git a/standalone/linux/skel/runshell b/standalone/linux/skel/runshell index b1f36f064..b540c983b 100755 --- a/standalone/linux/skel/runshell +++ b/standalone/linux/skel/runshell @@ -26,6 +26,22 @@ cd "$base" base="$(pwd)" cd "$orig" +# --library-path won't work if $base contains : or ; +# Detect this problem, and work around it by using a temp directory. +if echo "$base" | grep -q '[:;]'; then + tbase=$(mktemp -d -p /tmp annexshimXXXXXXXXX 2>/dev/null || true) + if [ -z "$tbase" ]; then + tbase="/tmp/annexshim.$$" + mkdir "$tbase" + fi + ln -s "$base" "$tbase/link" + base="$tbase/link" + cleanuptbase () { + rm -rf "$tbase" + } + trap cleanuptbase EXIT +fi + # Install shim that's used to run git-annex-shell from ssh authorized_keys. # The assistant also does this when run, but the user may not be using the # assistant. @@ -63,7 +79,7 @@ export ORIG_PATH PATH="$base/bin:$PATH" export PATH -# This is used by the shim wrapper around each binary. +# These env vars are used by the shim wrapper around each binary. for lib in $(cat "$base/libdirs"); do GIT_ANNEX_LD_LIBRARY_PATH="$base/$lib:$GIT_ANNEX_LD_LIBRARY_PATH" done @@ -103,7 +119,12 @@ export GIT_ANNEX_STANDLONE_ENV if [ "$1" ]; then cmd="$1" shift 1 - exec "$cmd" "$@" + if [ -z "$tbase" ]; then + exec "$cmd" "$@" + else + # allow EXIT trap to cleanup + "$cmd" "$@" + fi else sh fi |