Fix bug introduced in the last release that broke git-annex sync when git-annex was installed from the standalone tarball.

This was introduced by commit 450ee53ab6

However, the same problem could affect other calls to programPath,
specifically some on the assistant. So, I fixed it at a deeper level.
This commit is contained in:
Joey Hess 2015-03-27 12:55:18 -04:00
parent 00a6f5500f
commit 5be536e523
5 changed files with 23 additions and 52 deletions

View file

@ -11,7 +11,9 @@ module Annex.Path where
import Common
import Config.Files
import System.Environment
import Utility.Env
import System.Environment (getExecutablePath)
{- A fully qualified path to the currently running git-annex program.
-
@ -19,15 +21,22 @@ import System.Environment
- well, it returns the complete path to the program. But, on other OSs,
- it might return just the basename. Fall back to reading the programFile,
- or searching for the command name in PATH.
-
- The standalone build runs git-annex via ld.so, and defeats
- getExecutablePath. It sets GIT_ANNEX_PROGRAMPATH to the correct path
- to the wrapper script to use.
-}
programPath :: IO FilePath
programPath = do
programPath = go =<< getEnv "GIT_ANNEX_PROGRAMPATH"
where
go (Just p) = return p
go Nothing = do
#if MIN_VERSION_base(4,6,0)
exe <- getExecutablePath
p <- if isAbsolute exe
then return exe
else readProgramFile
exe <- getExecutablePath
p <- if isAbsolute exe
then return exe
else readProgramFile
#else
p <- readProgramFile
p <- readProgramFile
#endif
maybe cannotFindProgram return =<< searchPath p
maybe cannotFindProgram return =<< searchPath p

2
debian/changelog vendored
View file

@ -18,6 +18,8 @@ git-annex (5.20150318) UNRELEASED; urgency=medium
command-line length limits and cause the commit to fail. This
only happened when using the assistant in an indirect mode repository.
* Work around curl bug when asked to download an empty url to a file.
* Fix bug introduced in the last release that broke git-annex sync
when git-annex was installed from the standalone tarball.
-- Joey Hess <id@joeyh.name> Thu, 19 Mar 2015 17:05:32 -0400

View file

@ -43,3 +43,4 @@ git-annex: sync: 2 failed
# End of transcript or log.
"""]]
> [[fixed|done]] --[[Joey]]

View file

@ -1,44 +0,0 @@
### Please describe the problem.
git annex sync fails with "error while loading shared libraries: hostname: cannot open shared object file: No such file or directory" with hostname being the hostname of the remote git annex repo.
### What steps will reproduce the problem?
Running "git annex sync" in a normal git annex repo.
### What version of git-annex are you using? On what operating system?
Arch Linux with git-annex from the git-annex-bin AUR package:
git-annex version: 5.20150317-g237d5b0
build flags: Assistant Webapp Webapp-secure Pairing Testsuite S3 WebDAV Inotify DBus DesktopNotify XMPP DNS Feeds Quvi TDFA
key/value backends: SHA256E SHA1E SHA512E SHA224E SHA384E SKEIN256E SKEIN512E MD5E SHA256 SHA1 SHA512 SHA224 SHA384 SKEIN256 SKEIN512 MD5 WORM URL
remote types: git gcrypt S3 bup directory rsync web bittorrent webdav tahoe glacier ddar hook external
### Please provide any additional information below.
people describing the same problem here: <https://aur.archlinux.org/packages/git-annex-bin/>
SSH and normal git operations work fine.
[[!format sh """
# If you can, paste a complete transcript of the problem occurring here.
# If the problem is with the git-annex assistant, paste in .git/annex/daemon.log
[dafo@simon-desktop dokumente_ga]$ git annex sync
commit ok
pull leno
dafo@leno: error while loading shared libraries: dafo@leno: cannot open shared object file: No such file or directory
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
failed
push leno
dafo@leno: error while loading shared libraries: dafo@leno: cannot open shared object file: No such file or directory
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Pushing to leno failed.
(non-fast-forward problems can be solved by setting receive.denyNonFastforwards to false in the remote's git config)
failed
git-annex: sync: 2 failed
# End of transcript or log.
"""]]

View file

@ -28,4 +28,7 @@ if [ -e "$base/bin/git-annex" ]; then
export GIT_ANNEX_APP_BASE
fi
GIT_ANNEX_PROGRAMPATH="$0"
export GIT_ANNEX_PROGRAMPATH
exec "$base/runshell" git-annex "$@"