Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package swayidle for openSUSE:Factory checked in at 2022-01-17 22:34:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/swayidle (Old) and /work/SRC/openSUSE:Factory/.swayidle.new.1892 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "swayidle" Mon Jan 17 22:34:22 2022 rev:8 rq:946990 version:1.7.1 Changes: -------- --- /work/SRC/openSUSE:Factory/swayidle/swayidle.changes 2021-08-20 16:57:48.470879645 +0200 +++ /work/SRC/openSUSE:Factory/.swayidle.new.1892/swayidle.changes 2022-01-17 22:35:15.930292189 +0100 @@ -1,0 +2,9 @@ +Mon Jan 17 14:23:14 UTC 2022 - Michael Vetter <mvet...@suse.com> + +- Update to 1.7.1: + * Add editorconfig + * Improve log messages + * Call release() to let the server remove the timer. + * Allow forked processes to receive signal + +------------------------------------------------------------------- Old: ---- 1.7.tar.gz New: ---- 1.7.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ swayidle.spec ++++++ --- /var/tmp/diff_new_pack.vcKLYd/_old 2022-01-17 22:35:16.330292454 +0100 +++ /var/tmp/diff_new_pack.vcKLYd/_new 2022-01-17 22:35:16.334292457 +0100 @@ -1,7 +1,7 @@ # # spec file for package swayidle # -# 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: swayidle -Version: 1.7 +Version: 1.7.1 Release: 0 Summary: Idle management daemon for Wayland License: MIT ++++++ 1.7.tar.gz -> 1.7.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/swayidle-1.7/.editorconfig new/swayidle-1.7.1/.editorconfig --- old/swayidle-1.7/.editorconfig 1970-01-01 01:00:00.000000000 +0100 +++ new/swayidle-1.7.1/.editorconfig 2022-01-15 17:14:51.000000000 +0100 @@ -0,0 +1,22 @@ +# For the full list of code style requirements, see CONTRIBUTING.md + +root = true + +[*] +charset = utf-8 +end_of_line = lf + +[*.{c,h,cmake,txt}] +indent_style = tab +indent_size = 4 + +[*.{xml,yml}] +indent_style = space +indent_size = 2 + +[config] +indent_style = space +indent_size = 4 + +[*.md] +trim_trailing_whitespace = false diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/swayidle-1.7/README.md new/swayidle-1.7.1/README.md --- old/swayidle-1.7/README.md 2021-05-16 17:38:17.000000000 +0200 +++ new/swayidle-1.7.1/README.md 2022-01-15 17:14:51.000000000 +0100 @@ -3,7 +3,7 @@ This is sway's idle management daemon, swayidle. It is compatible with any Wayland compositor which implements the KDE [idle](https://github.com/swaywm/sway/blob/master/protocols/idle.xml) protocol. -See the man page, `swayidle(1)`, for instructions on configuring swayidle. +See the man page, [swayidle(1)](./swayidle.1.scd), for instructions on configuring swayidle. ## Release Signatures diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/swayidle-1.7/log.h new/swayidle-1.7.1/log.h --- old/swayidle-1.7/log.h 1970-01-01 01:00:00.000000000 +0100 +++ new/swayidle-1.7.1/log.h 2022-01-15 17:14:51.000000000 +0100 @@ -0,0 +1,33 @@ +#ifndef _SWAYIDLE_LOG_H +#define _SWAYIDLE_LOG_H + +#include <stdarg.h> +#include <string.h> +#include <errno.h> + +enum log_importance { + LOG_SILENT = 0, + LOG_ERROR = 1, + LOG_INFO = 2, + LOG_DEBUG = 3, + LOG_IMPORTANCE_LAST, +}; + +void swayidle_log_init(enum log_importance verbosity); + +#ifdef __GNUC__ +#define _ATTRIB_PRINTF(start, end) __attribute__((format(printf, start, end))) +#else +#define _ATTRIB_PRINTF(start, end) +#endif + +void _swayidle_log(enum log_importance verbosity, const char *format, ...) + _ATTRIB_PRINTF(2, 3); + +#define swayidle_log(verb, fmt, ...) \ + _swayidle_log(verb, "[Line %d] " fmt, __LINE__, ##__VA_ARGS__) + +#define swayidle_log_errno(verb, fmt, ...) \ + swayidle_log(verb, fmt ": %s", ##__VA_ARGS__, strerror(errno)) + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/swayidle-1.7/main.c new/swayidle-1.7.1/main.c --- old/swayidle-1.7/main.c 2021-05-16 17:38:17.000000000 +0200 +++ new/swayidle-1.7.1/main.c 2022-01-15 17:14:51.000000000 +0100 @@ -7,6 +7,7 @@ #include <stdlib.h> #include <string.h> #include <sys/wait.h> +#include <time.h> #include <unistd.h> #include <wayland-client-protocol.h> #include <wayland-client.h> @@ -15,6 +16,7 @@ #include <wordexp.h> #include "config.h" #include "idle-client-protocol.h" +#include "log.h" #if HAVE_SYSTEMD #include <systemd/sd-bus.h> #include <systemd/sd-login.h> @@ -59,35 +61,54 @@ uint32_t capabilities; }; -enum log_importance { - LOG_DEBUG = 1, - LOG_INFO = 2, - LOG_ERROR = 3, +static const char *verbosity_colors[] = { + [LOG_SILENT] = "", + [LOG_ERROR ] = "\x1B[1;31m", + [LOG_INFO ] = "\x1B[1;34m", + [LOG_DEBUG ] = "\x1B[1;30m", }; -static enum log_importance verbosity = LOG_INFO; +static enum log_importance log_importance = LOG_INFO; -static void swayidle_log(enum log_importance importance, const char *fmt, ...) { - if (importance < verbosity) { - return; +void swayidle_log_init(enum log_importance verbosity) { + if (verbosity < LOG_IMPORTANCE_LAST) { + log_importance = verbosity; } - va_list args; - va_start(args, fmt); - vfprintf(stderr, fmt, args); - va_end(args); - fprintf(stderr, "\n"); } -static void swayidle_log_errno( - enum log_importance importance, const char *fmt, ...) { - if (importance < verbosity) { +void _swayidle_log(enum log_importance verbosity, const char *fmt, ...) { + if (verbosity > log_importance) { return; } + va_list args; va_start(args, fmt); + + // prefix the time to the log message + struct tm result; + time_t t = time(NULL); + struct tm *tm_info = localtime_r(&t, &result); + char buffer[26]; + + // generate time prefix + strftime(buffer, sizeof(buffer), "%F %T - ", tm_info); + fprintf(stderr, "%s", buffer); + + unsigned c = (verbosity < LOG_IMPORTANCE_LAST) + ? verbosity : LOG_IMPORTANCE_LAST - 1; + + if (isatty(STDERR_FILENO)) { + fprintf(stderr, "%s", verbosity_colors[c]); + } + vfprintf(stderr, fmt, args); + + if (isatty(STDERR_FILENO)) { + fprintf(stderr, "\x1B[0m"); + } + fprintf(stderr, "\n"); + va_end(args); - fprintf(stderr, ": %s\n", strerror(errno)); } static void swayidle_init() { @@ -126,6 +147,13 @@ pid = fork(); } if (pid == 0) { + sigset_t set; + sigemptyset(&set); + sigprocmask(SIG_SETMASK, &set, NULL); + signal(SIGINT, SIG_DFL); + signal(SIGTERM, SIG_DFL); + signal(SIGUSR1, SIG_DFL); + char *const cmd[] = { "sh", "-c", param, NULL, }; execvp(cmd[0], cmd); swayidle_log_errno(LOG_ERROR, "execve failed!"); @@ -139,7 +167,14 @@ swayidle_log_errno(LOG_ERROR, "fork failed"); } else { swayidle_log(LOG_DEBUG, "Spawned process %s", param); - waitpid(pid, NULL, 0); + if (state.wait) { + swayidle_log(LOG_DEBUG, "Blocking until process exits"); + } + int status = 0; + waitpid(pid, &status, 0); + if (state.wait && WIFEXITED(status)) { + swayidle_log(LOG_DEBUG, "Process exit status: %d", WEXITSTATUS(status)); + } } } @@ -253,7 +288,7 @@ if (ret < 0) { errno = -ret; swayidle_log_errno(LOG_ERROR, - "Failed to parse D-Bus response for Inhibit: %s"); + "Failed to parse D-Bus response for Inhibit"); } swayidle_log(LOG_DEBUG, "PrepareForSleep signal received %d", going_down); if (!going_down) { @@ -533,7 +568,8 @@ static void destroy_cmd_timer(struct swayidle_timeout_cmd *cmd) { if (cmd->idle_timer != NULL) { - org_kde_kwin_idle_timeout_destroy(cmd->idle_timer); + swayidle_log(LOG_DEBUG, "Release idle timer"); + org_kde_kwin_idle_timeout_release(cmd->idle_timer); cmd->idle_timer = NULL; } } @@ -798,7 +834,7 @@ *config_path = strdup(optarg); break; case 'd': - verbosity = LOG_DEBUG; + swayidle_log_init(LOG_DEBUG); break; case 'w': state.wait = true; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/swayidle-1.7/meson.build new/swayidle-1.7.1/meson.build --- old/swayidle-1.7/meson.build 2021-05-16 17:38:17.000000000 +0200 +++ new/swayidle-1.7.1/meson.build 2022-01-15 17:14:51.000000000 +0100 @@ -1,7 +1,7 @@ project( 'swayidle', 'c', - version: '1.7', + version: '1.7.1', license: 'MIT', meson_version: '>=0.48.0', default_options: [