[Pkg-owncloud-commits] [owncloud-client] 355/470: Discovery: Be more explicit about files with unknown size #4573

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu May 12 16:25:25 UTC 2016


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 a17f37d8ae8ceb70fb2af35d81f33299eafb9eab
Author: Markus Goetz <markus at woboq.com>
Date:   Mon Apr 18 17:33:25 2016 +0200

    Discovery: Be more explicit about files with unknown size #4573
    
    Also related https://github.com/owncloud/core/issues/23468
---
 csync/src/csync_update.c       | 7 ++++++-
 src/libsync/discoveryphase.cpp | 8 ++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/csync/src/csync_update.c b/csync/src/csync_update.c
index 88cfe02..f5b010e 100644
--- a/csync/src/csync_update.c
+++ b/csync/src/csync_update.c
@@ -309,6 +309,7 @@ static int _csync_detect_update(CSYNC *ctx, const char *file,
                     checksumIdentical = strncmp(st->checksum, tmp->checksum, 1000) == 0;
                 }
                 if (checksumIdentical) {
+                    CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "NOTE: Checksums are identical, file did not actually change: %s", path);
                     st->instruction = CSYNC_INSTRUCTION_NONE;
                     st->should_update_metadata = true;
                     goto out;
@@ -555,7 +556,11 @@ int csync_walker(CSYNC *ctx, const char *file, const csync_vio_file_stat_t *fs,
   switch (flag) {
     case CSYNC_FTW_FLAG_FILE:
       if (ctx->current == REMOTE_REPLICA) {
-        CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s [file_id=%s size=%" PRIu64 "]", file, fs->file_id, fs->size);
+          if (fs->fields & CSYNC_VIO_FILE_STAT_FIELDS_SIZE) {
+              CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s [file_id=%s size=%" PRIu64 "]", file, fs->file_id, fs->size);
+          } else {
+              CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s [file_id=%s size=UNKNOWN]", file, fs->file_id);
+          }
       } else {
           CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s [inode=%" PRIu64 " size=%" PRIu64 "]", file, fs->inode, fs->size);
       }
diff --git a/src/libsync/discoveryphase.cpp b/src/libsync/discoveryphase.cpp
index 29b4c22..c85fe2d 100644
--- a/src/libsync/discoveryphase.cpp
+++ b/src/libsync/discoveryphase.cpp
@@ -258,8 +258,12 @@ static csync_vio_file_stat_t* propertyMapToFileStat(const QMap<QString,QString>
             file_stat->mtime = oc_httpdate_parse(value.toUtf8());
             file_stat->fields |= CSYNC_VIO_FILE_STAT_FIELDS_MTIME;
         } else if (property == "getcontentlength") {
-            file_stat->size = value.toLongLong();
-            file_stat->fields |= CSYNC_VIO_FILE_STAT_FIELDS_SIZE;
+            bool ok = false;
+            qlonglong ll = value.toLongLong(&ok);
+            if (ok && ll >= 0) {
+                file_stat->size = ll;
+                file_stat->fields |= CSYNC_VIO_FILE_STAT_FIELDS_SIZE;
+            }
         } else if (property == "getetag") {
             file_stat->etag = csync_normalize_etag(value.toUtf8());
             file_stat->fields |= CSYNC_VIO_FILE_STAT_FIELDS_ETAG;

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