2
2
mirror of https://github.com/octoleo/restic.git synced 2024-06-01 00:20:48 +00:00
restic/cmd/restic
Sébastien Gross f7587be28f mount: detect mountpoint does not exist before opening the repository
Bug #1681 suggests that restic should not be nice to user and should
refrain from creating a mountpoint if it does not exist. Nevertheless,
it currently opens the repository before checking for the mountpoint's
existence. In the case of large or remote repositories, this process
can be time-consuming, delaying the inevitable outcome.

    /restic mount --repo=REMOTE --verbose /tmp/backup
    repository 33f14e42 opened (version 2, compression level max)
    [0:38] 100.00%  162 / 162 index files loaded
    Mountpoint /tmp/backup doesn't exist
    stat /tmp/backup: no such file or directory

    real	0m39.534s
    user	1m53.961s
    sys	0m3.044s

In this scenario, 40 seconds could have been saved if the nonexistence
of the path had been verified beforehand.

This patch relocates the mountpoint check to the beginning of the
runMount function, preceding the opening of the repository.

    /restic mount --repo=REMOTE --verbose /tmp/backup
    Mountpoint /tmp/backup doesn't exist
    stat /tmp/backup: no such file or directory

    real	0m0.136s
    user	0m0.018s
    sys	0m0.027s

