[Git][haskell-team/DHG_packages][master] pandoc: Fix FTBFS on 32-bit platforms

Ilias Tsitsimpis (@iliastsi) gitlab at salsa.debian.org
Wed Dec 6 16:40:46 GMT 2023



Ilias Tsitsimpis pushed to branch master at Debian Haskell Group / DHG_packages


Commits:
2fcd354b by Ilias Tsitsimpis at 2023-12-06T18:23:33+02:00
pandoc: Fix FTBFS on 32-bit platforms

- - - - -


4 changed files:

- p/haskell-pandoc/debian/changelog
- p/haskell-pandoc/debian/control
- + p/haskell-pandoc/debian/patches/8b523749aebb67f709fe7348b412f3e5e629ceb4.patch
- p/haskell-pandoc/debian/patches/series


Changes:

=====================================
p/haskell-pandoc/debian/changelog
=====================================
@@ -1,3 +1,9 @@
+haskell-pandoc (3.0.1-3) unstable; urgency=medium
+
+  * Apply upstream patch to fix FTBFS on 32-bit platforms
+
+ -- Ilias Tsitsimpis <iliastsi at debian.org>  Wed, 06 Dec 2023 18:21:57 +0200
+
 haskell-pandoc (3.0.1-2) unstable; urgency=medium
 
   * Fix CVE-2023-35936


=====================================
p/haskell-pandoc/debian/control
=====================================
@@ -27,9 +27,9 @@ Build-Depends: debhelper (>= 10),
  libghc-attoparsec-dev (>= 0.12),
  libghc-attoparsec-dev (<< 0.15),
  libghc-attoparsec-prof,
- libghc-base64-dev (>= 0.4),
- libghc-base64-dev (<< 0.5),
- libghc-base64-prof,
+ libghc-base64-bytestring-dev (>= 0.1),
+ libghc-base64-bytestring-dev (<< 1.3),
+ libghc-base64-bytestring-prof,
  libghc-blaze-html-dev (>= 0.9),
  libghc-blaze-html-dev (<< 0.10),
  libghc-blaze-html-prof,
@@ -176,7 +176,7 @@ Build-Depends-Indep: ghc-doc,
  libghc-aeson-doc,
  libghc-aeson-pretty-doc,
  libghc-attoparsec-doc,
- libghc-base64-doc,
+ libghc-base64-bytestring-doc,
  libghc-blaze-html-doc,
  libghc-blaze-markup-doc,
  libghc-case-insensitive-doc,


