Skip to content

bisync: add overlapping paths check - #7515

Merged
nielash merged 2 commits into
rclone:masterfrom
nielash:bisync-overlap-check
Jan 20, 2024
Merged

nielash merged 2 commits into
rclone:masterfrom
nielash:bisync-overlap-check

Conversation

@nielash

@nielash nielash commented Dec 18, 2023 •

Copy link
Copy Markdown
Contributor

(This PR is dependent on #7410, #7497, #7498, and #7501 -- only 1 commit is new 🙂 )

What is the purpose of this change?

Before this change, Bisync did not check to make sure that Path1 and Path2 do not overlap, nor did it check for overlaps with --backup-dir. While sync does check for these things, it can sometimes be fooled because of the way Bisync calls it with --files-from filters. Relying on sync could also leave a run in a half-finished state if it were to error in one direction but not the other (--backup-dir only checks for overlaps with the dest.)

After this change, Bisync does its own check up front, so we can quickly return an error and exit before any changes are made.

Was the change discussed in an issue or in the forum before?

Checklist

  • I have read the contribution guidelines.
  • I have added tests for all changes in this PR if appropriate.
  • I have added documentation for the changes if appropriate.
  • All commit messages are in house style.
  • I'm done, this Pull Request is ready for review :-)

@ncw ncw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice :-)

Before this change, Bisync did not check to make sure that Path1 and Path2 do
not overlap, nor did it check for overlaps with `--backup-dir`. While `sync`
does check for these things, it can sometimes be fooled because of the way
Bisync calls it with `--files-from` filters. Relying on sync could also leave a
run in a half-finished state if it were to error in one direction but not the
other (`--backup-dir` only checks for overlaps with the dest.)

After this change, Bisync does its own check up front, so we can quickly return
an error and exit before any changes are made.
Before this change, certain shell quoting / escaping errors (particularly on
Windows) were not detected by Bisync, possibly resulting in incorrect expansion
and confusing errors. In particular, Windows paths with a single trailing
backslash followed by a quote would be interpreted as an escaped quote --
resulting in the quote and subsequent flags being erroneously considered part
of the path.

After this change, Bisync specifically checks for a few of the most common
patterns, and if detected, exits with a more helpful error message before doing
any damage.
@nielash
nielash force-pushed the bisync-overlap-check branch from 0aece34 to 2a58207 Compare January 20, 2024 21:33
@nielash
nielash merged commit d031cc1 into rclone:master Jan 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

bisync: trailing slash in local path arg on Windows causes error

2 participants