From: Joey Hess Date: Fri, 29 Mar 2013 17:09:30 +0000 (-0400) Subject: webapp: Run ssh server probes in a way that will work when the login shell is a monst... X-Git-Tag: archive/raspbian/10.20250416-2+rpi1~1^2~4730 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=6fa0d0ecc895013264c4352a859250132a4b4981;p=git-annex.git 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. --- diff --git a/Assistant/WebApp/Configurators/Ssh.hs b/Assistant/WebApp/Configurators/Ssh.hs index 201be882e1..28d58fd71c 100644 --- a/Assistant/WebApp/Configurators/Ssh.hs +++ b/Assistant/WebApp/Configurators/Ssh.hs @@ -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" diff --git a/Utility/SafeCommand.hs b/Utility/SafeCommand.hs index e6075e888d..785aec5781 100644 --- a/Utility/SafeCommand.hs +++ b/Utility/SafeCommand.hs @@ -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 diff --git a/debian/changelog b/debian/changelog index b8dbc7b2bc..e7b79f34b0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Mon, 25 Mar 2013 10:21:46 -0400 diff --git a/doc/bugs/Detection_assumes_that_shell_is_bash.mdwn b/doc/bugs/Detection_assumes_that_shell_is_bash.mdwn index 46b159e804..9bb0629d3e 100644 --- a/doc/bugs/Detection_assumes_that_shell_is_bash.mdwn +++ b/doc/bugs/Detection_assumes_that_shell_is_bash.mdwn @@ -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]] diff --git a/doc/bugs/host_with_rysnc_installed__44___not_recognized.mdwn b/doc/bugs/host_with_rysnc_installed__44___not_recognized.mdwn index e411eaf9c1..4513ad9dbc 100644 --- a/doc/bugs/host_with_rysnc_installed__44___not_recognized.mdwn +++ b/doc/bugs/host_with_rysnc_installed__44___not_recognized.mdwn @@ -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]]