Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ghc-postgresql-libpq for openSUSE:Factory checked in at 2024-04-26 23:27:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-postgresql-libpq (Old) and /work/SRC/openSUSE:Factory/.ghc-postgresql-libpq.new.1880 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-postgresql-libpq" Fri Apr 26 23:27:11 2024 rev:12 rq:1170213 version:0.10.1.0 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-postgresql-libpq/ghc-postgresql-libpq.changes 2023-11-23 21:42:01.046517387 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-postgresql-libpq.new.1880/ghc-postgresql-libpq.changes 2024-04-26 23:27:25.649291439 +0200 @@ -1,0 +2,9 @@ +Thu Apr 18 15:44:23 UTC 2024 - Peter Simons <psim...@suse.com> + +- Update postgresql-libpq to version 0.10.1.0. + 0.10.1.0 + -------- + + - Fix issue with empty binary values (https://github.com/haskellari/postgresql-libpq/issues/54) + +------------------------------------------------------------------- Old: ---- postgresql-libpq-0.10.0.0.tar.gz postgresql-libpq.cabal New: ---- postgresql-libpq-0.10.1.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-postgresql-libpq.spec ++++++ --- /var/tmp/diff_new_pack.TjE8rI/_old 2024-04-26 23:27:26.161310155 +0200 +++ /var/tmp/diff_new_pack.TjE8rI/_new 2024-04-26 23:27:26.161310155 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-postgresql-libpq # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -20,13 +20,12 @@ %global pkgver %{pkg_name}-%{version} %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.10.0.0 +Version: 0.10.1.0 Release: 0 Summary: Low-level binding to libpq License: BSD-3-Clause URL: https://hackage.haskell.org/package/%{pkg_name} Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz -Source1: https://hackage.haskell.org/package/%{pkg_name}-%{version}/revision/1.cabal#/%{pkg_name}.cabal BuildRequires: ghc-Cabal-devel BuildRequires: ghc-Cabal-prof BuildRequires: ghc-base-devel @@ -38,6 +37,12 @@ BuildRequires: ghc-unix-prof BuildRequires: postgresql-server-devel ExcludeArch: %{ix86} +%if %{with tests} +BuildRequires: ghc-tasty-devel +BuildRequires: ghc-tasty-hunit-devel +BuildRequires: ghc-tasty-hunit-prof +BuildRequires: ghc-tasty-prof +%endif %description This is a binding to libpq: the C application programmer's interface to @@ -75,7 +80,6 @@ %prep %autosetup -n %{pkg_name}-%{version} -cp -p %{SOURCE1} %{pkg_name}.cabal %build %ghc_lib_build ++++++ postgresql-libpq-0.10.0.0.tar.gz -> postgresql-libpq-0.10.1.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/postgresql-libpq-0.10.0.0/CHANGELOG.md new/postgresql-libpq-0.10.1.0/CHANGELOG.md --- old/postgresql-libpq-0.10.0.0/CHANGELOG.md 2001-09-09 03:46:40.000000000 +0200 +++ new/postgresql-libpq-0.10.1.0/CHANGELOG.md 2001-09-09 03:46:40.000000000 +0200 @@ -1,3 +1,8 @@ +0.10.1.0 +-------- + +- Fix issue with empty binary values (https://github.com/haskellari/postgresql-libpq/issues/54) + 0.10.0.0 -------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/postgresql-libpq-0.10.0.0/postgresql-libpq.cabal new/postgresql-libpq-0.10.1.0/postgresql-libpq.cabal --- old/postgresql-libpq-0.10.0.0/postgresql-libpq.cabal 2001-09-09 03:46:40.000000000 +0200 +++ new/postgresql-libpq-0.10.1.0/postgresql-libpq.cabal 2001-09-09 03:46:40.000000000 +0200 @@ -1,6 +1,6 @@ cabal-version: 2.4 name: postgresql-libpq -version: 0.10.0.0 +version: 0.10.1.0 synopsis: low-level binding to libpq description: This is a binding to libpq: the C application @@ -24,7 +24,14 @@ build-type: Custom extra-source-files: cbits/hs-libpq.h tested-with: - GHC ==8.6.5 || ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.7 || ==9.4.4 || ==9.6.1 + GHC ==8.6.5 + || ==8.8.4 + || ==8.10.7 + || ==9.0.2 + || ==9.2.8 + || ==9.4.8 + || ==9.6.5 + || ==9.8.2 extra-source-files: CHANGELOG.md @@ -65,10 +72,11 @@ Database.PostgreSQL.LibPQ.Marshal Database.PostgreSQL.LibPQ.Notify Database.PostgreSQL.LibPQ.Oid + Database.PostgreSQL.LibPQ.Ptr build-depends: - , base >=4.12.0.0 && <4.19 - , bytestring >=0.10.8.2 && <0.12 + , base >=4.12.0.0 && <4.20 + , bytestring >=0.10.8.2 && <0.13 if !os(windows) build-depends: unix >=2.7.2.2 && <2.9 @@ -107,6 +115,8 @@ , base , bytestring , postgresql-libpq + , tasty ^>=1.5 + , tasty-hunit ^>=0.10.1 source-repository head type: git diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/postgresql-libpq-0.10.0.0/src/Database/PostgreSQL/LibPQ/Ptr.hs new/postgresql-libpq-0.10.1.0/src/Database/PostgreSQL/LibPQ/Ptr.hs --- old/postgresql-libpq-0.10.0.0/src/Database/PostgreSQL/LibPQ/Ptr.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/postgresql-libpq-0.10.1.0/src/Database/PostgreSQL/LibPQ/Ptr.hs 2001-09-09 03:46:40.000000000 +0200 @@ -0,0 +1,7 @@ +{-# LANGUAGE MagicHash #-} +module Database.PostgreSQL.LibPQ.Ptr (emptyPtr) where + +import GHC.Ptr (Ptr (..)) + +emptyPtr :: Ptr a +emptyPtr = Ptr ""# diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/postgresql-libpq-0.10.0.0/src/Database/PostgreSQL/LibPQ.hs new/postgresql-libpq-0.10.1.0/src/Database/PostgreSQL/LibPQ.hs --- old/postgresql-libpq-0.10.0.0/src/Database/PostgreSQL/LibPQ.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/postgresql-libpq-0.10.1.0/src/Database/PostgreSQL/LibPQ.hs 2001-09-09 03:46:40.000000000 +0200 @@ -238,6 +238,7 @@ import Database.PostgreSQL.LibPQ.Marshal import Database.PostgreSQL.LibPQ.Notify import Database.PostgreSQL.LibPQ.Oid +import Database.PostgreSQL.LibPQ.Ptr -- $dbconn -- The following functions deal with making a connection to a @@ -662,10 +663,13 @@ -- * 'ByteString' uses pinned memory -- * the reference to the 'CString' doesn't escape unsafeUseParamAsCString :: (B.ByteString, Format) -> (CString -> IO a) -> IO a -unsafeUseParamAsCString (bs, format) = +unsafeUseParamAsCString (bs, format) kont = case format of - Binary -> B.unsafeUseAsCString bs - Text -> B.useAsCString bs + Binary -> B.unsafeUseAsCStringLen bs kont' + Text -> B.useAsCString bs kont + where + kont' (ptr, 0) = if ptr == nullPtr then kont emptyPtr else kont ptr + kont' (ptr, _) = kont ptr -- | Convert a list of parameters to the format expected by libpq FFI calls. withParams :: [Maybe (Oid, B.ByteString, Format)] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/postgresql-libpq-0.10.0.0/test/Smoke.hs new/postgresql-libpq-0.10.1.0/test/Smoke.hs --- old/postgresql-libpq-0.10.0.0/test/Smoke.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/postgresql-libpq-0.10.1.0/test/Smoke.hs 2001-09-09 03:46:40.000000000 +0200 @@ -1,17 +1,24 @@ +{-# LANGUAGE OverloadedStrings #-} module Main (main) where -import Control.Monad (unless) +import Control.Monad (unless) +import Data.Foldable (toList) import Database.PostgreSQL.LibPQ -import Data.Foldable (toList) -import System.Environment (getEnvironment) -import System.Exit (exitFailure) +import System.Environment (getEnvironment) +import System.Exit (exitFailure) +import Test.Tasty (defaultMain, testGroup) +import Test.Tasty.HUnit (assertEqual, testCaseSteps) +import qualified Data.ByteString as BS import qualified Data.ByteString.Char8 as BS8 main :: IO () main = do libpqVersion >>= print - withConnstring smoke + withConnstring $ \connString -> defaultMain $ testGroup "postgresql-libpq" + [ testCaseSteps "smoke" $ smoke connString + , testCaseSteps "issue54" $ issue54 connString + ] withConnstring :: (BS8.ByteString -> IO ()) -> IO () withConnstring kont = do @@ -35,21 +42,48 @@ , "port=5432" ] -smoke :: BS8.ByteString -> IO () -smoke connstring = do +smoke :: BS8.ByteString -> (String -> IO ()) -> IO () +smoke connstring info = do + let infoShow x = info (show x) + conn <- connectdb connstring -- status functions - db conn >>= print - user conn >>= print - host conn >>= print - port conn >>= print - status conn >>= print - transactionStatus conn >>= print - protocolVersion conn >>= print - serverVersion conn >>= print + db conn >>= infoShow + user conn >>= infoShow + host conn >>= infoShow + port conn >>= infoShow + status conn >>= infoShow + transactionStatus conn >>= infoShow + protocolVersion conn >>= infoShow + serverVersion conn >>= infoShow s <- status conn - unless (s == ConnectionOk) exitFailure + assertEqual "connection not ok" ConnectionOk s finish conn + +issue54 :: BS8.ByteString -> (String -> IO ()) -> IO () +issue54 connString info = do + conn <- connectdb connString + + Just result <- execParams conn + "SELECT ($1 :: bytea), ($2 :: bytea)" + [Just (Oid 17,"",Binary), Just (Oid 17,BS.empty,Binary)] + Binary + s <- resultStatus result + assertEqual "result status" TuplesOk s + + -- ntuples result >>= info . show + -- nfields result >>= info . show + + null1 <- getisnull result 0 0 + null2 <- getisnull result 0 1 + assertEqual "fst not null" False null1 + assertEqual "snd not null" False null2 + + Just val1 <- getvalue result 0 0 + Just val2 <- getvalue result 0 1 + + assertEqual "fst not null" BS.empty val1 + assertEqual "snd not null" BS.empty val2