Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package seadrive-fuse for openSUSE:Factory checked in at 2022-08-25 15:09:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/seadrive-fuse (Old) and /work/SRC/openSUSE:Factory/.seadrive-fuse.new.2083 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "seadrive-fuse" Thu Aug 25 15:09:34 2022 rev:3 rq:999226 version:2.0.22 Changes: -------- --- /work/SRC/openSUSE:Factory/seadrive-fuse/seadrive-fuse.changes 2021-09-07 21:22:35.357387659 +0200 +++ /work/SRC/openSUSE:Factory/.seadrive-fuse.new.2083/seadrive-fuse.changes 2022-08-25 15:09:41.649291160 +0200 @@ -1,0 +2,5 @@ +Thu Aug 18 09:27:12 UTC 2022 - Paolo Stivanin <i...@paolostivanin.com> + +- Update to v2.0.22 (no changelog) + +------------------------------------------------------------------- Old: ---- seadrive-fuse-2.0.16.tar.gz New: ---- seadrive-fuse-2.0.22.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ seadrive-fuse.spec ++++++ --- /var/tmp/diff_new_pack.9tw19e/_old 2022-08-25 15:09:42.229292385 +0200 +++ /var/tmp/diff_new_pack.9tw19e/_new 2022-08-25 15:09:42.237292402 +0200 @@ -1,7 +1,7 @@ # # spec file for package seadrive-fuse # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: seadrive-fuse -Version: 2.0.16 +Version: 2.0.22 Release: 0 Summary: SeaDrive daemon with FUSE interface License: GPL-2.0-only ++++++ seadrive-fuse-2.0.16.tar.gz -> seadrive-fuse-2.0.22.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/seadrive-fuse-2.0.16/debian/changelog new/seadrive-fuse-2.0.22/debian/changelog --- old/seadrive-fuse-2.0.16/debian/changelog 2021-09-07 10:35:14.000000000 +0200 +++ new/seadrive-fuse-2.0.22/debian/changelog 2022-06-21 11:31:29.000000000 +0200 @@ -1,3 +1,8 @@ +seadrive-daemon (2.0.22) unstable; urgency=low + + * new upstream release + + -- Jonathan Xu <jonathan...@seafile.com> Tue, 21 June 2022 16:56:30 +0800 seadrive-daemon (2.0.16) unstable; urgency=low * new upstream release diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/seadrive-fuse-2.0.16/src/http-tx-mgr.c new/seadrive-fuse-2.0.22/src/http-tx-mgr.c --- old/seadrive-fuse-2.0.16/src/http-tx-mgr.c 2021-09-07 10:35:14.000000000 +0200 +++ new/seadrive-fuse-2.0.22/src/http-tx-mgr.c 2022-06-21 11:31:29.000000000 +0200 @@ -897,11 +897,12 @@ } static int -http_api_post (CURL *curl, const char *url, const char *token, - const char *req_content, gint64 req_size, - int *rsp_status, char **rsp_content, gint64 *rsp_size, - gboolean timeout, int timeout_sec, - int *pcurl_error) +http_api_post_common (CURL *curl, const char *url, const char *token, + const char *header, + const char *req_content, gint64 req_size, + int *rsp_status, char **rsp_content, gint64 *rsp_size, + gboolean timeout, int timeout_sec, + int *pcurl_error) { char *token_header; struct curl_slist *headers = NULL; @@ -914,7 +915,7 @@ headers = curl_slist_append (headers, "Expect:"); if (req_content) - headers = curl_slist_append (headers, "Content-Type: application/x-www-form-urlencoded"); + headers = curl_slist_append (headers, header); if (token) { token_header = g_strdup_printf ("Authorization: Token %s", token); @@ -933,6 +934,34 @@ } static int +http_api_post (CURL *curl, const char *url, const char *token, + const char *req_content, gint64 req_size, + int *rsp_status, char **rsp_content, gint64 *rsp_size, + gboolean timeout, int timeout_sec, + int *pcurl_error) +{ + int ret; + char *header = "Content-Type: application/x-www-form-urlencoded"; + ret = http_api_post_common (curl, url, token, header, req_content, req_size, rsp_status, + rsp_content, rsp_size, timeout, timeout_sec, pcurl_error); + return ret; +} + +static int +http_api_json_post (CURL *curl, const char *url, const char *token, + const char *req_content, gint64 req_size, + int *rsp_status, char **rsp_content, gint64 *rsp_size, + gboolean timeout, int timeout_sec, + int *pcurl_error) +{ + int ret; + char *header = "Content-Type: application/json"; + ret = http_api_post_common (curl, url, token, header, req_content, req_size, rsp_status, + rsp_content, rsp_size, timeout, timeout_sec, pcurl_error); + return ret; +} + +static int http_delete_common (CURL *curl, const char *url, int *rsp_status, gboolean timeout, int timeout_sec) @@ -5087,7 +5116,7 @@ } if (status != HTTP_MOVED_PERMANENTLY) { - seaf_warning ("Bad response code for POST %s: %d.\n", url, status); + seaf_warning ("Bad response code for POST %s: %d, response error: %s.\n", url, status, (rsp_content ? rsp_content : "no response body")); ret = -1; } @@ -5107,7 +5136,6 @@ { CURL *curl = conn->curl; char *src_dir = NULL, *src_filename = NULL, *dst_dir = NULL; - char *esc_src_dir = NULL, *esc_src_filename = NULL, *esc_dst_dir = NULL; char *url = NULL; char *req_content = NULL; int status; @@ -5115,6 +5143,8 @@ gint64 rsp_size; int ret = 0; json_t *obj = NULL; + json_t *req_obj = NULL; + json_t *array = NULL; json_error_t jerror; src_dir = g_path_get_dirname (oldpath); @@ -5130,22 +5160,24 @@ dst_dir = g_strdup("/"); } - esc_src_dir = g_uri_escape_string (src_dir, NULL, FALSE); - esc_src_filename = g_uri_escape_string (src_filename, NULL, FALSE); - esc_dst_dir = g_uri_escape_string (dst_dir, NULL, FALSE); - - req_content = g_strdup_printf ("operation=move&dirent_type=%s&" - "src_repo_id=%s&src_parent_dir=%s&src_dirent_name=%s&" - "dst_repo_id=%s&dst_parent_dir=%s", - (is_file ? "file" : "dir"), - repo_id1, esc_src_dir, esc_src_filename, - repo_id2, esc_dst_dir); + req_obj = json_object (); + json_object_set_new (req_obj, "src_repo_id", json_string(repo_id1)); + json_object_set_new (req_obj, "src_parent_dir", json_string(src_dir)); - url = g_strdup_printf ("%s/api/v2.1/copy-move-task/", host); + array = json_array (); + json_array_append_new (array, json_string(src_filename)); + json_object_set_new (req_obj, "src_dirents", array); - if (http_api_post (curl, url, api_token, req_content, strlen(req_content), - &status, &rsp_content, &rsp_size, - TRUE, REPO_OPER_TIMEOUT, NULL) < 0) { + json_object_set_new (req_obj, "dst_repo_id", json_string(repo_id2)); + json_object_set_new (req_obj, "dst_parent_dir", json_string(dst_dir)); + + req_content = json_dumps (req_obj, 0); + + url = g_strdup_printf ("%s/api/v2.1/repos/async-batch-move-item/", host); + + if (http_api_json_post (curl, url, api_token, req_content, strlen(req_content), + &status, &rsp_content, &rsp_size, + TRUE, REPO_OPER_TIMEOUT, NULL) < 0) { conn->release = TRUE; ret = -1; goto out; @@ -5154,7 +5186,7 @@ curl_easy_reset (curl); if (status != HTTP_OK) { - seaf_warning ("Bad response code for POST %s: %d.\n", url, status); + seaf_warning ("Bad response code for POST %s: %d, response error: %s.\n", url, status, (rsp_content ? rsp_content : "no response body")); if (status == HTTP_NOT_FOUND && no_api) *no_api = TRUE; ret = -1; @@ -5174,7 +5206,7 @@ } const char *task_id = json_string_value(json_object_get(obj, "task_id")); - if (!task_id) { + if (!task_id || strlen(task_id) == 0) { if (g_strcmp0 (repo_id1, repo_id2) == 0) goto out; seaf_warning ("No copy move task id returned from server.\n"); @@ -5245,13 +5277,11 @@ g_free (src_dir); g_free (src_filename); g_free (dst_dir); - g_free (esc_src_dir); - g_free (esc_src_filename); - g_free (esc_dst_dir); g_free (url); g_free (req_content); g_free (rsp_content); json_decref (obj); + json_decref (req_obj); return ret; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/seadrive-fuse-2.0.16/src/sync-mgr.c new/seadrive-fuse-2.0.22/src/sync-mgr.c --- old/seadrive-fuse-2.0.16/src/sync-mgr.c 2021-09-07 10:35:14.000000000 +0200 +++ new/seadrive-fuse-2.0.22/src/sync-mgr.c 2022-06-21 11:31:29.000000000 +0200 @@ -30,6 +30,7 @@ #define CHECK_SERVER_LOCKED_FILES_INTERVAL 10 /* 10s */ #define CHECK_LOCKED_FILES_INTERVAL 30 /* 30s */ #define CHECK_FOLDER_PERMS_INTERVAL 30 /* 30s */ +#define MAX_RESYNC_COUNT 3 #define CHECK_REPO_LIST_INTERVAL 1 /* 1s */ struct _HttpServerState { @@ -63,6 +64,8 @@ RepoInfo *repo_info; + int resync_count; + gint64 last_sync_time; gboolean in_sync; /* set to FALSE when sync state is DONE or ERROR */ @@ -680,9 +683,12 @@ /* If local metadata is corrupted, remove local repo and resync later. */ if (sync_error_id == SYNC_ERROR_ID_LOCAL_DATA_CORRUPT) { - seaf_message ("Repo %s(%s) local metadata is corrupted. Remove and resync later.\n", - task->repo->name, task->repo->id); - seaf_repo_manager_mark_repo_deleted (seaf->repo_mgr, task->repo, FALSE); + if (task->info->resync_count < MAX_RESYNC_COUNT) { + seaf_message ("Repo %s(%s) local metadata is corrupted. Remove and resync later.\n", + task->repo->name, task->repo->id); + seaf_repo_manager_mark_repo_deleted (seaf->repo_mgr, task->repo, FALSE); + ++(task->info->resync_count); + } } if (task->repo) @@ -2328,7 +2334,10 @@ LoadRepoTreeAux *aux = vresult; SyncTask *task = aux->task; + SeafSyncManagerPriv *priv = seaf->sync_mgr->priv; + if (aux->success) { + g_hash_table_remove (priv->repo_tokens, task->repo->id); transition_sync_state (task, SYNC_STATE_DONE); } else { seaf_sync_manager_set_task_error (task, SYNC_ERROR_DATA_CORRUPT); @@ -2392,8 +2401,6 @@ if (!repo->worktree) seaf_repo_set_worktree (repo, info->repo_info->display_name); - /* clean repo token cache. */ - g_hash_table_remove (mgr->priv->repo_tokens, repo->id); /* Set task->repo since the repo exists now. */ task->repo = repo;