[Git][haskell-team/DHG_packages][master] haskell-validity: add upstream proposed patch (from Ubuntu) to fix build on 32bit architectures

Gianfranco Costamagna gitlab at salsa.debian.org
Fri Aug 21 14:22:17 BST 2020



Gianfranco Costamagna pushed to branch master at Debian Haskell Group / DHG_packages


Commits:
50b8d6bc by Gianfranco Costamagna at 2020-08-21T15:20:32+02:00
haskell-validity: add upstream proposed patch (from Ubuntu) to fix build on 32bit architectures

- - - - -


3 changed files:

- p/haskell-validity/debian/changelog
- + p/haskell-validity/debian/patches/85.patch
- + p/haskell-validity/debian/patches/series


Changes:

=====================================
p/haskell-validity/debian/changelog
=====================================
@@ -1,3 +1,10 @@
+haskell-validity (0.11.0.0-2) unstable; urgency=medium
+
+  * Add upstream proposed patch from Iain Lane <iain.lane at canonical.com>
+    to fix a test failure on 32bit architectures
+
+ -- Gianfranco Costamagna <locutusofborg at debian.org>  Fri, 21 Aug 2020 15:03:23 +0200
+
 haskell-validity (0.11.0.0-1) unstable; urgency=medium
 
   * New upstream release


=====================================
p/haskell-validity/debian/patches/85.patch
=====================================
@@ -0,0 +1,82 @@
+From 5d4dd5c2b24e1b363fe4168bb9223d7610a2c8b1 Mon Sep 17 00:00:00 2001
+From: Iain Lane <iain.lane at canonical.com>
+Date: Fri, 21 Aug 2020 12:37:05 +0100
+Subject: [PATCH] validity: Don't overflow Int/Word sizes
+
+The maximum size for e.g. a Word32 is 2^32 - 1. This happens to work OK
+on 64 bit CPU architectures, but fails badly on 32 bit.
+
+https://github.com/NorfairKing/validity/issues/84
+---
+ src/Data/Validity.hs | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/src/Data/Validity.hs b/src/Data/Validity.hs
+index 187f20e..98feea2 100644
+--- a/src/Data/Validity.hs
++++ b/src/Data/Validity.hs
+@@ -99,14 +99,14 @@ import Data.Bits ((.&.))
+ import Data.Char (ord)
+ import Data.Int (Int64)
+ import GHC.Int (Int8(..), Int16(..), Int32(..))
+-import GHC.Exts (Char(..), ord#, isTrue#, (<=#), (>=#), (<#), (>=#))
++import GHC.Exts (Char(..), ord#, isTrue#, (<=#), (>=#), (>=#))
+ #if MIN_VERSION_base(4,8,0)
+ import GHC.Word (Word8(..), Word16(..), Word32(..), Word64(..))
+ #else
+ import Data.Word (Word)
+ import GHC.Word (Word8(..), Word16(..), Word32(..), Word64(..))
+ #endif
+-import GHC.Exts (ltWord#)
++import GHC.Exts (leWord#)
+ import GHC.Generics
+ #if MIN_VERSION_base(4,8,0)
+ import GHC.Natural
+@@ -422,7 +422,7 @@ instance Validity Int where
+ instance Validity Int8 where
+     validate (I8# i#) =
+       mconcat
+-        [ declare "The contained integer is smaller than 2^7 = 128" $ isTrue# (i# <# 128#)
++        [ declare "The contained integer is smaller than 2^7 = 128" $ isTrue# (i# <=# 127#)
+         , declare "The contained integer is greater than or equal to -2^7 = -128" $ isTrue# (i# >=# -128#)
+         ]
+ 
+@@ -430,7 +430,7 @@ instance Validity Int8 where
+ instance Validity Int16 where
+     validate (I16# i#) =
+       mconcat
+-        [ declare "The contained integer is smaller than 2^15 = 32768" $ isTrue# (i# <# 32768#)
++        [ declare "The contained integer is smaller than 2^15 = 32768" $ isTrue# (i# <=# 32767#)
+         , declare "The contained integer is greater than or equal to -2^15 = -32768" $ isTrue# (i# >=# -32768#)
+         ]
+ 
+@@ -438,7 +438,7 @@ instance Validity Int16 where
+ instance Validity Int32 where
+     validate (I32# i#) =
+       mconcat
+-        [ declare "The contained integer is smaller than 2^31 = 2147483648" $ isTrue# (i# <# 2147483648#)
++        [ declare "The contained integer is smaller than 2^31 = 2147483648" $ isTrue# (i# <=# 2147483647#)
+         , declare "The contained integer is greater than or equal to -2^31 = -2147483648" $ isTrue# (i# >=# -2147483648#)
+         ]
+ 
+@@ -453,17 +453,17 @@ instance Validity Word where
+ -- | NOT trivially valid on GHC because small number types are represented using a 64bit structure underneath.
+ instance Validity Word8 where
+     validate (W8# w#) =
+-      declare "The contained integer is smaller than 2^8 = 256" $ isTrue# (w# `ltWord#` 256##)
++      declare "The contained integer is smaller than 2^8 = 256" $ isTrue# (w# `leWord#` 255##)
+ 
+ -- | NOT trivially valid on GHC because small number types are represented using a 64bit structure underneath.
+ instance Validity Word16 where
+     validate (W16# w#) =
+-      declare "The contained integer is smaller than 2^16 = 65536" $ isTrue# (w# `ltWord#` 65536##)
++      declare "The contained integer is smaller than 2^16 = 65536" $ isTrue# (w# `leWord#` 65535##)
+ 
+ -- | NOT trivially valid on GHC because small number types are represented using a 64bit structure underneath.
+ instance Validity Word32 where
+     validate (W32# w#) =
+-      declare "The contained integer is smaller than 2^32 = 4294967296" $ isTrue# (w# `ltWord#` 4294967296##)
++      declare "The contained integer is smaller than 2^32 = 4294967296" $ isTrue# (w# `leWord#` 4294967295##)
+ 
+ -- | Trivially valid
+ instance Validity Word64 where


=====================================
p/haskell-validity/debian/patches/series
=====================================
@@ -0,0 +1 @@
+85.patch



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

-- 
View it on GitLab: https://salsa.debian.org/haskell-team/DHG_packages/-/commit/50b8d6bcb4948999651e8a8186e665c5ac954d50
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/20200821/3742963b/attachment-0001.html>


More information about the Pkg-haskell-commits mailing list