pqi-native 1.0.1.7 → 1.0.1.8
raw patch · 3 files changed
+16/−9 lines, 3 filesdep ~pqi-conformancePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: pqi-conformance
API changes (from Hackage documentation)
Files
- CHANGELOG.md +6/−0
- pqi-native.cabal +2/−2
- src/library/Pqi/Native/Connection.hs +8/−7
CHANGELOG.md view
@@ -1,3 +1,9 @@+# v1.0.1.8++## Fixes++- Fixed `connectFailureMessage` (used when the initial `connect(2)` fails, e.g. a missing Unix-socket directory) hand-rolling a TCP-shaped message - the raw `Show`n `IOException` prefixed with `"could not connect to server: "` and a `(Unix domain socket '<path>')` parenthetical appended - instead of reporting the failure the way libpq does. That hand-rolled text retained the literal prefix `"could not connect to server: "`, which is also the substring `Hasql.Connection`'s error classifier matches to identify a transient networking failure - so a permanent misconfiguration (missing socket directory) was misclassified as transient. The Unix-socket branch now delegates to `unixSocketFailureMessage`, extracting the underlying `IOException`'s `ioe_description` (the raw OS `strerror` text, e.g. `"No such file or directory"`) instead of embedding its whole `Show`n form, and appending the same `"Is the server running locally and accepting connections on that socket?"` hint libpq appends for this failure - matching libpq's message for this case byte-for-byte. Also fixed `unixSocketFailureMessage` itself quoting the socket path with single quotes (`'<path>'`) instead of libpq's double quotes (`"<path>"`), which affects every message it formats, including the handshake-rejection path this Unix-socket branch now shares. Caught by the `pqi-conformance` spec `Pqi.Conformance.Operation.Connectdb.MissingUnixSocketDirectory`. Found via `hasql` issue #329.+ # v1.0.1.7 ## Fixes
pqi-native.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: pqi-native-version: 1.0.1.7+version: 1.0.1.8 category: Database, PostgreSQL synopsis: Native (pure-Haskell) adapter for pqi description:@@ -158,5 +158,5 @@ build-depends: base >=4.11 && <5, hspec >=2.11 && <2.12,- pqi-conformance ^>=1.0.7,+ pqi-conformance ^>=1.0.8, pqi-native,
src/library/Pqi/Native/Connection.hs view
@@ -23,6 +23,7 @@ import qualified Data.Map.Strict as Map import qualified Data.Sequence as Seq import qualified Data.Set as Set+import GHC.IO.Exception (ioe_description) import Pqi (ConnStatus (..), Notify (..), PipelineStatus (..), Verbosity (..)) import qualified Pqi.Native.Auth as Auth import Pqi.Native.Prelude@@ -360,11 +361,11 @@ connectFailureMessage :: ConnInfo -> IOException -> ByteString connectFailureMessage connInfo err | Transport.isUnixSocketHost (host connInfo) =- "could not connect to server: "- <> ByteString.Char8.pack (show err)- <> " (Unix domain socket '"- <> ByteString.Char8.pack (Transport.unixSocketPath (host connInfo) (port connInfo))- <> "')"+ unixSocketFailureMessage+ connInfo+ ( ByteString.Char8.pack (ioe_description err)+ <> "\n\tIs the server running locally and accepting connections on that socket?\n"+ ) | otherwise = "could not connect to server: " <> ByteString.Char8.pack (show err) -- | Format a handshake-time 'IOException' - e.g. the server closing the@@ -391,9 +392,9 @@ -- host\/port pair, matching libpq's phrasing. unixSocketFailureMessage :: ConnInfo -> ByteString -> ByteString unixSocketFailureMessage connInfo fmtFields =- "connection to server on socket '"+ "connection to server on socket \"" <> ByteString.Char8.pack (Transport.unixSocketPath (host connInfo) (port connInfo))- <> "' failed: "+ <> "\" failed: " <> fmtFields -- | The handshake-failure message for a TCP connection: includes the