[Pkg-owncloud-commits] [owncloud-client] 420/470: Checksums: Skip uploads of .eml files only #4754
Sandro Knauß
hefee-guest at moszumanska.debian.org
Thu May 12 16:25:36 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 68126dcff60276543871046630c2b9cb29340c89
Author: Christian Kamm <mail at ckamm.de>
Date: Thu Apr 28 12:43:06 2016 +0200
Checksums: Skip uploads of .eml files only #4754
This is a workaround. A correct solution would still update file metadata
such as the mtime. See #4755.
---
csync/src/csync_misc.h | 1 +
csync/src/csync_update.c | 5 ++++-
csync/tests/ownCloud/t9.pl | 7 ++++---
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/csync/src/csync_misc.h b/csync/src/csync_misc.h
index 2769cbc..783ef4d 100644
--- a/csync/src/csync_misc.h
+++ b/csync/src/csync_misc.h
@@ -33,6 +33,7 @@
* than fmmatch anyway, which does not care for flags.
**/
#define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */
+#define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */
#endif
int csync_fnmatch(__const char *__pattern, __const char *__name, int __flags);
diff --git a/csync/src/csync_update.c b/csync/src/csync_update.c
index f5b010e..f579bde 100644
--- a/csync/src/csync_update.c
+++ b/csync/src/csync_update.c
@@ -297,7 +297,10 @@ static int _csync_detect_update(CSYNC *ctx, const char *file,
// zero size in statedb can happen during migration
|| (tmp->size != 0 && fs->size != tmp->size))) {
- if (fs->size == tmp->size && tmp->checksumTypeId) {
+ // Checksum comparison at this stage is only enabled for .eml files,
+ // check #4754 #4755
+ bool isEmlFile = csync_fnmatch("*.eml", file, FNM_CASEFOLD) == 0;
+ if (isEmlFile && fs->size == tmp->size && tmp->checksumTypeId) {
if (ctx->callbacks.checksum_hook) {
st->checksum = ctx->callbacks.checksum_hook(
file, tmp->checksumTypeId,
diff --git a/csync/tests/ownCloud/t9.pl b/csync/tests/ownCloud/t9.pl
index adb655d..1fb7389 100755
--- a/csync/tests/ownCloud/t9.pl
+++ b/csync/tests/ownCloud/t9.pl
@@ -59,11 +59,12 @@ my $emlpropafter = remoteFileProp("", "test.eml");
assert($txtpropafter);
assert($emlpropafter);
-# The both files were not uploaded, nothing differs
-assert($txtpropafter->get_property( "getetag" ) eq
+# The txt file is uploaded normally, etag and mtime differ
+assert($txtpropafter->get_property( "getetag" ) ne
$txtpropbefore->get_property( "getetag" ));
-assert($txtpropafter->get_property( "getlastmodified" ) eq
+assert($txtpropafter->get_property( "getlastmodified" ) ne
$txtpropbefore->get_property( "getlastmodified" ));
+# The eml was not uploaded, nothing differs
assert($emlpropafter->get_property( "getetag" ) eq
$emlpropbefore->get_property( "getetag" ));
assert($emlpropafter->get_property( "getlastmodified" ) eq
--
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