[DHG_packages] 03/04: conduit-extra: Add fix-alignment patch
Ilias Tsitsimpis
iliastsi-guest at moszumanska.debian.org
Sat Jun 25 11:08:00 UTC 2016
This is an automated email from the git hooks/post-receive script.
iliastsi-guest pushed a commit to branch master
in repository DHG_packages.
commit 0caa5f6f09221f6901e6c4867b764dd679081a00
Author: Ilias Tsitsimpis <i.tsitsimpis at gmail.com>
Date: Sat Jun 25 12:09:27 2016 +0300
conduit-extra: Add fix-alignment patch
Ensure that alignment constraints are fulfilled in all
architectures. This makes the code portable and fixes a FTBFS
for the armhf architecture.
---
p/haskell-conduit-extra/debian/changelog | 8 ++-
.../debian/patches/fix-alignment | 79 ++++++++++++++++++++++
p/haskell-conduit-extra/debian/patches/series | 1 +
3 files changed, 86 insertions(+), 2 deletions(-)
diff --git a/p/haskell-conduit-extra/debian/changelog b/p/haskell-conduit-extra/debian/changelog
index d9e44bb..c25f2e6 100644
--- a/p/haskell-conduit-extra/debian/changelog
+++ b/p/haskell-conduit-extra/debian/changelog
@@ -1,4 +1,4 @@
-haskell-conduit-extra (1.1.13.1-2) UNRELEASED; urgency=medium
+haskell-conduit-extra (1.1.13.1-2) unstable; urgency=medium
* Update d/copyright file
- Fix typo (s/Attoparsec.h/Attoparsec.hs/)
@@ -6,8 +6,12 @@ haskell-conduit-extra (1.1.13.1-2) UNRELEASED; urgency=medium
* Update the no-bytestring-builder patch
- Remove bytestring-builder package from benchmark's Build-depends
- Add description in DEP-3 format
+ * Add fix-alignment patch
+ Ensure that alignment constraints are fulfilled in all
+ architectures. This makes the code portable and fixes a FTBFS
+ for the armhf architecture.
- -- Ilias Tsitsimpis <i.tsitsimpis at gmail.com> Sat, 25 Jun 2016 11:33:06 +0300
+ -- Ilias Tsitsimpis <i.tsitsimpis at gmail.com> Sat, 25 Jun 2016 12:19:47 +0300
haskell-conduit-extra (1.1.13.1-1) unstable; urgency=medium
diff --git a/p/haskell-conduit-extra/debian/patches/fix-alignment b/p/haskell-conduit-extra/debian/patches/fix-alignment
new file mode 100644
index 0000000..41892b7
--- /dev/null
+++ b/p/haskell-conduit-extra/debian/patches/fix-alignment
@@ -0,0 +1,79 @@
+Description: Fix alignment restrictions
+ Ensure that alignment constraints are fulfilled in all architectures.
+ This makes the code portable and fixes a FTBFS for the armhf architecture.
+Author: Ilias Tsitsimpis <i.tsitsimpis at gmail.com>
+Forwarded: https://github.com/snoyberg/conduit/pull/269
+Index: b/Data/Conduit/Binary.hs
+===================================================================
+--- a/Data/Conduit/Binary.hs
++++ b/Data/Conduit/Binary.hs
+@@ -76,6 +76,8 @@ import Control.Monad.Trans.Resource (Mon
+ import Control.Monad.Catch (MonadThrow (..))
+ import Control.Exception (Exception)
+ import Data.Typeable (Typeable)
++import Foreign.Marshal (alloca, copyBytes)
++import Foreign.Ptr (Ptr)
+
+ -- | Stream the contents of a file as binary data.
+ --
+@@ -501,7 +503,10 @@ sinkStorableHelper wrap failure = do
+
+ -- Given a bytestring of exactly the correct size, grab the value
+ process bs = return $! wrap $! inlinePerformIO $!
+- unsafeUseAsCString bs (peek . castPtr)
++ unsafeUseAsCString bs (safePeek undefined . castPtr)
++
++ safePeek :: a -> Ptr a -> IO a
++ safePeek val ptr = alloca (\t -> copyBytes t ptr (sizeOf val) >> peek t)
+ {-# INLINE sinkStorableHelper #-}
+
+ data SinkStorableException = SinkStorableInsufficientBytes
+Index: b/test/Data/Conduit/BinarySpec.hs
+===================================================================
+--- a/test/Data/Conduit/BinarySpec.hs
++++ b/test/Data/Conduit/BinarySpec.hs
+@@ -20,9 +20,11 @@ import Data.Functor.Identity
+ import Test.QuickCheck.Arbitrary (Arbitrary, arbitrary)
+ import Test.QuickCheck.Gen (Gen, oneof)
+ import Data.Word (Word8)
+-import Foreign.Storable (Storable, sizeOf, pokeByteOff)
++import Foreign.Storable (Storable, sizeOf, pokeByteOff, alignment)
+ import Data.Typeable (Typeable)
+-import Data.ByteString.Internal (unsafeCreate)
++import Data.ByteString.Internal (createAndTrim')
++import Foreign.Ptr (alignPtr, minusPtr)
++import System.IO.Unsafe (unsafePerformIO)
+ import Control.Applicative ((<$>), (<*>))
+
+ spec :: Spec
+@@ -277,19 +279,19 @@ withSomeStorable :: SomeStorable
+ -> b
+ withSomeStorable (SomeStorable x) f = f x
+
+-someStorables :: [SomeStorable] -> S.ByteString
+-someStorables stores0 =
+- unsafeCreate size start
++someStorable :: SomeStorable -> S.ByteString
++someStorable store =
++ fst $ unsafePerformIO $ createAndTrim' (size + align) start
+ where
+- size = sum $ map (\x -> withSomeStorable x sizeOf) stores0
++ size = withSomeStorable store sizeOf
++ align = withSomeStorable store alignment
++ start ptr = do
++ let off = minusPtr ptr (alignPtr ptr align)
++ withSomeStorable store (pokeByteOff ptr off)
++ return (off, size, ())
+
+- start ptr =
+- go stores0 0
+- where
+- go [] _ = return ()
+- go (x:rest) off = do
+- withSomeStorable x (pokeByteOff ptr off)
+- go rest (off + withSomeStorable x sizeOf)
++someStorables :: [SomeStorable] -> S.ByteString
++someStorables = S.concat . map someStorable
+
+ it' :: String -> IO () -> Spec
+ it' = it
diff --git a/p/haskell-conduit-extra/debian/patches/series b/p/haskell-conduit-extra/debian/patches/series
index d61cbb2..56a120c 100644
--- a/p/haskell-conduit-extra/debian/patches/series
+++ b/p/haskell-conduit-extra/debian/patches/series
@@ -1 +1,2 @@
no-bytestring-builder
+fix-alignment
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-haskell/DHG_packages.git
More information about the Pkg-haskell-commits
mailing list