=====================================
p/haskell-pandoc/debian/patches/8b523749aebb67f709fe7348b412f3e5e629ceb4.patch
=====================================
@@ -0,0 +1,158 @@
+From 8b523749aebb67f709fe7348b412f3e5e629ceb4 Mon Sep 17 00:00:00 2001
+From: John MacFarlane <jgm at berkeley.edu>
+Date: Wed, 6 Dec 2023 08:04:24 -0800
+Subject: [PATCH] Revert "Use base64 instead of base64-bytestring."
+
+This reverts commit 6625e9655ed2bb0c4bd4dd91b5959a103deab1cb.
+
+base64 is currently buggy on 32-bit systems. Closes #9233.
+---
+ pandoc.cabal                     | 2 +-
+ src/Text/Pandoc/Class/IO.hs      | 4 ++--
+ src/Text/Pandoc/Readers/FB2.hs   | 4 ++--
+ src/Text/Pandoc/Readers/HTML.hs  | 5 +++--
+ src/Text/Pandoc/SelfContained.hs | 4 ++--
+ src/Text/Pandoc/Writers/FB2.hs   | 6 +++---
+ 6 files changed, 13 insertions(+), 12 deletions(-)
+
+Index: b/pandoc.cabal
+===================================================================
+--- a/pandoc.cabal
++++ b/pandoc.cabal
+@@ -451,6 +451,7 @@ library
+                  aeson-pretty          >= 0.8.9    && < 0.9,
+                  array                 >= 0.5      && < 0.6,
+                  attoparsec            >= 0.12     && < 0.15,
++                 base64-bytestring     >= 0.1      && < 1.3,
+                  binary                >= 0.7      && < 0.11,
+                  blaze-html            >= 0.9      && < 0.10,
+                  blaze-markup          >= 0.8      && < 0.9,
+@@ -467,7 +468,6 @@ library
+                  directory             >= 1.2.3    && < 1.4,
+                  doclayout             >= 0.4      && < 0.5,
+                  doctemplates          >= 0.11     && < 0.12,
+-                 base64                >= 0.4      && < 0.5,
+                  emojis                >= 0.1      && < 0.2,
+                  exceptions            >= 0.8      && < 0.11,
+                  file-embed            >= 0.0      && < 0.1,
+Index: b/src/Text/Pandoc/Class/IO.hs
+===================================================================
+--- a/src/Text/Pandoc/Class/IO.hs
++++ b/src/Text/Pandoc/Class/IO.hs
+@@ -37,7 +37,7 @@ module Text.Pandoc.Class.IO
+ 
+ import Control.Monad.Except (throwError)
+ import Control.Monad.IO.Class (MonadIO, liftIO)
+-import Data.ByteString.Base64 (decodeBase64Lenient)
++import Data.ByteString.Base64 (decodeLenient)
+ import Data.ByteString.Lazy (toChunks)
+ import Data.Text (Text, pack, unpack)
+ import Data.Time (TimeZone, UTCTime)
+@@ -126,7 +126,7 @@ openURL u
+               uriPath = upath }) <- parseURI (T.unpack u) = do
+      let (mime, rest) = break (== ',') $ unEscapeString upath
+      let contents = UTF8.fromString $ drop 1 rest
+-     return (decodeBase64Lenient contents, Just (T.pack mime))
++     return (decodeLenient contents, Just (T.pack mime))
+  | otherwise = do
+      let toReqHeader (n, v) = (CI.mk (UTF8.fromText n), UTF8.fromText v)
+      customHeaders <- map toReqHeader <$> getsCommonState stRequestHeaders
+Index: b/src/Text/Pandoc/Readers/FB2.hs
+===================================================================
+--- a/src/Text/Pandoc/Readers/FB2.hs
++++ b/src/Text/Pandoc/Readers/FB2.hs
+@@ -25,7 +25,7 @@ TODO:
+ module Text.Pandoc.Readers.FB2 ( readFB2 ) where
+ import Control.Monad.Except (throwError)
+ import Control.Monad.State.Strict
+-import Data.ByteString.Lazy.Base64
++import Data.ByteString.Base64.Lazy
+ import Data.Functor
+ import Data.List (intersperse)
+ import qualified Data.Map as M
+@@ -202,7 +202,7 @@ parseBinaryElement e =
+       report $ IgnoredElement "binary without content-type attribute"
+     (Just filename, contentType) ->
+       insertMedia (T.unpack filename) contentType
+-                    (decodeBase64Lenient
++                    (decodeLenient
+                       (UTF8.fromTextLazy . TL.fromStrict . strContent $ e))
+ 
+ -- * Type parsers
+Index: b/src/Text/Pandoc/Readers/HTML.hs
+===================================================================
+--- a/src/Text/Pandoc/Readers/HTML.hs
++++ b/src/Text/Pandoc/Readers/HTML.hs
+@@ -28,7 +28,7 @@ import Control.Applicative ((<|>))
+ import Control.Monad (guard, mzero, unless, void)
+ import Control.Monad.Except (throwError, catchError)
+ import Control.Monad.Reader (ask, asks, lift, local, runReaderT)
+-import Data.Text.Encoding.Base64 (encodeBase64)
++import Data.ByteString.Base64 (encode)
+ import Data.Char (isAlphaNum, isLetter)
+ import Data.Default (Default (..), def)
+ import Data.Foldable (for_)
+@@ -779,7 +779,8 @@ pSvg = do
+   contents <- many (notFollowedBy (pCloses "svg") >> pAny)
+   closet <- TagClose "svg" <$ (pCloses "svg" <|> eof)
+   let rawText = T.strip $ renderTags' (opent : contents ++ [closet])
+-  let svgData = "data:image/svg+xml;base64," <> encodeBase64 rawText
++  let svgData = "data:image/svg+xml;base64," <>
++                   UTF8.toText (encode $ UTF8.fromText rawText)
+   return $ B.imageWith (ident,cls,[]) svgData mempty mempty
+ 
+ pCodeWithClass :: PandocMonad m => Text -> Text -> TagParser m Inlines
+Index: b/src/Text/Pandoc/SelfContained.hs
+===================================================================
+--- a/src/Text/Pandoc/SelfContained.hs
++++ b/src/Text/Pandoc/SelfContained.hs
+@@ -19,7 +19,7 @@ import Codec.Compression.GZip as Gzip
+ import Control.Applicative ((<|>))
+ import Control.Monad.Trans (lift)
+ import Data.ByteString (ByteString)
+-import Data.ByteString.Base64 (encodeBase64)
++import Data.ByteString.Base64 (encode)
+ import qualified Data.ByteString.Char8 as B
+ import qualified Data.ByteString.Lazy as L
+ import qualified Data.Text as T
+@@ -46,7 +46,7 @@ makeDataURI :: (MimeType, ByteString) ->
+ makeDataURI (mime, raw) =
+   if textual
+      then "data:" <> mime' <> "," <> T.pack (escapeURIString isOk (toString raw))
+-     else "data:" <> mime' <> ";base64," <> encodeBase64 raw
++     else "data:" <> mime' <> ";base64," <> toText (encode raw)
+   where textual = "text/" `T.isPrefixOf` mime
+         mime' = if textual && T.any (== ';') mime
+                    then mime <> ";charset=utf-8"
+Index: b/src/Text/Pandoc/Writers/FB2.hs
+===================================================================
+--- a/src/Text/Pandoc/Writers/FB2.hs
++++ b/src/Text/Pandoc/Writers/FB2.hs
+@@ -21,16 +21,16 @@ module Text.Pandoc.Writers.FB2 (writeFB2
+ import Control.Monad (zipWithM, liftM)
+ import Control.Monad.Except (catchError, throwError)
+ import Control.Monad.State.Strict (StateT, evalStateT, get, gets, lift, modify)
+-import Data.ByteString.Base64 (encodeBase64)
++import Data.ByteString.Base64 (encode)
+ import Data.Char (isAscii, isControl, isSpace)
+ import Data.Either (lefts, rights)
+ import Data.List (intercalate)
+ import Data.Text (Text)
+ import qualified Data.Text as T
+ import qualified Data.Text.Lazy as TL
++import qualified Data.Text.Encoding as TE
+ import Text.Pandoc.URI (urlEncode, isURI)
+ import Text.Pandoc.XML.Light as X
+-
+ import Text.Pandoc.Class.PandocMonad (PandocMonad, report)
+ import qualified Text.Pandoc.Class.PandocMonad as P
+ import Text.Pandoc.Definition
+@@ -237,7 +237,7 @@ fetchImage href link = do
+                                report $ CouldNotDetermineMimeType link
+                                return Nothing
+                              Just mime -> return $ Just (mime,
+-                                                        encodeBase64 bs))
++                                                      TE.decodeUtf8 $ encode bs))
+                     (\e ->
+                        do report $ CouldNotFetchResource link (tshow e)
+                           return Nothing)


=====================================
p/haskell-pandoc/debian/patches/series
=====================================
@@ -8,3 +8,4 @@ undo-xml-light-internal-library
 020230623.3~fe62da6.patch
 020230623.4~5246f02.patch
 020230720~eddedbf.patch
+8b523749aebb67f709fe7348b412f3e5e629ceb4.patch



View it on GitLab: https://salsa.debian.org/haskell-team/DHG_packages/-/commit/2fcd354bb877549e7550b34453761ce92d50ca04

-- 
View it on GitLab: https://salsa.debian.org/haskell-team/DHG_packages/-/commit/2fcd354bb877549e7550b34453761ce92d50ca04
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-haskell-commits/attachments/20231206/924fa37c/attachment-0001.htm>


More information about the Pkg-haskell-commits mailing list