summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG2
-rw-r--r--Remote/External.hs20
-rw-r--r--Utility/Path.hs2
-rw-r--r--doc/bugs/Failing_to_execute_bash_remotes_windows.mdwn2
-rw-r--r--doc/bugs/Failing_to_execute_bash_remotes_windows/comment_3_691fe409f869c46e3716924e958f431a._comment14
5 files changed, 28 insertions, 12 deletions
diff --git a/CHANGELOG b/CHANGELOG
index b5f202183..580faff6f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -11,6 +11,8 @@ git-annex (6.20170301.2) UNRELEASED; urgency=medium
jobs than remotes.
* fsck -q: When a file has bad content, include the name of the file
in the warning message.
+ * Windows: Improve handling of shebang in external special remote
+ program, searching for the program in the PATH.
-- Joey Hess <id@joeyh.name> Thu, 02 Mar 2017 12:51:40 -0400
diff --git a/Remote/External.hs b/Remote/External.hs
index b66e102a4..0ac381b8c 100644
--- a/Remote/External.hs
+++ b/Remote/External.hs
@@ -375,7 +375,8 @@ startExternal external = do
return st
where
start errrelayer g = liftIO $ do
- (cmd, ps) <- findShellCommand basecmd
+ cmdpath <- searchPath basecmd
+ (cmd, ps) <- maybe (pure (basecmd, [])) findShellCommand cmdpath
let basep = (proc cmd (toCommand ps))
{ std_in = CreatePipe
, std_out = CreatePipe
@@ -383,9 +384,8 @@ startExternal external = do
}
p <- propgit g basep
(Just hin, Just hout, Just herr, ph) <-
- createProcess p `catchIO` runerr
+ createProcess p `catchIO` runerr cmdpath
stderrelay <- async $ errrelayer herr
- checkearlytermination =<< getProcessExitCode ph
cv <- newTVarIO $ externalDefaultConfig external
pv <- newTVarIO Unprepared
pid <- atomically $ do
@@ -409,15 +409,11 @@ startExternal external = do
environ <- propGitEnv g
return $ p { env = Just environ }
- runerr _ = giveup ("Cannot run " ++ basecmd ++ " -- Make sure it's in your PATH and is executable.")
-
- checkearlytermination Nothing = noop
- checkearlytermination (Just exitcode) = ifM (inPath basecmd)
- ( giveup $ unwords [ "failed to run", basecmd, "(" ++ show exitcode ++ ")" ]
- , do
- path <- intercalate ":" <$> getSearchPath
- giveup $ basecmd ++ " is not installed in PATH (" ++ path ++ ")"
- )
+ runerr (Just cmd) _ =
+ giveup $ "Cannot run " ++ cmd ++ " -- Make sure it's executable and that its dependencies are installed."
+ runerr Nothing _ = do
+ path <- intercalate ":" <$> getSearchPath
+ giveup $ "Cannot run " ++ basecmd ++ " -- It is not installed in PATH (" ++ path ++ ")"
stopExternal :: External -> Annex ()
stopExternal external = liftIO $ do
diff --git a/Utility/Path.hs b/Utility/Path.hs
index 3ee5ff39d..cd9dc3859 100644
--- a/Utility/Path.hs
+++ b/Utility/Path.hs
@@ -227,6 +227,8 @@ inPath command = isJust <$> searchPath command
-
- The command may be fully qualified already, in which case it will
- be returned if it exists.
+ -
+ - Note that this will find commands in PATH that are not executable.
-}
searchPath :: String -> IO (Maybe FilePath)
searchPath command
diff --git a/doc/bugs/Failing_to_execute_bash_remotes_windows.mdwn b/doc/bugs/Failing_to_execute_bash_remotes_windows.mdwn
index 6e241473f..15ecbf488 100644
--- a/doc/bugs/Failing_to_execute_bash_remotes_windows.mdwn
+++ b/doc/bugs/Failing_to_execute_bash_remotes_windows.mdwn
@@ -54,3 +54,5 @@ VERSION 1
### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders)
Oh yeah! This software is awesome. After getting used to having "dummy" shortcuts to content I don't currently have, with the simple ability to get/drop that content, I can't believe I haven't seen this anywhere before. If there is anything more impressive than this software, it's the support it has had from Joey over all this time. I'd have pulled my hair out long ago. :P
+
+> [[fixed|done]] although untested --[[Joey]]
diff --git a/doc/bugs/Failing_to_execute_bash_remotes_windows/comment_3_691fe409f869c46e3716924e958f431a._comment b/doc/bugs/Failing_to_execute_bash_remotes_windows/comment_3_691fe409f869c46e3716924e958f431a._comment
new file mode 100644
index 000000000..0d27c86e1
--- /dev/null
+++ b/doc/bugs/Failing_to_execute_bash_remotes_windows/comment_3_691fe409f869c46e3716924e958f431a._comment
@@ -0,0 +1,14 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 3"""
+ date="2017-03-08T19:36:57Z"
+ content="""
+Looking into it a bit more, the problem seems to be that findShellCommand
+expects a path to a file to examine, but when it's used for an external
+special remote, it's only given the name of the command.
+
+So, I fixed it by searching for the command in the PATH.
+
+I have still not tested if this works on Windows, but probably, I think.
+As long as PATH is set on Windows at least.
+"""]]