From 4c68ccb8838ea928681afcb5aa14fb94df691ae5 Mon Sep 17 00:00:00 2001 From: Dustin Falgout <dustin@falgout.us> Date: Fri, 30 Mar 2018 03:24:06 -0500 Subject: [PATCH] Don't try to create temporary database directory if it already exists as doing so triggers exception before the handle is set which causes update check to fail. --- src/alpm_config.vala | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/alpm_config.vala b/src/alpm_config.vala index 016308f9..9b773ee5 100644 --- a/src/alpm_config.vala +++ b/src/alpm_config.vala @@ -140,10 +140,12 @@ public class AlpmConfig { if (tmp_db) { string tmp_dbpath = "/tmp/pamac-checkdbs"; try { - Process.spawn_command_line_sync ("mkdir -p %s/sync".printf (tmp_dbpath)); - Process.spawn_command_line_sync ("ln -sf %slocal %s".printf (dbpath, tmp_dbpath)); - Process.spawn_command_line_sync ("chmod -R 777 %s/sync".printf (tmp_dbpath)); - Process.spawn_command_line_sync ("bash -c 'cp -p %ssync/*.{db,files} %s/sync'".printf (dbpath, tmp_dbpath)); + if (! GLib.FileUtils.test(tmp_dbpath, GLib.FileTest.IS_DIR)) { + Process.spawn_command_line_sync ("mkdir -p %s/sync".printf (tmp_dbpath)); + Process.spawn_command_line_sync ("ln -sf %slocal %s".printf (dbpath, tmp_dbpath)); + Process.spawn_command_line_sync ("chmod -R 777 %s/sync".printf (tmp_dbpath)); + Process.spawn_command_line_sync ("bash -c 'cp -p %ssync/*.{db,files} %s/sync'".printf (dbpath, tmp_dbpath)); + } handle = new Alpm.Handle (rootdir, tmp_dbpath, out error); } catch (SpawnError e) { stderr.printf ("SpawnError: %s\n", e.message); -- GitLab