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 2025-12-25 19:57:43 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/seadrive-fuse (Old) and /work/SRC/openSUSE:Factory/.seadrive-fuse.new.1928 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "seadrive-fuse" Thu Dec 25 19:57:43 2025 rev:7 rq:1324380 version:3.0.18 Changes: -------- --- /work/SRC/openSUSE:Factory/seadrive-fuse/seadrive-fuse.changes 2025-10-21 11:17:07.868585164 +0200 +++ /work/SRC/openSUSE:Factory/.seadrive-fuse.new.1928/seadrive-fuse.changes 2025-12-25 19:57:59.748096586 +0100 @@ -1,0 +2,11 @@ +Wed Dec 24 13:49:32 UTC 2025 - Andreas Stieger <[email protected]> + +- update to 3.0.18: + * Check if is a manual download + * Check deleted files when delete a dir +- includes changes from 3.0.17: + * Set UserAgent for notification server request + * Cancel context when client is closed + * Support log rotate + +------------------------------------------------------------------- Old: ---- seadrive-fuse-3.0.16.tar.gz New: ---- seadrive-fuse-3.0.18.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ seadrive-fuse.spec ++++++ --- /var/tmp/diff_new_pack.2TiCJT/_old 2025-12-25 19:58:00.392122718 +0100 +++ /var/tmp/diff_new_pack.2TiCJT/_new 2025-12-25 19:58:00.396122881 +0100 @@ -17,7 +17,7 @@ Name: seadrive-fuse -Version: 3.0.16 +Version: 3.0.18 Release: 0 Summary: SeaDrive daemon with FUSE interface License: GPL-2.0-only ++++++ seadrive-fuse-3.0.16.tar.gz -> seadrive-fuse-3.0.18.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/seadrive-fuse-3.0.16/configure.ac new/seadrive-fuse-3.0.18/configure.ac --- old/seadrive-fuse-3.0.16/configure.ac 2025-08-19 03:40:01.000000000 +0200 +++ new/seadrive-fuse-3.0.18/configure.ac 2025-11-25 04:42:26.000000000 +0100 @@ -2,7 +2,7 @@ AC_PREREQ(2.61) -AC_INIT([seadrive], [3.0.16], [[email protected]]) +AC_INIT([seadrive], [3.0.18], [[email protected]]) AC_CONFIG_HEADER([config.h]) AC_CONFIG_MACRO_DIR([m4]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/seadrive-fuse-3.0.16/debian/changelog new/seadrive-fuse-3.0.18/debian/changelog --- old/seadrive-fuse-3.0.16/debian/changelog 2025-08-19 03:40:01.000000000 +0200 +++ new/seadrive-fuse-3.0.18/debian/changelog 2025-11-25 04:42:26.000000000 +0100 @@ -1,3 +1,15 @@ +seadrive-daemon (3.0.18) unstable; urgency=low + + * new upstream release + + -- Jonathan Xu <[email protected]> Tue, 25 Nov 2025 10:30:00 +0800 + +seadrive-daemon (3.0.17) unstable; urgency=low + + * new upstream release + + -- Jonathan Xu <[email protected]> Tue, 28 Oct 2025 10:30:00 +0800 + seadrive-daemon (3.0.16) unstable; urgency=low * new upstream release diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/seadrive-fuse-3.0.16/src/file-cache-mgr.c new/seadrive-fuse-3.0.18/src/file-cache-mgr.c --- old/seadrive-fuse-3.0.16/src/file-cache-mgr.c 2025-08-19 03:40:01.000000000 +0200 +++ new/seadrive-fuse-3.0.18/src/file-cache-mgr.c 2025-11-25 04:42:26.000000000 +0100 @@ -283,7 +283,8 @@ pthread_mutex_lock (&mgr->priv->task_lock); handle = g_hash_table_lookup (mgr->priv->cache_tasks, file_key); - if (handle) + // When manually downloading a file, avoid cancellation by other read requests. + if (handle && !handle->is_manual) handle->fetch_canceled = TRUE; pthread_mutex_unlock (&mgr->priv->task_lock); @@ -814,7 +815,7 @@ static int start_cache_task (FileCacheMgrPriv *priv, CachedFile *file, RepoTreeStat *st, - const char *server, const char *user) + const char *server, const char *user, gboolean is_manual) { char *ondisk_path = NULL; int flags; @@ -868,6 +869,7 @@ handle->cached_file->total_download = st->size; handle->server = g_strdup(server); handle->user = g_strdup(user); + handle->is_manual = is_manual; cached_file_ref (file); @@ -966,7 +968,7 @@ goto out; } - if (start_cache_task (priv, cached_file, st, server, user) < 0) { + if (start_cache_task (priv, cached_file, st, server, user, FALSE) < 0) { seaf_warning ("Failed to start cache task for file %s in repo %s.\n", file_path, repo_id); cached_file_unref (cached_file); @@ -1016,7 +1018,7 @@ goto out; } - if (start_cache_task (priv, cached_file, st, repo->server, repo->user) < 0) { + if (start_cache_task (priv, cached_file, st, repo->server, repo->user, TRUE) < 0) { seaf_warning ("Failed to start cache task for file %s in repo %s.\n", path, repo_id); } @@ -1290,7 +1292,7 @@ pthread_mutex_unlock (&priv->cache_lock); - start_cache_task (priv, file, st, repo->server, repo->user); + start_cache_task (priv, file, st, repo->server, repo->user, FALSE); out: seaf_repo_unref (repo); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/seadrive-fuse-3.0.16/src/file-cache-mgr.h new/seadrive-fuse-3.0.18/src/file-cache-mgr.h --- old/seadrive-fuse-3.0.16/src/file-cache-mgr.h 2025-08-19 03:40:01.000000000 +0200 +++ new/seadrive-fuse-3.0.18/src/file-cache-mgr.h 2025-11-25 04:42:26.000000000 +0100 @@ -24,6 +24,7 @@ gint64 file_size; gboolean is_readonly; gboolean fetch_canceled; + gboolean is_manual; gint64 start_download_time; gboolean notified_download_start; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/seadrive-fuse-3.0.16/src/http-tx-mgr.c new/seadrive-fuse-3.0.18/src/http-tx-mgr.c --- old/seadrive-fuse-3.0.16/src/http-tx-mgr.c 2025-08-19 03:40:01.000000000 +0200 +++ new/seadrive-fuse-3.0.18/src/http-tx-mgr.c 2025-11-25 04:42:26.000000000 +0100 @@ -46,18 +46,6 @@ #define CLEAR_POOL_ERR_CNT 3 -#ifndef SEAFILE_CLIENT_VERSION -#define SEAFILE_CLIENT_VERSION PACKAGE_VERSION -#endif - -#ifdef __APPLE__ -#define USER_AGENT_OS "Apple OS X" -#endif - -#ifdef __linux__ -#define USER_AGENT_OS "Linux" -#endif - struct _Connection { CURL *curl; gint64 ctime; /* Used to clean up unused connection. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/seadrive-fuse-3.0.16/src/log.c new/seadrive-fuse-3.0.18/src/log.c --- old/seadrive-fuse-3.0.16/src/log.c 2025-08-19 03:40:01.000000000 +0200 +++ new/seadrive-fuse-3.0.18/src/log.c 2025-11-25 04:42:26.000000000 +0100 @@ -9,6 +9,8 @@ #include "log.h" #include "utils.h" +#define MAX_LOG_SIZE 300 * 1024 * 1024 + /* message with greater log levels will be ignored */ static int seafile_log_level; static char *logfile; @@ -63,27 +65,27 @@ return 0; } -int -seafile_log_reopen () +const int +seafile_log_reopen (const char *logfile_old) { - FILE *fp, *oldfp; + FILE *fp; - if (strcmp(logfile, "-") == 0) - return 0; - - if ((fp = g_fopen (logfile, "a+")) == NULL) { - seaf_message ("Failed to open file %s\n", logfile); + if (fclose(logfp) < 0) { + seaf_warning ("Failed to close file %s\n", logfile); return -1; } + logfp = NULL; - //TODO: check file's health + if (seaf_util_rename (logfile, logfile_old) < 0) { + seaf_warning ("Failed to rename %s to %s, error: %s\n", logfile, logfile_old, strerror(errno)); + return -1; + } - oldfp = logfp; - logfp = fp; - if (fclose(oldfp) < 0) { - seaf_message ("Failed to close file %s\n", logfile); + if ((fp = g_fopen (logfile, "a+")) == NULL) { + seaf_warning ("Failed to open file %s\n", logfile); return -1; } + logfp = fp; return 0; } @@ -141,3 +143,48 @@ { return logfp; } + +static void +check_and_reopen_log () +{ + SeafStat st; + + if (g_strcmp0(logfile, "-") != 0 && seaf_stat (logfile, &st) >= 0) { + if (st.st_size >= MAX_LOG_SIZE) { + char *dirname = g_path_get_dirname (logfile); + char *logfile_old = g_build_filename (dirname, "seadrive-old.log", NULL); + + seafile_log_reopen (logfile_old); + + g_free (dirname); + g_free (logfile_old); + } + } +} + +static void* +log_rotate (void *vdata) +{ + while (1) { + check_and_reopen_log (); + g_usleep (3600LL * G_USEC_PER_SEC); + } + return NULL; +} + +int +seafile_log_rotate_start () +{ + pthread_t tid; + pthread_attr_t attr; + pthread_attr_init(&attr); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + + int rc = pthread_create (&tid, &attr, log_rotate, NULL); + if (rc != 0) { + seaf_warning ("Failed to start log rotate thread: %s\n", strerror(rc)); + return -1; + } + + return 0; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/seadrive-fuse-3.0.16/src/log.h new/seadrive-fuse-3.0.18/src/log.h --- old/seadrive-fuse-3.0.16/src/log.h 2025-08-19 03:40:01.000000000 +0200 +++ new/seadrive-fuse-3.0.18/src/log.h 2025-11-25 04:42:26.000000000 +0100 @@ -14,7 +14,6 @@ #endif int seafile_log_init (const char *logfile); -int seafile_log_reopen (); void seafile_debug_set_flags_string (const gchar *flags_string); @@ -49,3 +48,6 @@ #endif FILE *seafile_get_logfp (); + +int +seafile_log_rotate_start (); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/seadrive-fuse-3.0.16/src/notif-mgr.c new/seadrive-fuse-3.0.18/src/notif-mgr.c --- old/seadrive-fuse-3.0.16/src/notif-mgr.c 2025-08-19 03:40:01.000000000 +0200 +++ new/seadrive-fuse-3.0.18/src/notif-mgr.c 2025-11-25 04:42:26.000000000 +0100 @@ -362,6 +362,8 @@ static void handle_messages (const char *msg, size_t len); +static char *ua = "SeaDrive/"SEAFILE_CLIENT_VERSION" ("USER_AGENT_OS")"; + // success:0 static int event_callback (struct lws *wsi, enum lws_callback_reasons reason, @@ -378,6 +380,15 @@ seaf_debug ("Notification event: %d\n", reason); switch (reason) { + case LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER: + { + unsigned char **p = (unsigned char **)in, *end = (*p) + len; + + if (lws_add_http_header_by_token(wsi, WSI_TOKEN_HTTP_USER_AGENT, + (unsigned char *)ua, (int)strlen(ua), p, end)) + return -1; + break; + } case LWS_CALLBACK_CLIENT_CONNECTION_ERROR: server->status = STATUS_ERROR; seaf_debug ("websocket connection error: %s\n", @@ -413,6 +424,10 @@ case LWS_CALLBACK_CLIENT_CLOSED: ret = -1; server->status = STATUS_ERROR; + // When the client is closed, cancel the context to prevent the socket from blocking in poll after the operating system wakes from sleep. + // After calling lws_cancel_service, a LWS_CALLBACK_EVENT_WAIT_CANCELLED callback is sent to every protocol on every vhost, + // notification_worker will exit loop. + lws_cancel_service (server->context); break; case LWS_CALLBACK_EVENT_WAIT_CANCELLED: ret = -1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/seadrive-fuse-3.0.16/src/seadrive.c new/seadrive-fuse-3.0.18/src/seadrive.c --- old/seadrive-fuse-3.0.16/src/seadrive.c 2025-08-19 03:40:01.000000000 +0200 +++ new/seadrive-fuse-3.0.18/src/seadrive.c 2025-11-25 04:42:26.000000000 +0100 @@ -493,6 +493,8 @@ set_signal_handlers (seaf); + seafile_log_rotate_start (); + #ifndef USE_GPL_CRYPTO seafile_curl_init(); #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/seadrive-fuse-3.0.16/src/sync-mgr.c new/seadrive-fuse-3.0.18/src/sync-mgr.c --- old/seadrive-fuse-3.0.16/src/sync-mgr.c 2025-08-19 03:40:01.000000000 +0200 +++ new/seadrive-fuse-3.0.18/src/sync-mgr.c 2025-11-25 04:42:26.000000000 +0100 @@ -2656,6 +2656,59 @@ return (slash + 1); } +typedef struct _GetDeletedFilesAux { + char *basename; + int number; +} GetDeletedFilesAux; + +static gboolean +get_deleted_files_cb (SeafFSManager *mgr, + const char *path, + SeafDirent *dent, + void *user_data, + gboolean *stop) +{ + GetDeletedFilesAux *aux = user_data; + + if (S_ISREG(dent->mode)) { + if (!aux->basename) { + char *basename = get_basename(dent->name); + aux->basename = g_strdup(basename); + } + aux->number++; + } + return TRUE; +} + +static void +get_number_of_deleted_files (SeafRepo *repo, const char *remote_root, + DiffEntry *de, int *n_deleted, char **deleted_file) +{ + SeafDir *dir = NULL; + char dir_id[41]; + + rawdata_to_hex (de->sha1, dir_id, 20); + GetDeletedFilesAux *aux = g_new0 (GetDeletedFilesAux, 1); + + if (seaf_fs_manager_traverse_path (seaf->fs_mgr, + repo->id, repo->version, + remote_root, + de->name, + get_deleted_files_cb, + aux) < 0) { + goto out; + } + + if (*n_deleted == 0) { + *deleted_file = g_strdup (aux->basename); + } + *n_deleted += aux->number; + +out: + g_free (aux->basename); + g_free (aux); +} + static char * exceed_max_deleted_files (SeafRepo *repo) { @@ -2707,9 +2760,12 @@ switch (de->status) { case DIFF_STATUS_DELETED: if (n_deleted == 0) - deleted_file = get_basename(de->name); + deleted_file = g_strdup(get_basename(de->name)); n_deleted++; break; + case DIFF_STATUS_DIR_DELETED: + get_number_of_deleted_files (repo, master_head->root_id, de, &n_deleted, &deleted_file); + break; } } @@ -2721,6 +2777,7 @@ } out: + g_free (deleted_file); seaf_branch_unref (local); seaf_branch_unref (master); seaf_commit_unref (local_head); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/seadrive-fuse-3.0.16/src/utils.h new/seadrive-fuse-3.0.18/src/utils.h --- old/seadrive-fuse-3.0.16/src/utils.h 2025-08-19 03:40:01.000000000 +0200 +++ new/seadrive-fuse-3.0.18/src/utils.h 2025-11-25 04:42:26.000000000 +0100 @@ -29,6 +29,12 @@ #define SeafStat struct stat +#ifndef SEAFILE_CLIENT_VERSION +#define SEAFILE_CLIENT_VERSION PACKAGE_VERSION +#endif + +#define USER_AGENT_OS "Linux" + int seaf_stat (const char *path, SeafStat *st); int seaf_fstat (int fd, SeafStat *st);
