Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libsearpc for openSUSE:Factory checked in at 2025-04-15 16:46:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libsearpc (Old) and /work/SRC/openSUSE:Factory/.libsearpc.new.1907 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libsearpc" Tue Apr 15 16:46:50 2025 rev:11 rq:1269442 version:3.3.0.20250303 Changes: -------- --- /work/SRC/openSUSE:Factory/libsearpc/libsearpc.changes 2024-10-21 16:26:13.729021586 +0200 +++ /work/SRC/openSUSE:Factory/.libsearpc.new.1907/libsearpc.changes 2025-04-15 16:49:31.232171108 +0200 @@ -1,0 +2,11 @@ +Tue Apr 15 06:22:09 UTC 2025 - Paolo Stivanin <i...@paolostivanin.com> + +- Update to version 3.3.0.20250303: + * Modify slow log format (#75) + * Set slow threshold when log to stdout (#74) + * Clean log (#73) + * Update searpc-named-pipe-transport.c (#68) + * Add log to stdout (#72) + * Support write with non-blocking (#71) + +------------------------------------------------------------------- Old: ---- libsearpc-3.3.0.20240726.tar.gz New: ---- libsearpc-3.3.0.20250303.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libsearpc.spec ++++++ --- /var/tmp/diff_new_pack.r38LzU/_old 2025-04-15 16:49:31.680189463 +0200 +++ /var/tmp/diff_new_pack.r38LzU/_new 2025-04-15 16:49:31.680189463 +0200 @@ -1,7 +1,7 @@ # # spec file for package libsearpc # -# Copyright (c) 2024 SUSE LLC +# Copyright (c) 2025 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %define sover 1 Name: libsearpc -Version: 3.3.0.20240726 +Version: 3.3.0.20250303 Release: 0 Summary: Simple C language RPC framework based on GObject system License: Apache-2.0 ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.r38LzU/_old 2025-04-15 16:49:31.724191266 +0200 +++ /var/tmp/diff_new_pack.r38LzU/_new 2025-04-15 16:49:31.728191430 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/haiwen/libsearpc.git</param> - <param name="changesrevision">ed12cfba8145c4082b8de4c7466dd2cfb6806015</param></service></servicedata> + <param name="changesrevision">6f06843849cc7c25bf55d61adc0b34a0a8d6325a</param></service></servicedata> (No newline at EOF) ++++++ libsearpc-3.3.0.20240726.tar.gz -> libsearpc-3.3.0.20250303.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsearpc-3.3.0.20240726/.gitignore new/libsearpc-3.3.0.20250303/.gitignore --- old/libsearpc-3.3.0.20240726/.gitignore 2024-07-26 12:41:39.000000000 +0200 +++ new/libsearpc-3.3.0.20250303/.gitignore 1970-01-01 01:00:00.000000000 +0100 @@ -1,57 +0,0 @@ -*~ -*.pyc -*.o -*.lo -*.la -*.defs -*.log -.deps -*.db -*.gz -compile -config.* -autom4te.cache/* -aclocal.m4 -config.* -configure -Makefile -*/Makefile -Makefile.in -*/Makefile.in -.libs/ -*/.libs/ -stamp-h1 -searpc-demo-server -searpc-demo-client -searpc-async-client -pysearpc/fcallfret.h -m4/l* -depcomp -install-sh -libtool -ltmain.sh -missing -py-compile -cscope.files -cscope.out -lib/fcall-impr.h -lib/marshal.h -lib/searpc-dfun.h -lib/searpc-fcall.h -lib/searpc-signature.h -tests/test-searpc -cscope* -pysearpc/rpc_table.py -*.pc -demo/searpc-marshal.h -demo/searpc-signature.h -demo/rpc_table.stamp -demo/rpc_table.tmp -tests/searpc-marshal.h -tests/searpc-signature.h -tests/rpc_table.stamp -tests/rpc_table.tmp -tests/clar.suite -tests/.clarcache -tests/*.trs -test-driver diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsearpc-3.3.0.20240726/lib/searpc-named-pipe-transport.c new/libsearpc-3.3.0.20250303/lib/searpc-named-pipe-transport.c --- old/libsearpc-3.3.0.20240726/lib/searpc-named-pipe-transport.c 2024-07-26 12:41:39.000000000 +0200 +++ new/libsearpc-3.3.0.20250303/lib/searpc-named-pipe-transport.c 2025-03-03 10:04:23.000000000 +0100 @@ -197,10 +197,6 @@ typedef struct { SearpcNamedPipe connfd; - char *buffer; - guint32 len; - guint32 header_offset; - guint32 offset; SearpcNamedPipeServer *server; gboolean use_epoll; } ServerHandlerData; @@ -208,47 +204,35 @@ // EPOLL #ifdef __linux__ -// This function will keep reading until the following conditions are met: -// 1. the socket has beed closed. -// 2. there is no more readable data in the system cache; -// 3. the requested size has been read; -// 4. an unrecoverable error has been encountered; -// The first two cases are not errors. -gssize -epoll_read_n(int fd, void *vptr, size_t n) -{ - size_t nleft; - gssize nread; - char *ptr; - - ptr = vptr; - nleft = n; - while (nleft > 0) { - if ( (nread = read(fd, ptr, nleft)) < 0) { - if (errno == EINTR) - nread = 0; /* and call read() again */ - else if (errno == EAGAIN) - break; - else - return(-1); - } else if (nread == 0) - break; /* EOF */ - - nleft -= nread; - ptr += nread; - } - return(n - nleft); /* return >= 0 */ -} - static void epoll_handler(void *data) { ServerHandlerData *handler_data = data; SearpcNamedPipe connfd = handler_data->connfd; SearpcNamedPipeServer *server = handler_data->server; - const char *buf = handler_data->buffer; - guint32 len = handler_data->len; + char *buf = NULL; + guint32 len = 0; char *ret_str = NULL; int ret = 0; + int n; + + if (pipe_read_n(connfd, &len, sizeof(guint32)) < 0) { + g_warning("failed to read rpc request size: %s\n", strerror(errno)); + ret = -1; + goto out; + } + + if (len <= 0) { + ret = -1; + goto out; + } + + buf = g_new0 (char, len); + n = pipe_read_n (connfd, buf, len); + if (n < 0) { + g_warning ("failed to read rpc request: %s\n", strerror(errno)); + ret = -1; + goto out; + } char *service, *body; if (request_from_json (buf, len, &service, &body) < 0) { @@ -262,21 +246,16 @@ g_free (body); len = (guint32)ret_len; - if (pipe_write_n(connfd, &len, sizeof(guint32)) < 0) { + if (pipe_write_n (connfd, &len, sizeof(guint32)) < 0) { ret = -1; goto out; } - if (pipe_write_n(connfd, ret_str, ret_len) < 0) { + if (pipe_write_n (connfd, ret_str, ret_len) < 0) { ret = -1; goto out; } - g_free (handler_data->buffer); - handler_data->buffer = NULL; - handler_data->len = 0; - handler_data->header_offset = 0; - handler_data->offset = 0; struct epoll_event event; event.events = EPOLLIN | EPOLLRDHUP; event.data.ptr = (void *)handler_data; @@ -288,62 +267,14 @@ } out: + g_free (buf); if (ret < 0) { close (connfd); - g_free (handler_data->buffer); g_free (handler_data); } g_free (ret_str); } -static int -read_client_request (int connfd, ServerHandlerData *data) -{ - char *buf; - int n; - - // read length of request. - if (data->header_offset != 4) { - n = epoll_read_n(connfd, (void *)&(data->len) + data->header_offset, sizeof(guint32) - data->header_offset); - if (n < 0) { - g_warning("Failed to read rpc request size: %s\n", strerror(errno)); - return -1; - } - data->header_offset += n; - if (data->header_offset < 4) { - return 0; - } else if (data->header_offset > 4) { - g_warning("Failed to read rpc request size\n"); - return -1; - } - if (data->len == 0) { - return -1; - } - } - - if (!data->buffer) { - data->buffer = g_new0 (char, data->len); - } - - // read content of request. - n = epoll_read_n(connfd, data->buffer + data->offset, data->len - data->offset); - if (n < 0) { - g_warning ("Failed to read rpc request: %s\n", strerror(errno)); - return -1; - } - data->offset += n; - - return 0; -} - -int set_nonblocking(int fd) { - int flags = fcntl(fd, F_GETFL, 0); - if (flags < 0) { - return -1; - } - return fcntl(fd, F_SETFL, flags | O_NONBLOCK); -} - static void epoll_listen (SearpcNamedPipeServer *server) { @@ -374,12 +305,6 @@ continue; } - if (set_nonblocking(connfd) < 0) { - close(connfd); - g_warning ("Failed to set connection to noblocking.\n"); - continue; - } - event.events = EPOLLIN | EPOLLRDHUP; ServerHandlerData *data = g_new0(ServerHandlerData, 1); data->use_epoll = TRUE; @@ -393,32 +318,16 @@ g_free (data); continue; } - g_message ("start to serve on pipe client\n"); } else { ServerHandlerData *data = (ServerHandlerData *)events[i].data.ptr; connfd = data->connfd; if (events[i].events & (EPOLLHUP | EPOLLRDHUP)) { - if (data->len > 0) - g_free (data->buffer); - g_free (data); - epoll_ctl(server->epoll_fd, EPOLL_CTL_DEL, connfd, NULL); - close (connfd); - continue; - } - int rc = read_client_request (connfd, data); - if (rc < 0) { - if (data->len) - g_free (data->buffer); g_free (data); epoll_ctl(server->epoll_fd, EPOLL_CTL_DEL, connfd, NULL); close (connfd); continue; - } else if (data->header_offset != 4 || data->len != data->offset) { - // Continue reading request. - continue; } - - // After reading the contents of a request, remove the socket from the epoll and do not read the next request for a while to prevent client errors. + // After socket is readable, remove the socket from the epoll. // After the worker finishes processing the current request, we will add the socket back into the epoll. epoll_ctl(server->epoll_fd, EPOLL_CTL_DEL, connfd, NULL); if (server->named_pipe_server_thread_pool) { @@ -554,8 +463,6 @@ guint32 bufsize = 4096; char *buf = g_malloc(bufsize); - g_message ("start to serve on pipe client\n"); - while (1) { len = 0; if (pipe_read_n(connfd, &len, sizeof(guint32)) < 0) { @@ -570,7 +477,7 @@ while (bufsize < len) { bufsize *= 2; - buf = realloc(buf, bufsize); + buf = g_realloc(buf, bufsize); } if (pipe_read_n(connfd, buf, len) < 0 || len == 0) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsearpc-3.3.0.20240726/lib/searpc-server.c new/libsearpc-3.3.0.20250303/lib/searpc-server.c --- old/libsearpc-3.3.0.20240726/lib/searpc-server.c 2024-07-26 12:41:39.000000000 +0200 +++ new/libsearpc-3.3.0.20250303/lib/searpc-server.c 2025-03-03 10:04:23.000000000 +0100 @@ -41,6 +41,7 @@ static gint64 slow_threshold; static GList *filtered_funcs; static pthread_mutex_t slow_log_lock; +static gboolean log_to_stdout = FALSE; #endif static void @@ -205,18 +206,23 @@ gint64 slow_threshold_in, GList *filtered_funcs_in) { - if (slow_log_path) { + const char *log_to_stdout_env = g_getenv("SEAFILE_LOG_TO_STDOUT"); + if (g_strcmp0(log_to_stdout_env, "true") == 0) { + slow_log_fp = stdout; + log_to_stdout = TRUE; + } else if (slow_log_path) { slow_log_fp = fopen (slow_log_path, "a+"); if (!slow_log_fp) { g_warning ("Failed to open RPC slow log file %s: %s\n", slow_log_path, strerror(errno)); return -1; } - slow_threshold = slow_threshold_in; - filtered_funcs = filtered_funcs_in; - - pthread_mutex_init (&slow_log_lock, NULL); } + slow_threshold = slow_threshold_in; + filtered_funcs = filtered_funcs_in; + + pthread_mutex_init (&slow_log_lock, NULL); + searpc_server_init (register_func); return 0; @@ -227,6 +233,10 @@ { FILE *fp, *oldfp; + if (log_to_stdout) { + return 0; + } + if ((fp = fopen (slow_log_path, "a+")) == NULL) { g_warning ("Failed to open RPC slow log file %s\n", slow_log_path); return -1; @@ -340,7 +350,11 @@ pthread_mutex_lock (&slow_log_lock); - fprintf (slow_log_fp, "%s - %s - %.*s - %.3f\n", + if (log_to_stdout) { + fprintf (slow_log_fp, "[seafile-slow-rpc] "); + } + + fprintf (slow_log_fp, "[%s] \"%s\" %.*s %.3f\n", time_buf, svc_name, (int)len, func, intv_in_sec); fflush (slow_log_fp); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsearpc-3.3.0.20240726/libsearpc.vcxproj new/libsearpc-3.3.0.20250303/libsearpc.vcxproj --- old/libsearpc-3.3.0.20240726/libsearpc.vcxproj 2024-07-26 12:41:39.000000000 +0200 +++ new/libsearpc-3.3.0.20250303/libsearpc.vcxproj 2025-03-03 10:04:23.000000000 +0100 @@ -75,6 +75,9 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <OutDir>$(ProjectDir)$(Platform)\$(Configuration)\</OutDir> </PropertyGroup> + <PropertyGroup Label="Vcpkg"> + <VcpkgEnableManifest>true</VcpkgEnableManifest> + </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;LIBSEARPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> @@ -107,11 +110,13 @@ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ClCompile> <PreprocessorDefinitions>LIBSEARPC_EXPORTS;WIN32</PreprocessorDefinitions> + <AdditionalIncludeDirectories>$(ProjectDir)vcpkg_installed\x64-windows\x64-windows\include\glib-2.0;$(ProjectDir)vcpkg_installed\x64-windows\x64-windows\lib\glib-2.0\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ClCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ClCompile> <PreprocessorDefinitions>LIBSEARPC_EXPORTS;WIN32</PreprocessorDefinitions> + <AdditionalIncludeDirectories>$(ProjectDir)vcpkg_installed\x64-windows\x64-windows\include\glib-2.0;$(ProjectDir)vcpkg_installed\x64-windows\x64-windows\lib\glib-2.0\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ClCompile> </ItemDefinitionGroup> <ItemGroup> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsearpc-3.3.0.20240726/vcpkg.json new/libsearpc-3.3.0.20250303/vcpkg.json --- old/libsearpc-3.3.0.20240726/vcpkg.json 1970-01-01 01:00:00.000000000 +0100 +++ new/libsearpc-3.3.0.20250303/vcpkg.json 2025-03-03 10:04:23.000000000 +0100 @@ -0,0 +1,18 @@ +{ + "builtin-baseline": "f63682b9182187131b564c1395e4ac8ecb0c5ea8", + "dependencies": [ + "glib", + "jansson", + "pthreads" + ], + "overrides": [ + { + "name": "jansson", + "version": "2.12-1" + }, + { + "name": "pthreads", + "version": "3.0.0-4" + } + ] +}