[Pkg-owncloud-commits] [owncloud-client] 315/498: csync_update: Handling hidden files as excluded files, as intended.

Sandro Knauß hefee-guest at moszumanska.debian.org
Tue Aug 11 14:49:02 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 7aa2b5082870f808952dabd3799e48fa85885dbb
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Wed Jul 8 18:06:38 2015 +0200

    csync_update: Handling hidden files as excluded files, as intended.
---
 csync/src/csync.h          |  3 ++-
 csync/src/csync_exclude.h  |  3 ++-
 csync/src/csync_update.c   | 42 ++++++++++++++++++++++--------------------
 src/libsync/syncengine.cpp |  3 +++
 4 files changed, 29 insertions(+), 22 deletions(-)

diff --git a/csync/src/csync.h b/csync/src/csync.h
index d710c17..97eb981 100644
--- a/csync/src/csync.h
+++ b/csync/src/csync.h
@@ -103,7 +103,8 @@ enum csync_status_codes_e {
     CSYNC_STATUS_INDIVIDUAL_IGNORE_LIST,
     CSYNC_STATUS_INDIVIDUAL_IS_INVALID_CHARS,
     CSYNC_STATUS_INDIVIDUAL_EXCLUDE_LONG_FILENAME,
-    CYSNC_STATUS_FILE_LOCKED_OR_OPEN
+    CYSNC_STATUS_FILE_LOCKED_OR_OPEN,
+    CSYNC_STATUS_INDIVIDUAL_EXCLUDE_HIDDEN
 };
 
 typedef enum csync_status_codes_e CSYNC_STATUS;
diff --git a/csync/src/csync_exclude.h b/csync/src/csync_exclude.h
index 329d957..0bdbb6f 100644
--- a/csync/src/csync_exclude.h
+++ b/csync/src/csync_exclude.h
@@ -27,7 +27,8 @@ enum csync_exclude_type_e {
   CSYNC_FILE_EXCLUDE_AND_REMOVE,
   CSYNC_FILE_EXCLUDE_LIST,
   CSYNC_FILE_EXCLUDE_INVALID_CHAR,
-  CSYNC_FILE_EXCLUDE_LONG_FILENAME
+  CSYNC_FILE_EXCLUDE_LONG_FILENAME,
+  CSYNC_FILE_EXCLUDE_HIDDEN
 };
 typedef enum csync_exclude_type_e CSYNC_EXCLUDE_TYPE;
 
diff --git a/csync/src/csync_update.c b/csync/src/csync_update.c
index 4274467..2db4b28 100644
--- a/csync/src/csync_update.c
+++ b/csync/src/csync_update.c
@@ -163,29 +163,29 @@ static int _csync_detect_update(CSYNC *ctx, const char *file,
 
   len = strlen(path);
 
-  /* This code should probably be in csync_exclude, but it does not have the fs parameter.
-     Keep it here for now and TODO also find out if we want this for Windows
-     https://github.com/owncloud/mirall/issues/2086 */
-  if (fs->flags & CSYNC_VIO_FILE_FLAGS_HIDDEN) {
-      CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file excluded because it is a hidden file: %s", path);
-      return 0;
-  }
-
   /* Check if file is excluded */
   excluded = csync_excluded(ctx, path,type);
 
   if (excluded != CSYNC_NOT_EXCLUDED) {
-    CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "%s excluded  (%d)", path, excluded);
-    if (excluded == CSYNC_FILE_EXCLUDE_AND_REMOVE) {
-        return 1;
-    }
-    if (excluded == CSYNC_FILE_SILENTLY_EXCLUDED) {
-        return 1;
-    }
+      CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "%s excluded  (%d)", path, excluded);
+      if (excluded == CSYNC_FILE_EXCLUDE_AND_REMOVE) {
+          return 1;
+      }
+      if (excluded == CSYNC_FILE_SILENTLY_EXCLUDED) {
+          return 1;
+      }
 
-    if (ctx->current_fs) {
-        ctx->current_fs->has_ignored_files = true;
-    }
+      if (ctx->current_fs) {
+          ctx->current_fs->has_ignored_files = true;
+      }
+  } else {
+
+      /* This code should probably be in csync_exclude, but it does not have the fs parameter.
+         Keep it here for now */
+      if (fs->flags & CSYNC_VIO_FILE_FLAGS_HIDDEN) {
+          CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file excluded because it is a hidden file: %s", path);
+          excluded = CSYNC_FILE_EXCLUDE_HIDDEN;
+      }
   }
 
   if (ctx->current == REMOTE_REPLICA && ctx->callbacks.checkSelectiveSyncBlackListHook) {
@@ -208,9 +208,9 @@ static int _csync_detect_update(CSYNC *ctx, const char *file,
   st->child_modified = 0;
   st->has_ignored_files = 0;
 
-  /* check hardlink count */
+  /* FIXME: Under which conditions are the following two ifs true and the code
+   * is executed? */
   if (type == CSYNC_FTW_TYPE_FILE ) {
-
     if (fs->mtime == 0) {
       CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s - mtime is zero!", path);
 
@@ -424,6 +424,8 @@ out:
       st->error_status = CSYNC_STATUS_INDIVIDUAL_IS_INVALID_CHARS;  /* File contains invalid characters. */
     } else if (excluded == CSYNC_FILE_EXCLUDE_LONG_FILENAME) {
       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;
     }
   }
   if (st->instruction != CSYNC_INSTRUCTION_NONE && st->instruction != CSYNC_INSTRUCTION_IGNORE
diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp
index dba2a47..2ceb6c1 100644
--- a/src/libsync/syncengine.cpp
+++ b/src/libsync/syncengine.cpp
@@ -376,6 +376,9 @@ int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote )
     case CSYNC_STATUS_INDIVIDUAL_EXCLUDE_LONG_FILENAME:
         item->_errorString = tr("Filename is too long.");
         break;
+    case CSYNC_STATUS_INDIVIDUAL_EXCLUDE_HIDDEN:
+        item->_errorString = tr("File is ignored because it's hidden.");
+        break;
     case CYSNC_STATUS_FILE_LOCKED_OR_OPEN:
         item->_errorString = QLatin1String("File locked"); // don't translate, internal use!
         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