From 9d71858c598e6ccaf260fef3d1e90c1e3ea44775 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 6 Oct 2016 16:57:18 -0400 Subject: Check if --store-local directory is writable. If run with --totalshares larger than the number of servers, and the --store-local directory is not writable, this causes keysafe to throw out the unwritable directory and so error out early due to their not being enough storage locations. That's better than the old behavior, which was to try to use the --store-local directory, fail and so proceed to storing the share on a server. That would eventually fail with "no storage locations" when it runs out of servers. That was bad, because shares were uploaded to servers, but perhaps not enough for restore to work, and a new name/othername would be needed to re-run the backup. This is not a perfect fix; if the --store-local directory is writable at first but for some reason the write of the share to it later fails, the situation described above still happens. This commit was sponsored by Jochen Bartl on Patreon. --- CmdLine.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'CmdLine.hs') diff --git a/CmdLine.hs b/CmdLine.hs index ef593a2..77914f8 100644 --- a/CmdLine.hs +++ b/CmdLine.hs @@ -27,7 +27,7 @@ data CmdLine = CmdLine , customShareParams :: Maybe ShareParams , name :: Maybe Name , othername :: Maybe Name - , preferredStorage :: [Maybe LocalStorageDirectory -> Storage] + , preferredStorage :: [Maybe LocalStorageDirectory -> IO (Maybe Storage)] , serverConfig :: ServerConfig , chaffMaxDelay :: Maybe Seconds } -- cgit v1.2.3