Signed-off-by: Sébastien Gross <seb•ɑƬ•chezwam•ɖɵʈ•org>
2023-12-24 11:54:18 +01:00
..
testdata copy: test that trees with unstable json encoding are properly copied 2021-03-08 22:16:48 +01:00
.gitignore Moves files 2017-07-23 14:19:13 +02:00
cleanup.go Print stacktrace in SIGINT handler if RESTIC_DEBUG_STACKTRACE_SIGINT set 2023-04-23 15:50:40 +02:00
cmd_backup_integration_test.go restic-from-command: use standard behavior when no output and exit code 0 from command 2023-10-27 23:58:51 +02:00
cmd_backup_test.go test: Use testing.T.Cleanup to remove tempdirs 2022-12-09 14:23:55 +01:00
cmd_backup.go backup: rework error reporting for subcommand 2023-10-27 23:58:52 +02:00
cmd_cache.go always access stdout/stderr via globalOptions 2023-05-26 19:38:44 +02:00
cmd_cat_test.go cat: extract parameter validation and add a test 2023-08-13 19:17:46 +02:00
cmd_cat.go convert MemorizeList to be repository based 2023-10-25 23:01:35 +02:00
cmd_check_integration_test.go test: add helper to capture stdout for integration tests 2023-05-26 19:38:44 +02:00
cmd_check_test.go Fix typos 2023-12-06 13:11:55 +01:00
cmd_check.go Fix typos 2023-12-06 13:11:55 +01:00
cmd_copy_integration_test.go Restructure integration tests 2023-05-26 19:38:43 +02:00
cmd_copy.go convert MemorizeList to be repository based 2023-10-25 23:01:35 +02:00
cmd_debug.go Fix typos 2023-12-06 13:11:55 +01:00
cmd_diff_integration_test.go always access stdout/stderr via globalOptions 2023-05-26 19:38:44 +02:00
cmd_diff.go convert MemorizeList to be repository based 2023-10-25 23:01:35 +02:00
cmd_dump_test.go dump: Add test for splitPath 2020-08-30 16:00:48 +02:00
cmd_dump.go convert MemorizeList to be repository based 2023-10-25 23:01:35 +02:00
cmd_find_integration_test.go read JSON/Quiet flag from the passed in globalOptions 2023-05-26 19:38:44 +02:00
cmd_find.go convert MemorizeList to be repository based 2023-10-25 23:01:35 +02:00
cmd_forget_integration_test.go Restructure integration tests 2023-05-26 19:38:43 +02:00
cmd_forget_test.go forget: simplify test 2023-07-28 19:21:40 +02:00
cmd_forget.go convert MemorizeList to be repository based 2023-10-25 23:01:35 +02:00
cmd_generate.go init/generate: check that no parameters are passed 2023-05-18 21:17:53 +02:00
cmd_init_integration_test.go Restructure integration tests 2023-05-26 19:38:43 +02:00
cmd_init.go Fix repository not being printed when using repository file 2023-12-23 13:49:22 +01:00
cmd_key_integration_test.go move Backend interface to backend package 2023-10-25 23:00:18 +02:00
cmd_key.go convert MemorizeList to be repository based 2023-10-25 23:01:35 +02:00
cmd_list_integration_test.go test: add helper to capture stdout for integration tests 2023-05-26 19:38:44 +02:00
cmd_list.go convert MemorizeList to be repository based 2023-10-25 23:01:35 +02:00
cmd_ls_integration_test.go read JSON/Quiet flag from the passed in globalOptions 2023-05-26 19:38:44 +02:00
cmd_ls_test.go Add file mode in symbolic notation to ls --json 2021-11-16 19:45:50 +02:00
cmd_ls.go convert MemorizeList to be repository based 2023-10-25 23:01:35 +02:00
cmd_migrate.go Add a global option --retry-lock 2023-04-07 16:24:14 +02:00
cmd_mount_integration_test.go Restructure integration tests 2023-05-26 19:38:43 +02:00
cmd_mount.go mount: detect mountpoint does not exist before opening the repository 2023-12-24 11:54:18 +01:00
cmd_options.go Some options fixes 2020-12-23 23:26:04 +03:00
cmd_prune_integration_test.go move Backend interface to backend package 2023-10-25 23:00:18 +02:00
cmd_prune.go Fix typos 2023-12-06 13:11:55 +01:00
cmd_recover.go convert MemorizeList to be repository based 2023-10-25 23:01:35 +02:00
cmd_repair_index_integration_test.go move Backend interface to backend package 2023-10-25 23:00:18 +02:00
cmd_repair_index.go convert MemorizeList to be repository based 2023-10-25 23:01:35 +02:00
cmd_repair_packs.go move Backend interface to backend package 2023-10-25 23:00:18 +02:00
cmd_repair_snapshots_integration_test.go Restructure integration tests 2023-05-26 19:38:43 +02:00
cmd_repair_snapshots.go convert MemorizeList to be repository based 2023-10-25 23:01:35 +02:00
cmd_repair.go Rename 'rebuild-index' to 'repair index' 2023-05-01 15:16:44 +02:00
cmd_restore_integration_test.go restore: pass termStatus to restore in tests 2023-06-09 12:03:33 +02:00
cmd_restore.go convert MemorizeList to be repository based 2023-10-25 23:01:35 +02:00
cmd_rewrite_integration_test.go Restructure integration tests 2023-05-26 19:38:43 +02:00
cmd_rewrite.go convert MemorizeList to be repository based 2023-10-25 23:01:35 +02:00
cmd_self_update.go Reinstate selfupdate tag to make builds without self-update work 2022-12-26 21:46:22 +04:00
cmd_snapshots_integration_test.go read JSON/Quiet flag from the passed in globalOptions 2023-05-26 19:38:44 +02:00
cmd_snapshots_test.go Add more error checks 2021-01-30 20:02:37 +01:00
cmd_snapshots.go Fix typos 2023-12-06 13:11:55 +01:00
cmd_stats_test.go stats: Add debug mode to collect repository statistics 2023-07-08 23:04:47 +02:00
cmd_stats.go stats: fix hardlink tracking in a snapshot 2023-10-27 23:40:42 +02:00
cmd_tag_integration_test.go Restructure integration tests 2023-05-26 19:38:43 +02:00
cmd_tag.go convert MemorizeList to be repository based 2023-10-25 23:01:35 +02:00
cmd_unlock.go pass global context through cobra 2022-10-03 00:19:46 +02:00
cmd_version.go Split go_target into go_os and go_arch 2023-11-01 22:43:38 +01:00
delete.go move Backend interface to backend package 2023-10-25 23:00:18 +02:00
doc.go Moves files 2017-07-23 14:19:13 +02:00
exclude_test.go cmd, ui: Move size parsing code and make it more robust 2023-07-02 21:44:50 +02:00
exclude.go cmd, ui: Move size parsing code and make it more robust 2023-07-02 21:44:50 +02:00
find.go convert MemorizeList to be repository based 2023-10-25 23:01:35 +02:00
flags_test.go Replace most usages of ioutil with the underlying function 2022-12-02 19:36:43 +01:00
format_test.go Make formatNode test timezone independent 2023-06-08 19:18:30 +02:00
format.go Refactor formatNode 2023-06-08 19:12:49 +02:00
global_debug.go Allow cleanup handlers to filter the exit code 2022-08-26 23:04:59 +02:00
global_release.go add go:build headers everywhere 2022-03-28 22:23:47 +02:00
global_test.go test: add helper to capture stdout for integration tests 2023-05-26 19:38:44 +02:00
global.go Fix typos 2023-12-06 13:11:55 +01:00
integration_filter_pattern_test.go Remove unused context or testing parameters 2023-05-18 21:17:53 +02:00
integration_helpers_test.go CI: update golangci-lint 2023-12-23 13:41:30 +01:00
integration_helpers_unix_test.go Replace usages of ioutil.ReadDir 2022-12-02 19:54:27 +01:00
integration_helpers_windows_test.go Replace usages of ioutil.ReadDir 2022-12-02 19:54:27 +01:00
integration_test.go convert MemorizeList to be repository based 2023-10-25 23:01:35 +02:00
lock_test.go move Backend interface to backend package 2023-10-25 23:00:18 +02:00
lock.go move Backend interface to backend package 2023-10-25 23:00:18 +02:00
main.go don't load password when autocompleting CLI commands 2023-10-23 21:44:22 +02:00
progress.go Only show index progress bar if stdout is a terminal 2023-10-23 21:16:52 +02:00
secondary_repo_test.go test: Use testing.T.Cleanup to remove tempdirs 2022-12-09 14:23:55 +01:00
secondary_repo.go Do not include the actual values of environment variables in help output 2022-08-26 20:39:54 +02:00