diff --git a/Utility/SshConfig.hs b/Utility/SshConfig.hs index ca336a4b8d..57e4f0f389 100644 --- a/Utility/SshConfig.hs +++ b/Utility/SshConfig.hs @@ -15,6 +15,7 @@ import Utility.FileMode import Data.Char import Data.Ord import Data.Either +import System.Directory data SshConfig = GlobalConfig SshSetting @@ -117,8 +118,11 @@ changeUserSshConfig modifier = do whenM (doesFileExist configfile) $ do c <- readFileStrict configfile let c' = modifier c - when (c /= c') $ - viaTmp writeSshConfig configfile c' + when (c /= c') $ do + -- If it's a symlink, replace the file it + -- points to. + f <- catchDefaultIO configfile (canonicalizePath configfile) + viaTmp writeSshConfig f c' writeSshConfig :: FilePath -> String -> IO () writeSshConfig f s = do diff --git a/debian/changelog b/debian/changelog index 0ded62f123..e13e648e40 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ git-annex (5.20150917) UNRELEASED; urgency=medium * info: Don't allow use in a non-git-annex repository, since it uses the git-annex branch and would create it if it were missing. + * assistant: When updating ~/.ssh/config, preserve any symlinks. -- Joey Hess Wed, 16 Sep 2015 12:23:33 -0400 diff --git a/doc/bugs/git-annex_rewrites_.ssh__47__config/comment_1_030209c8c309e976761825c6c51a602d._comment b/doc/bugs/git-annex_rewrites_.ssh__47__config/comment_1_030209c8c309e976761825c6c51a602d._comment new file mode 100644 index 0000000000..26df1211aa --- /dev/null +++ b/doc/bugs/git-annex_rewrites_.ssh__47__config/comment_1_030209c8c309e976761825c6c51a602d._comment @@ -0,0 +1,15 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 1""" + date="2015-09-21T16:14:03Z" + content=""" +The assistant does not normally do this when you merely start it up. It does it +when you configure a ssh remote, when it needs to modify that file. +It might also modify the file on startup if it detects a configuration that +an old version of the assistant put in that needs to be fixed up. + +Is the trailing whitespace you speak of just a newline added after the +existing host block, or something else? Your "..." is not very clear. + +Fixed symlink issue in git. +"""]]