[Pkg-owncloud-commits] [owncloud-client] 01/70: Fix some possible "Precondition Failed" bug

Sandro Knauß hefee-guest at moszumanska.debian.org
Tue Jul 1 10:21:17 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 13f9970257afe0f4e3d9da6c1cc0203a6be57a9c
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Tue Jun 3 11:14:07 2014 +0200

    Fix some possible "Precondition Failed" bug
    
    The problem was if there was a false conflict: the file has been touched
    both on the server and the client.
     - etag has changed on the server
     - mtime has changed on the server and the client and is the same
     - and file size is the same on both the server and the client
    
    This may also happen if the file is uploaded on the server, but the client
    looses connection (or crashes) before it get notified of the etag.
    
    In both tree, the instruction is EVAL, but we reduce it to a NONE because
    we detected that the conflict is 'false'.  Still, we need to update the db
    with the new etag.  (_should_update_db)
    The problem was that we would set the flag on the wrong tree.
    This was not a problem when the file was NEW on both side since  we checked
    for null etag and used the other one then.
---
 csync/src/csync_reconcile.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/csync/src/csync_reconcile.c b/csync/src/csync_reconcile.c
index 8cddd0a..140117b 100644
--- a/csync/src/csync_reconcile.c
+++ b/csync/src/csync_reconcile.c
@@ -249,8 +249,12 @@ static int _csync_merge_algorithm_visitor(void *obj, void *data) {
                     cur->instruction = CSYNC_INSTRUCTION_NONE;
                     other->instruction = CSYNC_INSTRUCTION_NONE;
 
-                    if( !cur->etag && other->etag ) cur->etag = c_strdup(other->etag);
-                    cur->should_update_etag = true; /* update DB */
+                    /* update DB with new etag from remote */
+                    if (ctx->current == LOCAL_REPLICA) {
+                        other->should_update_etag = true;
+                    } else {
+                        cur->should_update_etag = true;
+                    }
                 } else if(ctx->current == REMOTE_REPLICA) {
                         cur->instruction = CSYNC_INSTRUCTION_CONFLICT;
                         other->instruction = CSYNC_INSTRUCTION_NONE;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list