[Pkg-owncloud-commits] [owncloud-client] 31/120: csync: ignore files/folder for which stat fails

Sandro Knauß hefee-guest at moszumanska.debian.org
Mon Aug 24 00:02:40 UTC 2015


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 9dcce01e543dd26bbe98b3db6bdc881e7cc016dd
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Fri Jul 17 16:48:33 2015 +0200

    csync: ignore files/folder for which stat fails
    
    instead of pretending it suicceed and not recursing in it.
    
    This fixes a bug in which a folder with a too long name would be properly
    created, then removed on the server in the next sync.
    
    (cherry picked from commit 4bbf7669091cde7ec726b1708d8c54427b68f016)
    
    Conflicts:
    	csync/src/csync.h
    	csync/src/csync_exclude.h
    	csync/src/csync_update.c
---
 csync/src/csync.h          |  3 ++-
 csync/src/csync_exclude.h  |  3 ++-
 csync/src/csync_update.c   | 16 ++++++++--------
 src/libsync/syncengine.cpp |  3 +++
 4 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/csync/src/csync.h b/csync/src/csync.h
index 51f8034..712e3f1 100644
--- a/csync/src/csync.h
+++ b/csync/src/csync.h
@@ -101,7 +101,8 @@ enum csync_status_codes_e {
     CSYNC_STATUS_INDIVIDUAL_EXCLUDE_LONG_FILENAME,
     CYSNC_STATUS_FILE_LOCKED_OR_OPEN,
     CSYNC_STATUS_INDIVIDUAL_EXCLUDE_HIDDEN,
-    CSYNC_STATUS_INVALID_CHARACTERS
+    CSYNC_STATUS_INVALID_CHARACTERS,
+    CSYNC_STATUS_INDIVIDUAL_STAT_FAILED
 };
 
 typedef enum csync_status_codes_e CSYNC_STATUS;
diff --git a/csync/src/csync_exclude.h b/csync/src/csync_exclude.h
index 0bdbb6f..bfb8719 100644
--- a/csync/src/csync_exclude.h
+++ b/csync/src/csync_exclude.h
@@ -28,7 +28,8 @@ enum csync_exclude_type_e {
   CSYNC_FILE_EXCLUDE_LIST,
   CSYNC_FILE_EXCLUDE_INVALID_CHAR,
   CSYNC_FILE_EXCLUDE_LONG_FILENAME,
-  CSYNC_FILE_EXCLUDE_HIDDEN
+  CSYNC_FILE_EXCLUDE_HIDDEN,
+  CSYNC_FILE_EXCLUDE_STAT_FAILED
 };
 typedef enum csync_exclude_type_e CSYNC_EXCLUDE_TYPE;
 
diff --git a/csync/src/csync_update.c b/csync/src/csync_update.c
index b5f48df..80dca84 100644
--- a/csync/src/csync_update.c
+++ b/csync/src/csync_update.c
@@ -163,8 +163,12 @@ static int _csync_detect_update(CSYNC *ctx, const char *file,
 
   len = strlen(path);
 
-  /* Check if file is excluded */
-  excluded = csync_excluded(ctx, path,type);
+  if (type == CSYNC_FTW_TYPE_SKIP) {
+      excluded =CSYNC_FILE_EXCLUDE_STAT_FAILED;
+  } else {
+    /* Check if file is excluded */
+    excluded = csync_excluded(ctx, path,type);
+  }
 
   if( excluded == CSYNC_NOT_EXCLUDED ) {
       /* Even if it is not excluded by a pattern, maybe it is to be ignored
@@ -235,12 +239,6 @@ static int _csync_detect_update(CSYNC *ctx, const char *file,
     }
   }
 
-  /* Ignore non statable files and other strange cases. */
-  if (type == CSYNC_FTW_TYPE_SKIP) {
-    st->instruction = CSYNC_INSTRUCTION_NONE;
-    goto out;
-  }
-
   if (excluded > CSYNC_NOT_EXCLUDED || type == CSYNC_FTW_TYPE_SLINK) {
       st->instruction = CSYNC_INSTRUCTION_IGNORE;
       if (ctx->current_fs) {
@@ -433,6 +431,8 @@ out:
               st->error_status = CSYNC_STATUS_INDIVIDUAL_EXCLUDE_LONG_FILENAME; /* File name is too long. */
           } else if (excluded == CSYNC_FILE_EXCLUDE_HIDDEN ) {
               st->error_status = CSYNC_STATUS_INDIVIDUAL_EXCLUDE_HIDDEN;
+          } else if (excluded == CSYNC_FILE_EXCLUDE_STAT_FAILED) {
+              st->error_status = CSYNC_STATUS_INDIVIDUAL_STAT_FAILED;
           }
       }
   }
diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp
index 5d93eb0..dc4a8da 100644
--- a/src/libsync/syncengine.cpp
+++ b/src/libsync/syncengine.cpp
@@ -403,6 +403,9 @@ int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote )
     case CYSNC_STATUS_FILE_LOCKED_OR_OPEN:
         item->_errorString = QLatin1String("File locked"); // don't translate, internal use!
         break;
+    case CSYNC_STATUS_INDIVIDUAL_STAT_FAILED:
+        item._errorString = tr("Stat failed.");
+        break;
     case CSYNC_STATUS_SERVICE_UNAVAILABLE:
         item->_errorString = QLatin1String("Server temporarily unavailable.");
         break;

-- 
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