, rsyncOnly = status == UsableRsyncServer
}
probe extraopts = do
- let remotecommand = join ";"
+ let remotecommand = shellWrap $ join ";"
[ report "loggedin"
, checkcommand "git-annex-shell"
, checkcommand "rsync"
"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
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"
{ 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
* 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
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]]
[[!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]]