summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-10-12 12:19:30 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-10-12 12:19:30 -0400
commita0b643354907628a16f927935de0396382239c59 (patch)
tree1641aa8f5309f4d50631555c00df86ec3729a6a7
parent4a63cdd9008bfe34af01c3662af512927a0cee0b (diff)
Fix a crash when merging files in the git-annex branch that contain invalid utf8.
The crash actually occurred when writing out the file, which was done to a handle that had not had fileSystemEncoding applied to it.
-rw-r--r--Git/Command.hs2
-rw-r--r--Utility/Process.hs15
-rw-r--r--debian/changelog2
-rw-r--r--doc/bugs/error_when_using_repositories_with_non-ASCII_characters.mdwn3
4 files changed, 17 insertions, 5 deletions
diff --git a/Git/Command.hs b/Git/Command.hs
index 0a324ea00..5f2dd47b0 100644
--- a/Git/Command.hs
+++ b/Git/Command.hs
@@ -73,7 +73,7 @@ pipeReadStrict params repo = assertLocal repo $
pipeWriteRead :: [CommandParam] -> String -> Repo -> IO String
pipeWriteRead params s repo = assertLocal repo $
writeReadProcessEnv "git" (toCommand $ gitCommandLine params repo)
- (gitEnv repo) s
+ (gitEnv repo) s (Just fileEncoding)
{- Runs a git subcommand, feeding it input on a handle with an action. -}
pipeWrite :: [CommandParam] -> Repo -> (Handle -> IO ()) -> IO ()
diff --git a/Utility/Process.hs b/Utility/Process.hs
index db24bf47e..613dd8b0f 100644
--- a/Utility/Process.hs
+++ b/Utility/Process.hs
@@ -64,17 +64,24 @@ readProcessEnv cmd args environ =
, env = environ
}
-{- Writes stdout to a process, returns its output, and also allows specifying
- - the environment. -}
+{- Writes a string to a process on its stdout,
+ - returns its output, and also allows specifying the environment.
+ -
+ -
+ -}
writeReadProcessEnv
:: FilePath
-> [String]
-> Maybe [(String, String)]
- -> String
+ -> String
+ -> (Maybe (Handle -> IO ()))
-> IO String
-writeReadProcessEnv cmd args environ input = do
+writeReadProcessEnv cmd args environ input adjusthandle = do
(Just inh, Just outh, _, pid) <- createProcess p
+ maybe (return ()) (\a -> a inh) adjusthandle
+ maybe (return ()) (\a -> a outh) adjusthandle
+
-- fork off a thread to start consuming the output
output <- hGetContents outh
outMVar <- newEmptyMVar
diff --git a/debian/changelog b/debian/changelog
index 65e091753..b3e825560 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,8 @@ git-annex (3.20121010) UNRELEASED; urgency=low
their group, or even to disable syncing to them.
* git config remote.name.annex-sync can be used to control whether
a remote gets synced.
+ * Fix a crash when merging files in the git-annex branch that contain
+ invalid utf8.
-- Joey Hess <joeyh@debian.org> Wed, 10 Oct 2012 12:59:25 -0400
diff --git a/doc/bugs/error_when_using_repositories_with_non-ASCII_characters.mdwn b/doc/bugs/error_when_using_repositories_with_non-ASCII_characters.mdwn
index 9edd754c7..d88b86b44 100644
--- a/doc/bugs/error_when_using_repositories_with_non-ASCII_characters.mdwn
+++ b/doc/bugs/error_when_using_repositories_with_non-ASCII_characters.mdwn
@@ -57,3 +57,6 @@ Using Ubuntu's original version (3.20120406) the error message is a bit differen
> try to look at it again soon; the last 2 times I looked at that code
> I could not see an easy way to make it allow invalid utf-8 encoded data.
> --[[Joey]]
+
+>> [[done]], although I am no longer so sure this was the last utf-8
+>> encoding bug.. --[[Joey]]