From 3a94bde135bd461a1f12821a92388fcf51ebe8a6 Mon Sep 17 00:00:00 2001 From: itwrx Date: Sat, 5 Aug 2023 07:24:44 -0500 Subject: [PATCH 1/2] handles spaces in src and dest. bump ver # --- views/app_menu_button.nim | 2 +- views/routine_list.nim | 24 +++++++++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/views/app_menu_button.nim b/views/app_menu_button.nim index 8a9613e..7faa2dd 100644 --- a/views/app_menu_button.nim +++ b/views/app_menu_button.nim @@ -31,7 +31,7 @@ method view(button: AppMenuButtonState): Widget = programName = "EZ-Bkup" logo = "ez_bkup" style = [StyleClass("about-dialog")] - version = "0.9.9" + version = "0.9.10" credits = @{ "Created By": @["https://ITwrx.org"], "License": @["GPLv3"] diff --git a/views/routine_list.nim b/views/routine_list.nim index 9a2b333..b08b176 100644 --- a/views/routine_list.nim +++ b/views/routine_list.nim @@ -51,14 +51,17 @@ proc rsyncThread(list: RoutineListState) {.thread.} = for source in routine.sources: for destination in routine.destinations: #try without requiring superuser privs by default. - rsyncRunCmd = "rsync -aq " & source & " " & destination + #rsyncRunCmd = "rsync -aq " & source & " " & destination + #quote sources and destinations to handle possible spaces. + rsyncRunCmd = "rsync -aq " & "'" & source & "'" & " " & "'" & destination & "'" rsyncRun = execCmdEx(rsyncRunCmd) if rsyncRun.exitCode != 0: #handle permission denied error. if rsyncRun.exitCode == 23: - rsyncRun.exitCode = 0 - #rsyncRunCmd = "SUDO_ASKPASS=" & getAskPassPath() & " sudo -A rsync -aq " & source & " " & destination - rsyncRunCmd = "pkexec rsync -aq " & source & " " & destination + rsyncRun.exitCode = 0 + #rsyncRunCmd = "pkexec rsync -aq " & source & " " & destination + #quote sources and destinations to handle possible spaces. + rsyncRunCmd = "pkexec rsync -aq " & "'" & source & "'" & " " & "'" & destination & "'" rsyncRun = execCmdEx(rsyncRunCmd) if rsyncRun.exitCode != 0: rsyncErrors.add("EZ-Bkup's rsync process(es) returned error (" & $rsyncRun.output & ") while attempting to back up " & source & " to " & destination) @@ -66,15 +69,18 @@ proc rsyncThread(list: RoutineListState) {.thread.} = else: rsyncErrors.add("EZ-Bkup's rsync process(es) returned error (" & $rsyncRun.output & ") while attempting to back up " & source & " to " & destination) #explicitly check that sources were copied to destinations. - #just using file names, mod times, and size (same as bkup run itself). - rsyncCheckCmd = "rsync -rn " & source & " " & destination + #just using file names, mod times, and size (same as bkup run itself). + #quote sources and destinations to handle possible spaces. + #rsyncCheckCmd = "rsync -rn " & source & " " & destination + rsyncCheckCmd = "rsync -rn " & "'" & source & "'" & " " & "'" & destination & "'" rsyncCheckRun = execCmdEx(rsyncCheckCmd) if rsyncCheckRun.exitCode != 0: #handle permission denied error. if rsyncCheckRun.exitCode == 23: - rsyncCheckRun.exitCode = 0 - #rsyncCheckCmd = "SUDO_ASKPASS=" & getAskPassPath() & " sudo -A rsync -rn " & source & " " & destination - rsyncCheckCmd = "pkexec rsync -rn " & source & " " & destination + rsyncCheckRun.exitCode = 0 + #quote sources and destinations to handle possible spaces. + #rsyncCheckCmd = "pkexec rsync -rn " & source & " " & destination + rsyncCheckCmd = "pkexec rsync -rn " & "'" & source & "'" & " " & "'" & destination & "'" rsyncCheckRun = execCmdEx(rsyncCheckCmd) if rsyncCheckRun.exitCode != 0: rsyncErrors.add("EZ-Bkup's rsync process(es) returned error (" & $rsyncRun.output & ") while attempting to verify that " & source & " got backed up to " & destination) From aa5c03e8be28b2100ed0f7ae5f6f39a636a17000 Mon Sep 17 00:00:00 2001 From: itwrx Date: Sat, 5 Aug 2023 07:30:01 -0500 Subject: [PATCH 2/2] clarify status msg when no routines were run. --- views/routine_list.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/routine_list.nim b/views/routine_list.nim index b08b176..301c8f2 100644 --- a/views/routine_list.nim +++ b/views/routine_list.nim @@ -93,7 +93,7 @@ proc rsyncThread(list: RoutineListState) {.thread.} = for err in rsyncErrors: logger.log(lvlError, err) elif routineRunCount == 0: - list.runStatus = "Meh. No Bkup Routines were run." + list.runStatus = "No Bkup Routines were enabled. None were run." else: list.runStatus = "Bkup Complete!"