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.
This commit is contained in:
Christian Kamm 2016-04-28 12:43:06 +02:00
parent e7f00339e6
commit 68126dcff6
3 changed files with 9 additions and 4 deletions

View file

@ -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);

View file

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

View file

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