From cabfee51f6985f57e0b5904e53ec1c9ed90e7fe1 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin Date: Wed, 23 Oct 2024 12:04:15 +0100 Subject: [PATCH] log file name in fixFileSize --- src/Simplex/Messaging/Server/MsgStore/Journal.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Simplex/Messaging/Server/MsgStore/Journal.hs b/src/Simplex/Messaging/Server/MsgStore/Journal.hs index 9cdfa653a..6c7fc954a 100644 --- a/src/Simplex/Messaging/Server/MsgStore/Journal.hs +++ b/src/Simplex/Messaging/Server/MsgStore/Journal.hs @@ -496,11 +496,13 @@ fixFileSize h pos = do size <- IO.hFileSize h if | size > pos' -> do - logWarn $ "STORE: fixFileSize, file is bigger - truncating, from " <> tshow size <> " to " <> tshow pos + name <- IO.hShow h + logWarn $ "STORE: fixFileSize, file size " <> tshow size <> " is bigger than position " <> tshow pos <> " - truncating, " <> T.pack name IO.hSetFileSize h pos' - | size < pos' -> + | size < pos' -> do -- From code logic this can't happen. - E.throwIO $ userError $ "fixFileSize, file is smaller, size " <> show size <> " position " <> show pos + name <- IO.hShow h + E.throwIO $ userError $ "fixFileSize, file size " <> show size <> " is smaller than position " <> show pos <> " - aborting, " <> name | otherwise -> pure () removeJournal :: FilePath -> JournalState t -> IO ()