Hello community,

here is the log from the commit of package ghc-dns for openSUSE:Factory checked 
in at 2016-06-25 02:20:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-dns (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-dns.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-dns"

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-dns/ghc-dns.changes  2016-05-03 
09:36:44.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-dns.new/ghc-dns.changes     2016-06-25 
02:21:47.000000000 +0200
@@ -1,0 +2,6 @@
+Sun Jun 19 20:06:07 UTC 2016 - [email protected]
+
+- update to 2.0.3
+* Use Safe.toEnumMay to handle unsupported opcodes gracefully
+
+-------------------------------------------------------------------

Old:
----
  dns-2.0.2.tar.gz

New:
----
  dns-2.0.3.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-dns.spec ++++++
--- /var/tmp/diff_new_pack.wRadD8/_old  2016-06-25 02:21:48.000000000 +0200
+++ /var/tmp/diff_new_pack.wRadD8/_new  2016-06-25 02:21:48.000000000 +0200
@@ -19,7 +19,7 @@
 %global pkg_name dns
 %bcond_with tests
 Name:           ghc-dns
-Version:        2.0.2
+Version:        2.0.3
 Release:        0
 Summary:        DNS library in Haskell
 License:        BSD-3-Clause
@@ -40,6 +40,7 @@
 BuildRequires:  ghc-network-devel
 BuildRequires:  ghc-random-devel
 BuildRequires:  ghc-resourcet-devel
+BuildRequires:  ghc-safe-devel
 BuildRequires:  ghc-rpm-macros
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 %if %{with tests}

++++++ dns-2.0.2.tar.gz -> dns-2.0.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dns-2.0.2/Network/DNS/Decode.hs 
new/dns-2.0.3/Network/DNS/Decode.hs
--- old/dns-2.0.2/Network/DNS/Decode.hs 2016-04-12 06:15:47.000000000 +0200
+++ new/dns-2.0.3/Network/DNS/Decode.hs 2016-06-17 02:52:57.000000000 +0200
@@ -19,9 +19,11 @@
 import Data.Conduit.Network (sourceSocket)
 import Data.IP (IP(..), toIPv4, toIPv6b)
 import Data.Typeable (Typeable)
+import Data.Word (Word16)
 import Network (Socket)
 import Network.DNS.Internal
 import Network.DNS.StateBinary
+import qualified Safe
 
 #if __GLASGOW_HASKELL__ < 709
 import Control.Applicative
@@ -81,22 +83,28 @@
 ----------------------------------------------------------------
 
 decodeFlags :: SGet DNSFlags
-decodeFlags = toFlags <$> get16
+decodeFlags = do
+    word <- get16
+    maybe (fail "Unsupported flags") pure (toFlags word)
   where
-    toFlags flgs = DNSFlags (getQorR flgs)
-                            (getOpcode flgs)
-                            (getAuthAnswer flgs)
-                            (getTrunCation flgs)
-                            (getRecDesired flgs)
-                            (getRecAvailable flgs)
-                            (getRcode flgs)
+    toFlags :: Word16 -> Maybe DNSFlags
+    toFlags flgs = do
+      opcode_ <- getOpcode flgs
+      rcode_ <- getRcode flgs
+      return $ DNSFlags (getQorR flgs)
+                        opcode_
+                        (getAuthAnswer flgs)
+                        (getTrunCation flgs)
+                        (getRecDesired flgs)
+                        (getRecAvailable flgs)
+                        rcode_
     getQorR w = if testBit w 15 then QR_Response else QR_Query
-    getOpcode w = toEnum $ fromIntegral $ shiftR w 11 .&. 0x0f
+    getOpcode w = Safe.toEnumMay (fromIntegral (shiftR w 11 .&. 0x0f))
     getAuthAnswer w = testBit w 10
     getTrunCation w = testBit w 9
     getRecDesired w = testBit w 8
     getRecAvailable w = testBit w 7
-    getRcode w = toEnum $ fromIntegral $ w .&. 0x0f
+    getRcode w = Safe.toEnumMay (fromIntegral (w .&. 0x0f))
 
 ----------------------------------------------------------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dns-2.0.2/Network/DNS/Internal.hs 
new/dns-2.0.3/Network/DNS/Internal.hs
--- old/dns-2.0.2/Network/DNS/Internal.hs       2016-04-12 06:15:47.000000000 
+0200
+++ new/dns-2.0.3/Network/DNS/Internal.hs       2016-06-17 02:52:57.000000000 
+0200
@@ -143,9 +143,21 @@
 
 data QorR = QR_Query | QR_Response deriving (Eq, Show)
 
-data OPCODE = OP_STD | OP_INV | OP_SSR deriving (Eq, Show, Enum)
+data OPCODE
+  = OP_STD
+  | OP_INV
+  | OP_SSR
+  deriving (Eq, Show, Enum, Bounded)
 
-data RCODE = NoErr | FormatErr | ServFail | NameErr | NotImpl | Refused | 
BadOpt deriving (Eq, Show, Enum)
+data RCODE
+  = NoErr
+  | FormatErr
+  | ServFail
+  | NameErr
+  | NotImpl
+  | Refused
+  | BadOpt
+  deriving (Eq, Show, Enum, Bounded)
 
 ----------------------------------------------------------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dns-2.0.2/dns.cabal new/dns-2.0.3/dns.cabal
--- old/dns-2.0.2/dns.cabal     2016-04-12 06:15:47.000000000 +0200
+++ new/dns-2.0.3/dns.cabal     2016-06-17 02:52:57.000000000 +0200
@@ -1,5 +1,5 @@
 Name:                   dns
-Version:                2.0.2
+Version:                2.0.3
 Author:                 Kazu Yamamoto <[email protected]>
 Maintainer:             Kazu Yamamoto <[email protected]>
 License:                BSD3
@@ -39,6 +39,7 @@
                       , network >= 2.3
                       , random
                       , resourcet
+                      , safe == 0.3.*
   else
     Build-Depends:      base >= 4 && < 5
                       , attoparsec
@@ -54,6 +55,7 @@
                       , network-bytestring
                       , random
                       , resourcet
+                      , safe == 0.3.*
 
 Test-Suite network
   Type:                 exitcode-stdio-1.0
@@ -90,6 +92,7 @@
                       , network >= 2.3
                       , random
                       , resourcet
+                      , safe == 0.3.*
                       , word8
 
 Test-Suite doctest


Reply via email to