Skip to content

bisync: auto-resolve conflicts #7471

Closed

Description

@nielash

This is a proposal for a new bisync feature to optionally auto-resolve sync conflicts (and customize bisync's change detection behavior more generally), inspired in part by discussions with @crocinsocks on #7332 and #5681.

What problem are you are trying to solve?

Currently, when a file is new/changed on both paths (relative to the prior sync), and the versions on each side are not identical, bisync will keep both versions, renaming them with ..path1 and ..path2 suffixes, respectively. Many users have requested more control over how bisync handles such conflicts -- including an option to automatically select one version as the "winner" and rename or delete the "loser".

Similarly, users have requested more control over how conflicting files are handled during --resync. Currently the path1 version prevails by default, but users have requested options to automatically select the winner based on characteristics such as newer, older, larger, and smaller.

Some users have additionally requested the ability to use the above-described auto-resolve features as an alternative to needing --resync at all. In other words, in an error scenario where bisync would otherwise demand a manual --resync to recover, this option would tell bisync to automatically run a --resync and auto-resolve any conflicts according to the rules described above. Such an option would maximize resilience at the possible expense of perfection (for example, deleted files could occasionally re-appear.) Because bisync takes an approach of "safe by default", such an option would be disabled by default, but made available to advanced users via a new flag.

How do you think rclone should be changed to solve that?

I propose the following new options:

--auto-resolve CHOICE     Automatically resolve conflicts by preferring the version that is: 
                            newer | older | larger | smaller | path1 | path2 (default: none)
--conflict-loser CHOICE   When --auto-resolve selects a winner, do this to the loser:
                            delete | num | pathname (default: num)

For example, suppose there is a sync conflict of file and the version on Path1 is newer.

  • With --auto-resolve newer, path2/file is renamed to path2/file..conflict1 (or, if that already exists, path2/file..conflict2, etc.) and copied to path1, and path1/file is copied to path2 (without renaming).
  • If --conflict-loser pathname is added, path2 version is renamed to path2/file..path2 instead of path2/file..conflict1 (overwriting any path2/file..path2 that already exists.)
  • If --conflict-loser delete is added, path2 version is deleted instead of renamed.

Options specific to --resync:

--resync-prefer OPTION    During --resync only, prefer the version that is: newer | older | larger | smaller | path1 | path2 (default: path1)
--auto-resync             If set, automatically run --resync to recover after critical errors. WARNING: only use if you are SURE you know what you are doing! (default: false)
--max-lock DURATION       Consider lock files older than this to be "expired" (default: 1d if --auto-resync=true, otherwise 0 (never expire))

--resync-prefer and --auto-resync can be used together, and either one can also be used without the other.

--max-lock is a compromise necessary to balance --auto-resync with lock files. Otherwise, if --auto-resync always respected lock files, a single interrupted run would break --auto-resync forever. But if --auto-resync always ignored lock files, it could start resyncing while a prior non-resync is still running. The implementation of --max-lock could possibly include a mechanism for alive runs to renew themselves periodically, to determine with more certainty whether a lock file was left by an interrupted run or one that is still running, just taking awhile.

Note that the newer and older options require modtime support for both paths, and will be ignored if either remote lacks modtimes (or if the user has requested to ignore them with --checksum or --size-only.)

An open question is what should happen when a winner can't be determined by the requested method. For example: --auto-resolve newer where the sizes differ but modtimes are identical. Probably the easiest would be to revert to the current behavior (keep both, do ..path1 / ..path2 rename), but I am open to other ideas!

Further thoughts

Bisync users tend to fall into one of two camps:

  • User A demands perfection every time. If Bisync is ever unsure of what to do, User A would prefer that Bisync stop and ask for help rather than take its best guess and continue.
  • User B wants to "set it and forget it", and values resilience above perfection. Often this user is syncing something like a movie collection which could be easily re-downloaded from the internet or backups if necessary, so total perfection isn't required, and sync conflicts may not be worth the time to resolve. User B prefers that Bisync take its best guess and continue, rather than stopping to bother them every time it has a question, or worse -- refusing to run again until it gets an answer.

Bisync in its current form is a great fit for User A, and likely to cause a bit of frustration to User B. The features discussed above are aimed at making both camps happy -- it is User A's way by default, but User B can make it behave their way by adding flags.

Fellow bisync users, feel free to comment here with any thoughts on the above! I'd love to consider any and all feedback before developing a proof-of-concept (which I hope to do shortly.)

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Activity

  1. added this to the Soon milestone on Nov 29, 2023
  2. self-assigned this
    on Nov 29, 2023
  3. nielash commented on Dec 1, 2023

    @nielash
    ContributorAuthor

    Thank you as always for making me challenge my assumptions! 😄 I agree with a lot of what you've said here. Some responses below:

    Flag names should be named based of relation to others as it gets very confusing otherwise so I have renamed the flags below.

    Agree, and I like many of your suggestions. Allowing a customizable --conflict-name is a great idea (though I wonder if something like --conflict-suffix might be clearer? And more rclonic given --suffix?)

    I like pairing --conflict-winner and --conflict-loser, but do you think it might be confusing that one refers to a comparison method and the other refers to an action?

    What would your proposed --conflict-loser prevent do? Skip conflicts and leave the sides un-identical at the end of the sync? We would need to carefully think through how to deal with that during --check-sync... (would probably need to trigger rollback in perpetuity until the conflict is externally resolved, and even so, it would get wiped if there were ever a --resync.)

    I'm not sure that --conflict-shortname is necessary, as you could just achieve the same result with --conflict-name c, no?

    I like the idea of --resync OPTION (with --resync alone implying --resync path1), however --resync is currently a bool and this would require converting it to string, which could possibly break people's scripts if they've been using --resync=true or --resync=false (for some reason). I would also need to check if it breaks anything with the -1 shorthand. But it may be worth doing even so... I agree it's best not to have 2 flags when you can have 1.

    2. you write:

    User A demands perfection every time. If Bisync is ever unsure of what to do, User A would prefer that Bisync stop and ask for help rather than take its best guess and continue.

    And then suggest this is how bisync currently works. However, this is not the case bisync currently renames files rather than stopping and erroring and does this with a completely random naming scenario e.g. .path1, .path2.

    I see what you're getting at, but I don't actually think it's a contradiction (nor is the naming random). There is no "guessing" involved in Bisync's current renaming behavior -- it refuses to pick winners and losers and instead keeps BOTH versions and renames them symmetrically, giving neither one preference over the other (in fact, this refusal to pick winners/losers is your chief complaint about it, right?). The use of the pathname means you could theoretically "undo" this rename later (not that most people probably do.) But this "Further Thoughts" section was mainly referring to the --auto-resync idea -- naturally, User A will think it's an abomination, while User B will think the lack of it is an abomination. 😄

    This is fundamentally flawed as per my previous comments as .path1, .path2 is meaningless in a multi-user, multi-pc setup, the very nature of bisync and I believe should be changed entirely to conflict1, conflict2 as default.

    I think the concept of .path1 must be removed in its entirety due to points previously mentioned.

    I'm not totally following what you mean here... how is ".path1" unsafe but ".conflict1" is not?

    I get your point about multi-user / multi-pc, but I think "meaningless" is an overstatement -- suppose you have a star topology where Path1 is always the cloud and Path2 is always the local machine... this naming convention tells you that ..path1 came from the cloud and ..path2 came from a user's machine (even if you don't know exactly which user). If instead it's file and file..conflict1, there's no way to tell which came from which (although your proposed --conflict-name potentially offers a way around this, which I like.)

    Anyway, regardless of what we think of ..path1 / ..path2, it has been a feature for 2+ years now and so I am not sure we can just get rid of it, for backward compatibility reasons. I do think you make a compelling case that the default should be changed -- but I think pathname should at least be available as a non-default legacy option.

    This would also mean losing conflicts get automatically renamed conflict1, conflict2 and so on by default and there is no winner. Same as now but without the issues from point 2.

    Just to make sure I'm following -- you mean that with the default (equivalent to --conflict-winner none --conflict-loser num), instead of file and file..conflict1 we get file..conflict1 and file..conflict2, correct? (Essentially, both sides are losers?) Also, if file..conflict2 were to then have another conflict (probably unlikely, but we need to think about it), we'd get file..conflict2..conflict1 and file..conflict2..conflict2, correct? (whereas with --conflict-winner newer we could eventually get file..conflict3, file..conflict4, and so on.)

    Also, do you think we should lpad with some number of zeroes to make sure that file..conflict9 alphabetically sorts before file..conflict10? Or don't worry about it?

    And regarding the --conflict-name (or --conflict-suffix), should the .. be part of the customizable suffix, or hard-coded? Should we try to implement --suffix-keep-extension?

    I know I initially pushed for an --resync-auto due to the resync being required too much however after conversations and more time I think this feature is inherently useless and dangerous and so it may be best to avoid such a design. After both filters and exits (#7470) are handled I do not really seem a use case for --resync-auto as this should never be required short of listing being missing when --resilient flag used.

    I think I may need to give this more thought. I agree with you that --auto-resync is probably not something I'd ever use myself, nor do I think it's advisable generally, however for some reason it really is a request I see over and over on the forums (it's not just you)... and there are in fact some alternative sync tools that tout their lack of --resync as a feature, not a bug. I've even seen users code their own scripts to automatically run a --resync when Exit Code > 0. So I am trying to channel the "You Are Not the User" mantra and remain open-minded to the fact that some users really do seem to want this, no matter how ill-advised I may personally find it. It is hard to tell sometimes whether there's something I'm missing about their use case, or something they're missing about why they do not actually want what they think they want.

    Your point about exits is a good one, and it may be worth seeing how close to perfection we can get (particularly with recovering from ungraceful shutdowns) before making a decision about --auto-resync. I actually think that --conflict-winner newer could significantly mitigate that one edge-case I was concerned about in the "diff from last trusted listing" method. I agree that if we can recover perfectly, --auto-resync is probably moot. But if it's only "pretty good most of the time", I wonder if some users will still prefer --auto-resync due to the perceived safety of erring on the side of not-deleting (despite my total agreement with you that "no deletes" != "non-destructive").

    For filter changes, I would prefer something like an error stating please choose a --resync-filters (if not already present) option rather than succumb to a global --resync-auto flag and should only apply to the changes in filters rather than resyncing all filters again.

    My current thought on this is that --force would be a more appropriate flag than --resync for committing session changes, or perhaps we need a new flag. I agree that using --resync as a catch-all is too heavy-handed.

    FYI it is not just filters but other kinds of flags as well. For example, flags like --ignore-case-sync, --size-only, and --drive-skip-gdocs can all have surprising consequences if added/removed without a --resync.

    Lock files I think should be handled in another thread and completely separate to any of this work.

    The problem is... --auto-resync and lock files go hand-in-hand -- we can't really implement --auto-resync without making some kind of change to lock files. (Same is kind of true for your exits ticket.) But we can table this for now until we revisit the --auto-resync discussion.

    Personally, when local it should work on the basis of checking if current processID is running and is the same command (same being bisync path1 path2 e.g. flags ignored) using some form of regex. This mechanism can be expanded to handle a time based mechanism when/if remote --workdir are implemented.

    Not to go too far down this rabbit-hole, since we already discussed this at length 😅, but -- even if we accept your (very good) arguments about why the rest of the --workdir should remain local, lock files are the one thing that would benefit most from being remote, to prevent race conditions between machines. So I'm not sure it makes sense to go to all the trouble of building PID-related logic that we already know we'll just have to remove. It's also possible that there could be issues with checking PIDs on some platforms and that the time-based dead-man's-switch option could be more robust in those cases, even on local.

  4. nielash commented on Dec 4, 2023

    @nielash
    ContributorAuthor

    I don't think due to the reasons above the old code for conflict resolution should be kept as I can't see anyone complaining about the old being removed when they can just add there own conflict suffix for both path1 and path2.

    So, I think you have convinced me that the default should be changed to --conflict-loser num, and the remaining question is only whether --conflict-loser pathname should stick around as a non-default option or be removed. I think that the thing I have not done a good job articulating is that file..path1 / file..path2 is reversible in a way that file / file.conflict1 is not, at least in a single-user environment (and bisync has plenty of single-users.) For example, suppose you want to restore path1 to the way it was before bisync renamed things -- you could write a simple script to find all *..path2 files and delete, then find all *..path1 files and rename to trim the ..path1 suffix. This is possible with pathname but not with num, as you don't know which side it came from. So, it is possible that there are some users who rely on this naming convention for this reason, and I could imagine them being unhappy if it's taken away. I think keeping it as a non-default legacy option makes everyone happy, and does not in any way disadvantage the users who choose not to use it. There are tons of rclone flags that are irrelevant to me -- I just ignore them and use the ones I want 🙂

    Definitely, agree with --conflict-suffix. Though, I would wonder whether it is actually a prefix because this is the name before a numbering but also is placed at the end of the file ergo suffix. I leave that one to you to decide.

    The same thought occurred to me, but I can't think of anything clearer. So I'm leaning towards --conflict-suffix (and clarify any confusion in the docs.) (After all, --suffix-keep-extension is not strictly a "suffix" either.)

    I am not sure that --conflict-method helps us, as --conflict-winner and --conflict-loser would still refer to different things. It just makes 3 flags for what could have been achieved with 2.

    So, I think it is between this:

    --conflict-winner CHOICE
    --conflict-loser CHOICE
    --conflict-suffix STRING[,STRING]
    

    or maybe this:

    --auto-resolve CHOICE
    --conflict-loser CHOICE
    --conflict-suffix STRING[,STRING]
    

    I think prevent should be disregarded for now, but worth revisiting in the future if users are asking for it. (And if so, I think skip might be a clearer name for it.)

    There is also that it would not work with --conflict-suffix path1, path2 (as a default) as you would in essence get path11, path21 or if you handle suffix ending with numbers path1-1, path2-1.

    I was thinking that if you wanted to keep the old behavior, you would do --conflict-suffix path --conflict-loser pathname. So file becomes:

    file..path1
    file..path2
    

    And then if file..path1 itself has another conflict (unlikely), you get:

    file..path1..path1
    file..path1..path2
    file..path2
    

    which is the same as what happens now. (Remember that if you want to keep the current behavior, there is no "winner" -- instead it's essentially two "losers".)

    You could do the same with a different suffix, like --conflict-suffix side:

    file..side1..side1
    file..side1..side2
    file..side2
    

    and probably we would automatically omit the digits when two strings are provided, like --conflict-suffix cloud,user:

    file..cloud..cloud
    file..cloud..user
    file..user
    

    Which makes --conflict-suffix path behave exactly the same as --conflict-suffix path1,path2.

    Meanwhile for your desired behavior, you would do --conflict-winner newer --conflict-suffix c to get:

    file
    file..c1
    file..c2
    

    The line of thinking of using a shortname in the first place is that I have file names that only just fit on the remote so adding .conflictX would cause issues

    This is a good point, and honestly it's another reason that users could be upset about being forced to change from path to conflict...

    incase this is something that should automated when the name is too long?

    I worry that automating it could be problematic for users whose conflict-resolution workflows depend on having one consistent string they can search for. In my example above, it would have been harder to find and correct all the ..path1s if half of them are .p1. I think the best solution is to let the user pick the --conflict-suffix, and they can choose a short one if filename length is an issue.

    no I don't think so for --suffix-keep-extension though I guess thats subjective just I don't think I've seen that else where (?) and arguably one should resolve the conflict before using the file.

    I think the idea is that many systems determine the MIME Type by looking at the extension, so file.conflict1.jpg will be recognized as an image while file.jpg.conflict1 will be an unreadable text file. (Resolving conflicts would probably be easier if you could preview the content...) I may look into whether it can be supported without too much trouble.

    Though, do we really need ..conflict1 why not just .conflict1 (/.conflict1.conflict1) ? Is there an advantage I am missing?

    To the double-dot instead of a single-dot? No advantage that I'm aware of, other than that bisync has always used the double-dot and it's possible that it could break people's scripts if we change it. Perhaps the best compromise is to hard-code just one dot (or none?) and let people do --conflict-suffix .path if they want the double.

    I agree with auto-resync, filter+other resyncs, lockfiles and think this should be separated into a new thread/issue and discussed there, perhaps three threads. Especially as once exits and the above is handled views my change on this. At least in my head there is still much to discuss on these and would also allow the above/rest (resync & conflicts) to be implemented sooner rather than seeing this as an all-in-one upgrade/issue.

    Happy to discuss on separate threads, but when features are closely related (as these ones are), I do think it can be helpful to think a few steps ahead before diving in -- so that feature1 can be built the right way from the start, and we don't have to totally redo it when feature2 comes along. Exits depends on lock files and auto-resync depends on both. So I think once you've had a chance to try my proposed lock files change on #7470 let's talk about it there, and #5678 is the place to discuss decoupling filter changes from --resync. Feel free to create a new issue for --auto-resync if you wish, or I'm also fine continuing to discuss it here. (FWIW it's one of the easiest changes from a technical perspective -- maybe even just 4 lines of code. The bigger question is whether it's advisable.)

    One thing with lockfiles on the remote is it would seem not really practical or viable in a many user setup as users would not be able to sync there files (!/?) as it would be pure luck/chance who gets there turn to sync.. I get there are certain race condition though these are limited, expected of any bisync and can't be worked around as these are more technical limitations; I would argue this is more how a user should use such a tool rather than locking the remote.

    Firstly just to be clear, there are two different proposed changes to lock files: 1.) allowing them to expire, and 2.) allowing them to live on non-local remotes. You are focusing on issue 2, but really it's issue 1 that is the blocking issue for recovery and --auto-resync.

    Secondly, even if proposed change 2 were adopted, no one would be forced to use it. Each user could choose to use their own local lock file, exactly as they do today.

    Thirdly, I think there are some possible solutions to what you're describing, like perhaps some sort of central ledger to ensure a round-robin rotation. But even if there's not a good solution, I don't think that's a reason to just not worry about race conditions. There are always trade-offs, and different users have different priorities. You may prioritize more frequent syncs even if it means more race conditions, but other users may prioritize avoiding race conditions, even if it means less frequent syncs. Very much the User A / User B divide again. User B will see conflicts as just the inevitable cost of concurrent syncing, and User A will see mutual exclusion as just the inevitable cost of data integrity. They are both right 🙂 And I think bisync can make them both happy by allowing each user to choose which option is right for them.

  5. nielash commented on Dec 6, 2023

    @nielash
    ContributorAuthor

    I still don't really understand the use of pathname in --conflict-loser? I can't see why anyone would want only one conflict for a file

    This suggests to me that I still have not succeeded in articulating this concept:

    file..path1 / file..path2 is reversible in a way that file / file.conflict1 is not

    and until we're on the same page about that, I fear we have a bit of a "Chesterton's Fence" scenario, where the assertion that the feature should be removed comes without a full grasp of why it is there.

    Even in a single user environment we are still talking multiple machines otherwise copy/sync should be used.

    Why? There are many users who use Bisync to synchronize two local paths, or one machine with one cloud storage service (where changes can be made directly on either side -- such as via the browser UI.) copy/sync does not cover those scenarios.

    I think the use case described here with ..path1, ..path2 and scripts seems like a workaround for the options --conflict-winner path1(/path2) and --conflict-loser delete as they are currently not available.

    I don't think it is. There are some users who will want to manually review each sync conflict and decide how to resolve it. Think of it like a git merge conflict -- sometimes it's as simple as keeping one version and discarding the other, but sometimes the fix is more complicated -- like keeping a combination of both. The "User A" types will take issue with the "automatic" part, as the winners may not always follow one consistent pattern, like being from the same side, and even when they are, it can't be predicted in advance which side that will be. I think you are assuming that once these auto-resolve features are available, everyone will want to use them -- and I don't think that is true. My guess is most will, but a significant minority will prefer to resolve any conflicts manually.

    What about --conflict-resolve instead of --conflict-winner - I think I like this and also use this later? Then perhaps --conflict-resolve-fallback or --conflict-resolve-secondary

    I like --conflict-resolve. I think the others are too long, and --conflict-loser is fine if there is no --conflict-winner to confuse it with.

    Now lets say there is a conflict of the file again in the legacy way this would overwrite the already existing conflicts (dangerous and you would lose work!)

    I see what you're getting at, but I think it assumes a false inference, as once file is renamed file..path1 and file..path2, there is no more file. That is -- a second conflict can only occur if the user has chosen not to resolve the first conflict. The overwrite behavior is consistent with how rclone's --backup-dir works:

    If there is a file with the same path (after the suffix has been added) in DIR, then it will be overwritten.
    

    which is why many users choose to include a dated suffix like --suffix -2019-01-01.

    Remember that in "User A"'s philosophy, a conflict is not supposed to happen -- and when it does happen, the conflicts must be resolved -- not left there forever while more conflicts are created. (I also fully understand why "User B" would prefer the convenience of letting file.conflict48, file.conflict49, etc. build up to be dealt with later or possibly never. They are both valid preferences -- just fundamentally incompatible with each other.)

    where it really should end up with the following: (where c1, c2 are from the first conflict and c3,c4 are from the second)

    file.conflict1
    file.conflict2
    file.conflict3
    file.conflict4
    

    What I think this overlooks is that there is no way to tell in this scenario which side file.conflict3 came from, so it is not reversible, for the users who care about that. Which is not me saying this option shouldn't exist -- it should! But I disagree that it should be the only option.

    personally, I would force users away from this paradox and dangerous behaviour even though I know that might cause some upset in the short run.

    I also think if you do this it should be done via --conflict-resolve legacy and will ultimately ignore the rest of these flags

    Naming it "legacy" says to me "if we were starting over today, we would just remove this", and I don't think that's actually what this is. I think it's a valid option that serves an unfilled need for a minority of users -- but just shouldn't be the default.

    The thing to keep remembering is that two users with different preferences will often both think their way is "right" and that all other users should be forced to use it. The maintainer's job is to balance the needs of all users, which sometimes conflict (no pun intended). Often that means making both options available. This becomes untenable if users start saying "it's not enough for me to get my option, I also need the other guy's option removed." As I said, there are a number of rclone flags that make me think "I can't imagine why anyone would possibly want that", but I ignore them and move on, knowing that some users probably feel the same way about flags I find essential for some unusual reason 🙂

    would be better than adding --conflict-loser pathname as this is already handled with suffix

    I think what you're saying is that --conflict-loser pathname is unnecessary because it is already implied by --conflict-suffix path1,path2, right? I think the issue with this is that if there is no pathname then users are forced to use --conflict-loser num, so if I want (say) --conflict-resolve newer --conflict-suffix path1,path2 then I end up with:

    file
    file.path11
    file.path12
    file.path21
    file.path22
    file.path23
    

    with no way to disable the auto-numbering. So essentially, --conflict-loser pathname is a way to say "do not auto-number, keep only the most recent conflict". But I agree this probably wouldn't come up too much, as most users who want pathname would probably also want --conflict-winner none. And others might choose to add a hyphen/underscore, like --conflict--suffix path1_,path2_

    I think .. is simply another seemed good at the time but really should have never been implemented.

    I tend to agree, although I think rather than adding another flag, the most efficient way to handle this is to say it's one dot by default, and if you want more dots you can simply add them into your --conflict-suffix. I don't see how that in any way harms users who choose to stick with the default.

    Whilst I agree that recovery and auto resync rely on lockfiles its implementation should have no effect on how these are coded as it should simply call the same isLocked function. I think others may also be more likely to get involved with lock files functionality if it was on its own thread and think it is very much worthy of one. If you do not agree will layout some thoughts re lockfiles on #7470.

    I'm not sure if I follow what you mean about the function. Which thread we use is not terribly important to me (feel free to start a new one if you prefer), but I do think that a prerequisite for further lock files discussion should be you trying out the --max-lock implementation I put forward on #7470, which I think is quite good.

  6. nielash commented on Dec 10, 2023

    @nielash
    ContributorAuthor

    you were specifically talking about a user not manually resolving but using a script to automatically rename and the method I suggested would do so in the way I believe you intend

    The script example was about reversing, which is different from resolving. Reversing means undoing whatever mess bisync may have made, with the goal of reverting both paths back to how they were the moment before bisync ran. This still leaves you with conflicts, which is why it's not resolving. But it matters from User A's perspective because an irreversible change is inherently more destructive than a reversible one.

    1. It is paradoxical to assign any meaning to any side of conflict resolution in a bi-synchronous environment bar specific and unique client ids

    It's possible I'm misunderstanding what you mean, but no -- I don't think it's paradoxical. Suppose I'm a single user with one bisync run, where Path1 is Google Drive and Path2 is my local computer. Path1 and Path2 have clear meanings to me in this case. When I see file..path1, I know it was the Google Drive side of the conflict. When I see file..path2, I know it was the local computer side of the conflict. It's helpful info for me to have when deciding which version to keep.

    2. With -cr none -cl num -cs conflict there is no difference in meaning -cr none -cl num -cs path (unless the code randomly assign the number)

    I agree that whether the suffix is "path" or "conflict" doesn't make much difference. But I disagree that an auto-numbering system is as reversible as the legacy behavior. I think your point is that we can deduce that 3 must be Path1 because it is odd, and 4 must be Path2 because it is even? That makes a lot of assumptions -- like that the files were always renamed in the same order, and that none were ever deleted. All it would take is one missing file somewhere to break the pattern for all subsequent files.

    1. That in the legacy conflict mechanism it is more than possible for both file and file..path1 and file..path2 to exist and there for it will be destructive if another conflict of file happens

    Agree that it's possible, disagree that it's a major concern. The scenario you describe requires another process to intervene and create a secondary conflict. Users can of course have all kinds of processes on their machines that cause chaos to their files -- at a certain point, that's on them, and not something we can control. And I'm not sure how your solution improves that -- doesn't file still get overwritten with -cr newer (in your scenario where it is open during the sync and re-saved after)? If the behavior of overwriting a prior suffixed conflict is destructive, then by definition, do you also think --backup-dir is destructive?

    4. That there are really three types of user for conflict resolution:

    A - Do nothing and ask user 
    B - Handle conflict and always keep losers (safe)
    C - Handle conflict and delete or overwrite losers (destructive)
    

    Mostly agree, but I think the "safe" and "destructive" characterizations are too simplistic. Does B keep the losers in a reversible or irreversible way? Does C delete the losers always, or only if the user has allowed a secondary conflict to occur, without resolving the first conflict?

    Here is how I tend to think of it instead:

    A - Do not pick winners and losers -- either stop and ask user or take some action that user could undo later (like move files out of the way *reversibly*)
    B - Use best efforts to pick a winner, and either delete or irreversibly rename the loser
    

    I think part of the reason we may be talking past each other is because you are treating "keep" and "delete" as synonymous with "safe" and "destructive". Suppose that some malware program randomly renames every file on your computer without changing the contents -- do you consider this "safe" simply because no files have been deleted?

    Now, consider another program that does nearly the same thing, except it's a filename encryption program and you hold the decryption key. The reversibility makes a difference, no? This is why I am more focused on reversible vs. irreversible -- not all "changes" are bad, and not all "keeps" are good.

    What bisync's legacy behavior aims to do is move the conflicts out of the way in a way that the user can later revert, should they choose. Akin to encrypting a filename and giving the user a decryption key (which yes, is still a "change", but a harmless one).

    5. That only the sync exiting with an error code and listing the errors with something like '-cr skip' (or interactive prompt -cr ask) is the only way to be UserA?

    Partially agree. I think there probably are some User A types who would see this as the only acceptable solution. But other User A types who would find the legacy behavior acceptable. Not all User As are exactly the same. I would note that in the original Bisync docs, this is how it is described:

    Safety measures

    • Lock file prevents multiple simultaneous runs when taking a while. This can be particularly useful if bisync is run by cron scheduler.
    • Handle change conflicts non-destructively by creating ..path1 and ..path2 file versions.
    1. That -cr none -cl num -cs conflict & -cr newer -cl num -cs conflict are both UserB?

    Agree.

    7. That the legacy way of handling conflicts is inherently UserC?

    Disagree, because of the way it's worded. This more accurately describes -cr newer -cl delete. The legacy way does not "handle" conflicts (it more refuses to handle them), it does not delete, and it is not inherently destructive. I do understand why you see it that way -- because you are focusing on a possible scenario where a secondary conflict overwrites an unresolved prior conflict, and I agree that is theoretically possible, but I guess I see that more as preventable user error that is out of scope for bisync to worry about. What I will say is that if you have suggestions for how to better handle this scenario in bisync, I am all ears and happy to consider improvements.

    8. That you could get similar behaviour to legacy by setting a flag such as -cr none -cl overwrite -cs path (or .path for ..)

    Agree, given the way you've defined "overwrite", although I don't think "overwrite" is an accurate label for the legacy behavior. Again, nothing is overwritten under normal circumstances. The scenario you're focusing on requires a secondary conflict to occur before the original conflict is resolved. It is "overwrite" only in the same sense that --backup-dir is "overwrite". Is it perfect and totally robust to all kinds of edge cases? No. But I do think it is pretty good, and better (for this particular goal) than any alternatives I've seen suggested in this thread.

    1. That just because -cr none -cl num -cs conflict renames both files that does not imply that the user has been informed of this action.

    Agree. But it would be quite easy to identify them with, for example:

    rclone lsl remotename --include "*.conflict*"
    

    Personally I have a script that runs weekly and emails me a report of such issues, and I suspect that more serious User A types run it more frequently than that.

    1. That because you can't gain any meaning with .path1/.path2 (if you agree with the relevant points above) that doing so creates a false sense of security and could mislead users?

    Disagree with the premise -- as I said in number 1, I think it's quite possible to gain meaning from ..path1/..path2. When you say false sense of security, do you mean because of the secondary conflict overwrite scenario? If so, perhaps adding a note to the docs would help, similar to the one --backup-dir has? I'm a little confused because on the one hand you seem concerned that the legacy behavior isn't safe enough, but on the other hand you are saying it is too safe, to the point of being useless, and you are advocating removing it and forcing all users to use a far less cautious / reversible method.

    Here are my two questions for you in return:

    1. Let's assume for the purposes of these questions that we agree that the legacy behavior is utterly pointless, very likely destructive, should never have been released, and anyone still wanting to use such an option must not be very smart. Do you agree that it does not harm you personally if it continues to exist as a non-default flag that you will never be forced to use?

    2. Do you agree that it is ever acceptable to develop/maintain an optional feature because other users want it, even if you personally find their use of it to be misguided or ill-advised?

  7. 5 remaining items

  8. nielash commented on Jan 9, 2024

    @nielash
    ContributorAuthor

    Hi @martind69, I have posted a preview here -- feel free to try it if you like and let me know if you have feedback. It includes my proposed implementation of the conflict-resolve features discussed on this ticket, and also many other fixes that are not yet in the latest official rclone beta.

    Please consider to accept --retries* with bisync!

    One of my proposed commits does exactly this 🙂 nielash@f1109f1
    Note that it requires using --resilient, the default is --retries 3, and --retries-sleep is not yet implemented (but it would be easy to add this -- do you want to open a new issue for this?)

    Given what you described, I think you may also be interested in the --recover feature proposed on #7501. I would recommend trying it with something like:

    --resilient --recover --max-lock 2m --conflict-resolve newer
    

    and --resync-mode newer (only when resyncing.)

    I would probably suggest not using --conflict-loser delete right away, until you have used --conflict-resolve newer for a little while and are comfortable with how it works and you are sure that deleting the loser is what you want. I also highly suggest using --backup-dir1 and --backup-dir2 if you are going to use --conflict-loser delete.

    Let me know how it works for you if you give it a try 🙂

  9. added a commit that references this issue on Jan 20, 2024
    3816d85
  10. added a commit that references this issue on Jan 23, 2024
    f70a4c6
  11. added a commit that references this issue on Jan 26, 2024
    68f0998
  12. moved this to Done in bisyncon Aug 20, 2024
  13. Goudrons commented on Dec 26, 2025

    @Goudrons

    Is this feature finally released?

  14. martind69 commented on Dec 26, 2025

    @martind69

    Is this feature finally released?

    Please read before asking questions. See issue Nr. 7529

  15. Goudrons commented on Dec 26, 2025

    @Goudrons

    Don't forget that there are also newbies on GitHub who are not trained computer scientists. If beginners are not welcome here and are dismissed with snide remarks, then I'll be gone in a flash. Do you really think I didn't search before asking a question? You seem to assume that I did. A link to the relevant section and an explanation of where to find it would have had a completely different, less unpleasant effect.
    But thanks anyway.

  16. nielash commented on Dec 26, 2025

    @nielash
    ContributorAuthor

    Yes, this feature was released in 2023. #7529

    Here is a link to the relevant section of the docs: https://rclone.org/bisync/#conflict-resolve

  17. Goudrons commented on Dec 27, 2025

    @Goudrons

    Thank you nielash, i‘ll give it a try

  18. added a commit that references this issue on Jul 20, 2026
    ce386bf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

  • Status
    Done

Relationships

None yet

Development

No branches or pull requests

Issue actions