diff --git a/changelog/unreleased/issue-1786 b/changelog/unreleased/issue-1786 index bdd0d48c3..87d4942c8 100644 --- a/changelog/unreleased/issue-1786 +++ b/changelog/unreleased/issue-1786 @@ -1,6 +1,6 @@ Enhancement: Support repositories with empty password -Restic refused to create or operate on repositories with an emtpy password. +Restic refused to create or operate on repositories with an empty password. Using the new option `--insecure-no-password` it is now possible to disable this check. Restic will not prompt for a password when using this option. For security reasons, the option must always be specified when operating on @@ -10,8 +10,8 @@ Specifying `--insecure-no-password` while also passing a password to restic via a CLI option or via environment variable results in an error. The `init` and `copy` command also support the option `--from-insecure-no-password` -which applies to the source repository. The `key add` and `key passwd` comands -include the `--new-insecure-no-password` option to add or set an emtpy password. +which applies to the source repository. The `key add` and `key passwd` commands +include the `--new-insecure-no-password` option to add or set an empty password. https://github.com/restic/restic/issues/1786 https://github.com/restic/restic/issues/4326 diff --git a/cmd/restic/cmd_forget_integration_test.go b/cmd/restic/cmd_forget_integration_test.go index 06487a841..96dd7c63e 100644 --- a/cmd/restic/cmd_forget_integration_test.go +++ b/cmd/restic/cmd_forget_integration_test.go @@ -54,7 +54,7 @@ func TestRunForgetSafetyNet(t *testing.T) { err = testRunForgetMayFail(env.gopts, ForgetOptions{}) rtest.Assert(t, strings.Contains(err.Error(), `no policy was specified, no snapshots will be removed`), "wrong error message got %v", err) - // `forget --host example --unsafe-allow-remmove-all` should work + // `forget --host example --unsafe-allow-remove-all` should work testRunForget(t, env.gopts, ForgetOptions{ UnsafeAllowRemoveAll: true, GroupBy: restic.SnapshotGroupByOptions{Host: true, Path: true}, diff --git a/cmd/restic/cmd_prune.go b/cmd/restic/cmd_prune.go index 2637fedc8..f0bfa2b94 100644 --- a/cmd/restic/cmd_prune.go +++ b/cmd/restic/cmd_prune.go @@ -51,9 +51,9 @@ type PruneOptions struct { MaxRepackSize string MaxRepackBytes uint64 - RepackCachableOnly bool - RepackSmall bool - RepackUncompressed bool + RepackCacheableOnly bool + RepackSmall bool + RepackUncompressed bool } var pruneOptions PruneOptions @@ -70,7 +70,7 @@ func addPruneOptions(c *cobra.Command, pruneOptions *PruneOptions) { f := c.Flags() f.StringVar(&pruneOptions.MaxUnused, "max-unused", "5%", "tolerate given `limit` of unused data (absolute value in bytes with suffixes k/K, m/M, g/G, t/T, a value in % or the word 'unlimited')") f.StringVar(&pruneOptions.MaxRepackSize, "max-repack-size", "", "maximum `size` to repack (allowed suffixes: k/K, m/M, g/G, t/T)") - f.BoolVar(&pruneOptions.RepackCachableOnly, "repack-cacheable-only", false, "only repack packs which are cacheable") + f.BoolVar(&pruneOptions.RepackCacheableOnly, "repack-cacheable-only", false, "only repack packs which are cacheable") f.BoolVar(&pruneOptions.RepackSmall, "repack-small", false, "repack pack files below 80% of target pack size") f.BoolVar(&pruneOptions.RepackUncompressed, "repack-uncompressed", false, "repack all uncompressed data") } @@ -183,9 +183,9 @@ func runPruneWithRepo(ctx context.Context, opts PruneOptions, gopts GlobalOption MaxUnusedBytes: opts.maxUnusedBytes, MaxRepackBytes: opts.MaxRepackBytes, - RepackCachableOnly: opts.RepackCachableOnly, - RepackSmall: opts.RepackSmall, - RepackUncompressed: opts.RepackUncompressed, + RepackCacheableOnly: opts.RepackCacheableOnly, + RepackSmall: opts.RepackSmall, + RepackUncompressed: opts.RepackUncompressed, } plan, err := repository.PlanPrune(ctx, popts, repo, func(ctx context.Context, repo restic.Repository, usedBlobs restic.FindBlobSet) error { diff --git a/cmd/restic/cmd_prune_integration_test.go b/cmd/restic/cmd_prune_integration_test.go index 19c430716..746eb5cc9 100644 --- a/cmd/restic/cmd_prune_integration_test.go +++ b/cmd/restic/cmd_prune_integration_test.go @@ -51,8 +51,8 @@ func testPruneVariants(t *testing.T, unsafeNoSpaceRecovery bool) { testPrune(t, opts, checkOpts) }) - t.Run("CachableOnly"+suffix, func(t *testing.T) { - opts := PruneOptions{MaxUnused: "5%", RepackCachableOnly: true, unsafeRecovery: unsafeNoSpaceRecovery} + t.Run("CacheableOnly"+suffix, func(t *testing.T) { + opts := PruneOptions{MaxUnused: "5%", RepackCacheableOnly: true, unsafeRecovery: unsafeNoSpaceRecovery} checkOpts := CheckOptions{ReadData: true} testPrune(t, opts, checkOpts) }) diff --git a/cmd/restic/cmd_snapshots.go b/cmd/restic/cmd_snapshots.go index faa86d3a6..f689e4260 100644 --- a/cmd/restic/cmd_snapshots.go +++ b/cmd/restic/cmd_snapshots.go @@ -81,9 +81,9 @@ func runSnapshots(ctx context.Context, opts SnapshotOptions, gopts GlobalOptions if opts.Last { // This branch should be removed in the same time // that --last. - list = FilterLastestSnapshots(list, 1) + list = FilterLatestSnapshots(list, 1) } else if opts.Latest > 0 { - list = FilterLastestSnapshots(list, opts.Latest) + list = FilterLatestSnapshots(list, opts.Latest) } sort.Sort(sort.Reverse(list)) snapshotGroups[k] = list @@ -126,11 +126,11 @@ func newFilterLastSnapshotsKey(sn *restic.Snapshot) filterLastSnapshotsKey { return filterLastSnapshotsKey{sn.Hostname, strings.Join(paths, "|")} } -// FilterLastestSnapshots filters a list of snapshots to only return +// FilterLatestSnapshots filters a list of snapshots to only return // the limit last entries for each hostname and path. If the snapshot // contains multiple paths, they will be joined and treated as one // item. -func FilterLastestSnapshots(list restic.Snapshots, limit int) restic.Snapshots { +func FilterLatestSnapshots(list restic.Snapshots, limit int) restic.Snapshots { // Sort the snapshots so that the newer ones are listed first sort.SliceStable(list, func(i, j int) bool { return list[i].Time.After(list[j].Time) @@ -307,7 +307,7 @@ type Snapshot struct { ShortID string `json:"short_id"` } -// SnapshotGroup helps to print SnaphotGroups as JSON with their GroupReasons included. +// SnapshotGroup helps to print SnapshotGroups as JSON with their GroupReasons included. type SnapshotGroup struct { GroupKey restic.SnapshotGroupKey `json:"group_key"` Snapshots []Snapshot `json:"snapshots"` diff --git a/cmd/restic/lock.go b/cmd/restic/lock.go index 99e199a67..0e3dea6d5 100644 --- a/cmd/restic/lock.go +++ b/cmd/restic/lock.go @@ -34,12 +34,12 @@ func internalOpenWithLocked(ctx context.Context, gopts GlobalOptions, dryRun boo } func openWithReadLock(ctx context.Context, gopts GlobalOptions, noLock bool) (context.Context, *repository.Repository, func(), error) { - // TODO enfore read-only operations once the locking code has moved to the repository + // TODO enforce read-only operations once the locking code has moved to the repository return internalOpenWithLocked(ctx, gopts, noLock, false) } func openWithAppendLock(ctx context.Context, gopts GlobalOptions, dryRun bool) (context.Context, *repository.Repository, func(), error) { - // TODO enfore non-exclusive operations once the locking code has moved to the repository + // TODO enforce non-exclusive operations once the locking code has moved to the repository return internalOpenWithLocked(ctx, gopts, dryRun, false) } diff --git a/doc/030_preparing_a_new_repo.rst b/doc/030_preparing_a_new_repo.rst index 5f3f3ff15..87975f9fa 100644 --- a/doc/030_preparing_a_new_repo.rst +++ b/doc/030_preparing_a_new_repo.rst @@ -873,5 +873,5 @@ with an empty password, use the following command. The ``init`` and ``copy`` command also support the option ``--from-insecure-no-password`` -which applies to the source repository. The ``key add`` and ``key passwd`` comands -include the ``--new-insecure-no-password`` option to add or set and emtpy password. +which applies to the source repository. The ``key add`` and ``key passwd`` commands +include the ``--new-insecure-no-password`` option to add or set and empty password. diff --git a/doc/045_working_with_repos.rst b/doc/045_working_with_repos.rst index 9d6167895..6b9666693 100644 --- a/doc/045_working_with_repos.rst +++ b/doc/045_working_with_repos.rst @@ -135,7 +135,7 @@ as separator. /home/user /home/user/work.txt -To show more details about the files in a snapshot, you can use the ``--long`` option. The colums include +To show more details about the files in a snapshot, you can use the ``--long`` option. The columns include file permissions, UID, GID, file size, modification time and file path. For scripting usage, the ``ls`` command supports the ``--json`` flag; the JSON output format is described at :ref:`ls json`. diff --git a/doc/077_troubleshooting.rst b/doc/077_troubleshooting.rst index f80df29b8..33302e9e0 100644 --- a/doc/077_troubleshooting.rst +++ b/doc/077_troubleshooting.rst @@ -71,7 +71,7 @@ some blobs in the repository, then please ask for help in the forum or our IRC channel. These errors are often caused by hardware problems which **must** be investigated and fixed. Otherwise, the backup will be damaged again and again. -Similarly, if a repository is repeatedly damaged, please open an `issue on Github +Similarly, if a repository is repeatedly damaged, please open an `issue on GitHub `_ as this could indicate a bug somewhere. Please include the check output and additional information that might help locate the problem. @@ -102,7 +102,7 @@ remove data unexpectedly. Please take the time to understand what the commands described in the following do. If you are unsure, then ask for help in the forum or our IRC channel. Search whether your issue is already known and solved. Please take a look at the -`forum`_ and `Github issues `_. +`forum`_ and `GitHub issues `_. 3. Repair the index diff --git a/internal/backend/cache/backend_test.go b/internal/backend/cache/backend_test.go index 0de90471e..7addc275d 100644 --- a/internal/backend/cache/backend_test.go +++ b/internal/backend/cache/backend_test.go @@ -135,7 +135,7 @@ func TestOutOfBoundsAccess(t *testing.T) { // load out of bounds err := wbe.Load(context.TODO(), h, 100, 100, func(rd io.Reader) error { - t.Error("cache returned non-existant file section") + t.Error("cache returned non-existent file section") return errors.New("broken") }) test.Assert(t, strings.Contains(err.Error(), " is too short"), "expected too short error, got %v", err) @@ -147,7 +147,7 @@ func TestOutOfBoundsAccess(t *testing.T) { // start within bounds, but request too large chunk err = wbe.Load(context.TODO(), h, 100, 0, func(rd io.Reader) error { - t.Error("cache returned non-existant file section") + t.Error("cache returned non-existent file section") return errors.New("broken") }) test.Assert(t, strings.Contains(err.Error(), " is too short"), "expected too short error, got %v", err) diff --git a/internal/bloblru/cache_test.go b/internal/bloblru/cache_test.go index b2becd256..d25daf764 100644 --- a/internal/bloblru/cache_test.go +++ b/internal/bloblru/cache_test.go @@ -79,14 +79,14 @@ func TestCacheGetOrCompute(t *testing.T) { return data1, nil }) rtest.OK(t, err) - rtest.Equals(t, &data1[0], &blob[0], "wrong buffer returend") + rtest.Equals(t, &data1[0], &blob[0], "wrong buffer returned") // now the buffer should be returned without calling the compute function blob, err = c.GetOrCompute(id1, func() ([]byte, error) { return nil, e }) rtest.OK(t, err) - rtest.Equals(t, &data1[0], &blob[0], "wrong buffer returend") + rtest.Equals(t, &data1[0], &blob[0], "wrong buffer returned") // check concurrency wg, _ := errgroup.WithContext(context.TODO()) diff --git a/internal/fs/file_unix.go b/internal/fs/file_unix.go index 65f10c844..b562d15b1 100644 --- a/internal/fs/file_unix.go +++ b/internal/fs/file_unix.go @@ -29,7 +29,7 @@ func TempFile(dir, prefix string) (f *os.File, err error) { return f, nil } -// isNotSuported returns true if the error is caused by an unsupported file system feature. +// isNotSupported returns true if the error is caused by an unsupported file system feature. func isNotSupported(err error) bool { if perr, ok := err.(*os.PathError); ok && perr.Err == syscall.ENOTSUP { return true diff --git a/internal/fs/fs_local_vss.go b/internal/fs/fs_local_vss.go index 48ab165f1..718dfc46d 100644 --- a/internal/fs/fs_local_vss.go +++ b/internal/fs/fs_local_vss.go @@ -72,7 +72,7 @@ type LocalVss struct { var _ FS = &LocalVss{} // parseMountPoints try to convert semicolon separated list of mount points -// to map of lowercased volume GUID pathes. Mountpoints already in volume +// to map of lowercased volume GUID paths. Mountpoints already in volume // GUID path format will be validated and normalized. func parseMountPoints(list string, msgError ErrorHandler) (volumes map[string]struct{}) { if list == "" { diff --git a/internal/repository/index/associated_data_test.go b/internal/repository/index/associated_data_test.go index 715e3391a..82dd9908d 100644 --- a/internal/repository/index/associated_data_test.go +++ b/internal/repository/index/associated_data_test.go @@ -128,7 +128,7 @@ func TestAssociatedSetWithExtendedIndex(t *testing.T) { mi.StorePack(blob2.PackID, []restic.Blob{blob2.Blob}) test.OK(t, mi.SaveIndex(context.TODO(), &noopSaver{})) - // non-existant + // non-existent test.Equals(t, false, bs.Has(of)) // set bs.Set(of, 5) diff --git a/internal/repository/index/indexmap_test.go b/internal/repository/index/indexmap_test.go index e0db9cb40..f34e6a1d3 100644 --- a/internal/repository/index/indexmap_test.go +++ b/internal/repository/index/indexmap_test.go @@ -156,7 +156,7 @@ func TestIndexMapFirstIndex(t *testing.T) { for i := 1; i <= 400; i++ { r.Read(id[:]) - rtest.Equals(t, -1, m.firstIndex(id), "wrong firstIndex for nonexistant id") + rtest.Equals(t, -1, m.firstIndex(id), "wrong firstIndex for nonexistent id") m.add(id, 0, 0, 0, 0) idx := m.firstIndex(id) diff --git a/internal/repository/prune.go b/internal/repository/prune.go index b8d3ba97b..d5fdbba07 100644 --- a/internal/repository/prune.go +++ b/internal/repository/prune.go @@ -25,9 +25,9 @@ type PruneOptions struct { MaxUnusedBytes func(used uint64) (unused uint64) // calculates the number of unused bytes after repacking, according to MaxUnused MaxRepackBytes uint64 - RepackCachableOnly bool - RepackSmall bool - RepackUncompressed bool + RepackCacheableOnly bool + RepackSmall bool + RepackUncompressed bool } type PruneStats struct { @@ -381,7 +381,7 @@ func decidePackAction(ctx context.Context, opts PruneOptions, repo *Repository, stats.Blobs.Remove += p.unusedBlobs stats.Size.Remove += p.unusedSize - case opts.RepackCachableOnly && p.tpe == restic.DataBlob: + case opts.RepackCacheableOnly && p.tpe == restic.DataBlob: // if this is a data pack and --repack-cacheable-only is set => keep pack! stats.Packs.Keep++ diff --git a/internal/repository/prune_test.go b/internal/repository/prune_test.go index 17dfafa4e..02eefc463 100644 --- a/internal/repository/prune_test.go +++ b/internal/repository/prune_test.go @@ -80,9 +80,9 @@ func TestPrune(t *testing.T) { { name: "cachableonly", opts: repository.PruneOptions{ - MaxRepackBytes: math.MaxUint64, - MaxUnusedBytes: func(used uint64) (unused uint64) { return used / 20 }, - RepackCachableOnly: true, + MaxRepackBytes: math.MaxUint64, + MaxUnusedBytes: func(used uint64) (unused uint64) { return used / 20 }, + RepackCacheableOnly: true, }, }, { diff --git a/internal/restic/node_windows.go b/internal/restic/node_windows.go index 05dca7cd9..2785e0412 100644 --- a/internal/restic/node_windows.go +++ b/internal/restic/node_windows.go @@ -228,7 +228,7 @@ func (node Node) restoreGenericAttributes(path string, warn func(msg string)) (e return errors.CombineErrors(errs...) } -// genericAttributesToWindowsAttrs converts the generic attributes map to a WindowsAttributes and also returns a string of unkown attributes that it could not convert. +// genericAttributesToWindowsAttrs converts the generic attributes map to a WindowsAttributes and also returns a string of unknown attributes that it could not convert. func genericAttributesToWindowsAttrs(attrs map[GenericAttributeType]json.RawMessage) (windowsAttributes WindowsAttributes, unknownAttribs []GenericAttributeType, err error) { waValue := reflect.ValueOf(&windowsAttributes).Elem() unknownAttribs, err = genericAttributesToOSAttrs(attrs, reflect.TypeOf(windowsAttributes), &waValue, "windows") diff --git a/internal/restic/node_windows_test.go b/internal/restic/node_windows_test.go index 29a42e9e2..4fd57bbb7 100644 --- a/internal/restic/node_windows_test.go +++ b/internal/restic/node_windows_test.go @@ -70,7 +70,7 @@ func getNode(name string, fileType string, genericAttributes map[GenericAttribut func getWindowsAttr(t *testing.T, testPath string, node *Node) WindowsAttributes { windowsAttributes, unknownAttribs, err := genericAttributesToWindowsAttrs(node.GenericAttributes) test.OK(t, errors.Wrapf(err, "Error getting windows attr from generic attr: %s", testPath)) - test.Assert(t, len(unknownAttribs) == 0, "Unkown attribs found: %s for: %s", unknownAttribs, testPath) + test.Assert(t, len(unknownAttribs) == 0, "Unknown attribs found: %s for: %s", unknownAttribs, testPath) return windowsAttributes } @@ -263,7 +263,7 @@ func TestNewGenericAttributeType(t *testing.T) { _, ua, err := genericAttributesToWindowsAttrs(node.GenericAttributes) test.OK(t, err) // Since this GenericAttribute is unknown to this version of the software, it will not get set on the file. - test.Assert(t, len(ua) == 0, "Unkown attributes: %s found for path: %s", ua, testPath) + test.Assert(t, len(ua) == 0, "Unknown attributes: %s found for path: %s", ua, testPath) } } diff --git a/internal/restorer/restorer.go b/internal/restorer/restorer.go index 85132c8b4..a80714fa7 100644 --- a/internal/restorer/restorer.go +++ b/internal/restorer/restorer.go @@ -44,7 +44,7 @@ type OverwriteBehavior int const ( OverwriteAlways OverwriteBehavior = iota // OverwriteIfChanged is like OverwriteAlways except that it skips restoring the content - // of files with matching size&mtime. Metatdata is always restored. + // of files with matching size&mtime. Metadata is always restored. OverwriteIfChanged OverwriteIfNewer OverwriteNever diff --git a/internal/restorer/restorer_test.go b/internal/restorer/restorer_test.go index 3becf7c7a..d70f1f162 100644 --- a/internal/restorer/restorer_test.go +++ b/internal/restorer/restorer_test.go @@ -1162,7 +1162,7 @@ func TestRestoreIfChanged(t *testing.T) { rtest.Equals(t, origData, string(data), "expected original file content") } else { // restore should not have noticed the changed file content - rtest.Equals(t, modData, string(data), "expeced modified file content") + rtest.Equals(t, modData, string(data), "expected modified file content") } } } diff --git a/internal/restorer/restorer_unix_test.go b/internal/restorer/restorer_unix_test.go index 9523440cf..59048e908 100644 --- a/internal/restorer/restorer_unix_test.go +++ b/internal/restorer/restorer_unix_test.go @@ -18,7 +18,7 @@ import ( restoreui "github.com/restic/restic/internal/ui/restore" ) -func TestRestorerRestoreEmptyHardlinkedFileds(t *testing.T) { +func TestRestorerRestoreEmptyHardlinkedFields(t *testing.T) { repo := repository.TestRepository(t) sn, _ := saveSnapshot(t, repo, Snapshot{ diff --git a/internal/restorer/restorer_windows_test.go b/internal/restorer/restorer_windows_test.go index 90ece474d..61d075061 100644 --- a/internal/restorer/restorer_windows_test.go +++ b/internal/restorer/restorer_windows_test.go @@ -356,29 +356,29 @@ func verifyFileAttributes(t *testing.T, mainFilePath string, attr FileAttributes rtest.OK(t, err) //Test positive and negative scenarios if attr.ReadOnly { - rtest.Assert(t, fileAttributes&windows.FILE_ATTRIBUTE_READONLY != 0, "Expected read only attibute.") + rtest.Assert(t, fileAttributes&windows.FILE_ATTRIBUTE_READONLY != 0, "Expected read only attribute.") } else { - rtest.Assert(t, fileAttributes&windows.FILE_ATTRIBUTE_READONLY == 0, "Unexpected read only attibute.") + rtest.Assert(t, fileAttributes&windows.FILE_ATTRIBUTE_READONLY == 0, "Unexpected read only attribute.") } if attr.Hidden { - rtest.Assert(t, fileAttributes&windows.FILE_ATTRIBUTE_HIDDEN != 0, "Expected hidden attibute.") + rtest.Assert(t, fileAttributes&windows.FILE_ATTRIBUTE_HIDDEN != 0, "Expected hidden attribute.") } else { - rtest.Assert(t, fileAttributes&windows.FILE_ATTRIBUTE_HIDDEN == 0, "Unexpected hidden attibute.") + rtest.Assert(t, fileAttributes&windows.FILE_ATTRIBUTE_HIDDEN == 0, "Unexpected hidden attribute.") } if attr.System { - rtest.Assert(t, fileAttributes&windows.FILE_ATTRIBUTE_SYSTEM != 0, "Expected system attibute.") + rtest.Assert(t, fileAttributes&windows.FILE_ATTRIBUTE_SYSTEM != 0, "Expected system attribute.") } else { - rtest.Assert(t, fileAttributes&windows.FILE_ATTRIBUTE_SYSTEM == 0, "Unexpected system attibute.") + rtest.Assert(t, fileAttributes&windows.FILE_ATTRIBUTE_SYSTEM == 0, "Unexpected system attribute.") } if attr.Archive { - rtest.Assert(t, fileAttributes&windows.FILE_ATTRIBUTE_ARCHIVE != 0, "Expected archive attibute.") + rtest.Assert(t, fileAttributes&windows.FILE_ATTRIBUTE_ARCHIVE != 0, "Expected archive attribute.") } else { - rtest.Assert(t, fileAttributes&windows.FILE_ATTRIBUTE_ARCHIVE == 0, "Unexpected archive attibute.") + rtest.Assert(t, fileAttributes&windows.FILE_ATTRIBUTE_ARCHIVE == 0, "Unexpected archive attribute.") } if attr.Encrypted { - rtest.Assert(t, fileAttributes&windows.FILE_ATTRIBUTE_ENCRYPTED != 0, "Expected encrypted attibute.") + rtest.Assert(t, fileAttributes&windows.FILE_ATTRIBUTE_ENCRYPTED != 0, "Expected encrypted attribute.") } else { - rtest.Assert(t, fileAttributes&windows.FILE_ATTRIBUTE_ENCRYPTED == 0, "Unexpected encrypted attibute.") + rtest.Assert(t, fileAttributes&windows.FILE_ATTRIBUTE_ENCRYPTED == 0, "Unexpected encrypted attribute.") } }