# HG changeset patch # User Olaf Wintermann # Date 1565439903 -7200 # Node ID e72d2b99b0f63a9a863e064ce1a1d293c6553513 # Parent f6072141f5ee08afa3ea148c4206a2ef389c8eda fix xattr not synced for new files diff -r f6072141f5ee -r e72d2b99b0f6 dav/finfo.c --- a/dav/finfo.c Sat Aug 10 13:48:14 2019 +0200 +++ b/dav/finfo.c Sat Aug 10 14:25:03 2019 +0200 @@ -46,7 +46,7 @@ scstr_t s = scstr(str); if(!sstrcmp(s, SC("*")) || !sstrcmp(s, SC("a")) || !sstrcmp(s, SC("all"))) { - return FINFO_DATE|FINFO_OWNER|FINFO_MODE; + return FINFO_DATE|FINFO_OWNER|FINFO_MODE|FINFO_XATTR; } ssize_t count = 0; diff -r f6072141f5ee -r e72d2b99b0f6 dav/sync.c --- a/dav/sync.c Sat Aug 10 13:48:14 2019 +0200 +++ b/dav/sync.c Sat Aug 10 14:25:03 2019 +0200 @@ -1878,6 +1878,15 @@ } else if(local_res->metadata_updated) { ls_update = ucx_list_append(ls_update, local_res); } + + if(local_res->isnew) { + if(local_resource_load_metadata(dir, local_res)) { + fprintf( + stderr, + "Failed to load metadata: %s\n", + local_resource_path(local_res)); + } + } } if(dir->hashing) { @@ -2713,7 +2722,7 @@ } if((dir->metadata & FINFO_XATTR) == FINFO_XATTR) { - char *path = create_local_path(dir, db_res->path); + char *path = create_local_path(dir, local_resource_path(db_res)); XAttributes *xattr = file_get_attributes(path); // test if xattr are added, removed or changed if((db_res->xattr_hash && !xattr) || @@ -2800,6 +2809,18 @@ return ret; } +int local_resource_load_metadata(SyncDirectory *dir, LocalResource *res) { + // currently only xattr needed + if((dir->metadata & FINFO_XATTR) == FINFO_XATTR) { + char *path = create_local_path(dir, local_resource_path(res)); + XAttributes *xattr = file_get_attributes(path); + res->xattr = xattr; + free(path); + } + + return 0; +} + char* resource_local_path(DavResource *res) { #ifdef SYS_LINK_EXT // on Windows, add .lnk extension to links diff -r f6072141f5ee -r e72d2b99b0f6 dav/sync.h --- a/dav/sync.h Sat Aug 10 13:48:14 2019 +0200 +++ b/dav/sync.h Sat Aug 10 14:25:03 2019 +0200 @@ -151,6 +151,7 @@ SyncDatabase *db, DavResource *remote, LocalResource *res); +int local_resource_load_metadata(SyncDirectory *dir, LocalResource *res); char* resource_local_path(DavResource *res); size_t resource_get_blocksize(SyncDirectory *dir, LocalResource *local, DavResource *res, off_t filesize);