webapp: Run ssh server probes in a way that will work when the login shell is a monst...
authorJoey Hess <joey@kitenet.net>
Fri, 29 Mar 2013 17:09:30 +0000 (13:09 -0400)
committerJoey Hess <joey@kitenet.net>
Fri, 29 Mar 2013 17:09:30 +0000 (13:09 -0400)
Assistant/WebApp/Configurators/Ssh.hs
Utility/SafeCommand.hs
debian/changelog
doc/bugs/Detection_assumes_that_shell_is_bash.mdwn
doc/bugs/host_with_rysnc_installed__44___not_recognized.mdwn

index 201be882e13e3e6b14aebe0141933670e35c5e55..28d58fd71c4681a64001c9497691deedacb0853d 100644 (file)
@@ -206,7 +206,7 @@ testServer sshinput@(SshInput { inputHostname = Just hn }) = do
                , rsyncOnly = status == UsableRsyncServer
                }
        probe extraopts = do
-               let remotecommand = join ";"
+               let remotecommand = shellWrap $ join ";"
                        [ report "loggedin"
                        , checkcommand "git-annex-shell"
                        , checkcommand "rsync"
@@ -236,6 +236,7 @@ testServer sshinput@(SshInput { inputHostname = Just hn }) = do
                        "Failed to ssh to the server. Transcript: " ++ s
          where
                reported r = token r `isInfixOf` s
+       
        checkcommand c = "if which " ++ c ++ "; then " ++ report c ++ "; fi"
        token r = "git-annex-probe " ++ r
        report r = "echo " ++ token r
@@ -287,7 +288,7 @@ makeSsh' rsync setup sshdata keypair =
   where
        sshhost = genSshHost (sshHostName sshdata) (sshUserName sshdata)
        remotedir = T.unpack $ sshDirectory sshdata
-       remoteCommand = join "&&" $ catMaybes
+       remoteCommand = shellWrap $ join "&&" $ catMaybes
                [ Just $ "mkdir -p " ++ shellEscape remotedir
                , Just $ "cd " ++ shellEscape remotedir
                , if rsync then Nothing else Just "git init --bare --shared"
index e6075e888da75ddc62aa62d81599910990948d3a..785aec578153f0bf90a4185ea5d358a195aa6513 100644 (file)
@@ -55,8 +55,16 @@ safeSystemEnv command params environ = do
                { env = environ }
        waitForProcess pid
 
+{- Wraps a shell command line inside sh -c, allowing it to be run in a
+ - login shell that may not support POSIX shell, eg csh. -}
+shellWrap :: String -> String
+shellWrap cmdline = "sh -c " ++ shellEscape cmdline
+
 {- Escapes a filename or other parameter to be safely able to be exposed to
- - the shell. -}
+ - the shell.
+ -
+ - This method works for POSIX shells, as well as other shells like csh.
+ -}
 shellEscape :: String -> String
 shellEscape f = "'" ++ escaped ++ "'"
   where
index b8dbc7b2bc4a58c578e6b05eb8587485a33f6c9b..e7b79f34b0fa00643b97c5b06abb5ef157211c03 100644 (file)
@@ -7,6 +7,9 @@ git-annex (4.20130324) UNRELEASED; urgency=low
   * webapp: Progess bar fixes for many types of special remotes.
   * Build debian package without using cabal, which writes to HOME.
     Closes: #704205
+  * webapp: Run ssh server probes in a way that will work when the
+    login shell is a monstrosity that should have died 25 years ago,
+    such as csh.
 
  -- Joey Hess <joeyh@debian.org>  Mon, 25 Mar 2013 10:21:46 -0400
 
index 46b159e80498f5657bd8f0ce4527ef3fe5376c97..9bb0629d3e2de938c129b46dbfd14483c80bbf0d 100644 (file)
@@ -18,3 +18,7 @@ git-annex version: 3.20121017
 Not everyone has bash as there login-shell.
 
 [[!tag /design/assistant]]
+
+> [[done]]; assistant now uses sh -c "sane shell stuff here" to work
+> around csh. (There are systems without bash, but probably fewer without sh)
+> --[[Joey]]
index e411eaf9c1dbe75f32768e615784f9128d6d7b94..4513ad9dbc3d9ed2c2b8d3fadc1678d173633199 100644 (file)
@@ -13,3 +13,7 @@ ssh keys were installed to allow login, when ssh-askpass was not found on osx ve
 
 [[!meta title="webapp rsync probe command failed on FreeNAS box"]]
 [[!tag /design/assistant]]
+
+> [[done]]; based on the error message it's using csh and 
+> the assistant will now wrap its shell commands to work with csh.
+> --[[Joey]]