diff --git a/SOURCES/0001-notify-send-Give-failing-exit-code-if-showing-notifi.patch b/SOURCES/0001-notify-send-Give-failing-exit-code-if-showing-notifi.patch new file mode 100644 index 0000000..3cf41c0 --- /dev/null +++ b/SOURCES/0001-notify-send-Give-failing-exit-code-if-showing-notifi.patch @@ -0,0 +1,139 @@ +From 390500fc0c806ed347f76afcfe8a62a74653e81b Mon Sep 17 00:00:00 2001 +From: Ray Strode +Date: Tue, 12 May 2020 10:12:26 -0400 +Subject: [PATCH] notify-send: Give failing exit code if showing notification + fails + +Right now notify-send will quietly return a successful exit status +even if showing the notification fails. + +This commit changes the behavior to instead fail on failure. + +https://gitlab.gnome.org/GNOME/libnotify/-/merge_requests/13 +--- + tools/notify-send.c | 18 ++++++++++++++---- + 1 file changed, 14 insertions(+), 4 deletions(-) + +diff --git a/tools/notify-send.c b/tools/notify-send.c +index 67e0b03..52fa46a 100644 +--- a/tools/notify-send.c ++++ b/tools/notify-send.c +@@ -105,61 +105,61 @@ notify_notification_set_hint_variant (NotifyNotification *notification, + N_("Invalid hint type \"%s\". Valid types " + "are int, double, string and byte."), + type); + return FALSE; + } + + if (conv_error) { + *error = g_error_new (G_OPTION_ERROR, + G_OPTION_ERROR_BAD_VALUE, + N_("Value \"%s\" of hint \"%s\" could not be " + "parsed as type \"%s\"."), value, key, + type); + return FALSE; + } + + return TRUE; + } + + int + main (int argc, char *argv[]) + { + static const char *summary = NULL; + char *body; + static const char *type = NULL; + static char *app_name = NULL; + static char *icon_str = NULL; + static char *icons = NULL; + static char **n_text = NULL; + static char **hints = NULL; + static gboolean do_version = FALSE; +- static gboolean hint_error = FALSE; ++ static gboolean hint_error = FALSE, show_error = FALSE; + static glong expire_timeout = NOTIFY_EXPIRES_DEFAULT; + GOptionContext *opt_ctx; + NotifyNotification *notify; + GError *error = NULL; + gboolean retval; + + static const GOptionEntry entries[] = { + {"urgency", 'u', 0, G_OPTION_ARG_CALLBACK, + g_option_arg_urgency_cb, + N_("Specifies the urgency level (low, normal, critical)."), + N_("LEVEL")}, + {"expire-time", 't', 0, G_OPTION_ARG_INT, &expire_timeout, + N_ + ("Specifies the timeout in milliseconds at which to expire the " + "notification."), N_("TIME")}, + {"app-name", 'a', 0, G_OPTION_ARG_STRING, &app_name, + N_("Specifies the app name for the icon"), N_("APP_NAME")}, + {"icon", 'i', 0, G_OPTION_ARG_FILENAME, &icons, + N_("Specifies an icon filename or stock icon to display."), + N_("ICON[,ICON...]")}, + {"category", 'c', 0, G_OPTION_ARG_FILENAME, &type, + N_("Specifies the notification category."), + N_("TYPE[,TYPE...]")}, + {"hint", 'h', 0, G_OPTION_ARG_FILENAME_ARRAY, &hints, + N_ + ("Specifies basic extra data to pass. Valid types are int, double, string and byte."), + N_("TYPE:NAME:VALUE")}, + {"version", 'v', 0, G_OPTION_ARG_NONE, &do_version, + N_("Version of the package."), + NULL}, +@@ -247,39 +247,49 @@ main (int argc, char *argv[]) + + while ((hint = hints[i++])) { + tokens = g_strsplit (hint, ":", 3); + l = g_strv_length (tokens); + + if (l != 3) { + fprintf (stderr, "%s\n", + N_("Invalid hint syntax specified. " + "Use TYPE:NAME:VALUE.")); + hint_error = TRUE; + } else { + retval = notify_notification_set_hint_variant (notify, + tokens[0], + tokens[1], + tokens[2], + &error); + + if (!retval) { + fprintf (stderr, "%s\n", error->message); + g_error_free (error); + hint_error = TRUE; + } + } + + g_strfreev (tokens); + if (hint_error) + break; + } + } + +- if (!hint_error) +- notify_notification_show (notify, NULL); ++ if (!hint_error) { ++ retval = notify_notification_show (notify, &error); ++ ++ if (!retval) { ++ fprintf (stderr, "%s\n", error->message); ++ g_error_free (error); ++ show_error = TRUE; ++ } ++ } + + g_object_unref (G_OBJECT (notify)); + + notify_uninit (); + +- exit (hint_error); ++ if (hint_error || show_error) ++ exit (1); ++ ++ return 0; + } +-- +2.33.1 + diff --git a/SOURCES/libnotify-0.7.9-consistent-ids.patch b/SOURCES/libnotify-0.7.9-consistent-ids.patch new file mode 100644 index 0000000..649cfb9 --- /dev/null +++ b/SOURCES/libnotify-0.7.9-consistent-ids.patch @@ -0,0 +1,26 @@ +From 34bf541f11b57995a019731e5a8d328422458bd3 Mon Sep 17 00:00:00 2001 +From: David King +Date: Mon, 13 Dec 2021 15:20:32 +0000 +Subject: [PATCH] docs: Use consistent IDs in spec build + +This avoids differences between IDs for separate builds of the +specification. + +https://bugzilla.redhat.com/show_bug.cgi?id=1915831 +--- + docs/config.xsl | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/docs/config.xsl b/docs/config.xsl +index 7aa9def..59490e7 100644 +--- a/docs/config.xsl ++++ b/docs/config.xsl +@@ -3,4 +3,5 @@ + xmlns:fo="http://www.w3.org/1999/XSL/Format" + version="1.0"> + ++ + +-- +2.33.1 + diff --git a/SPECS/libnotify.spec b/SPECS/libnotify.spec index bfc896c..f923dad 100644 --- a/SPECS/libnotify.spec +++ b/SPECS/libnotify.spec @@ -2,12 +2,18 @@ Name: libnotify Version: 0.7.9 -Release: 6%{?dist} +Release: 8%{?dist} Summary: Desktop notification library License: LGPLv2+ URL: http://www.gnome.org Source0: http://ftp.gnome.org/pub/GNOME/sources/libnotify/0.7/%{name}-%{version}.tar.xz +# https://bugzilla.redhat.com/show_bug.cgi?id=1915831# +# https://bugzilla.redhat.com/show_bug.cgi?id=1915831# +# https://bugzilla.redhat.com/show_bug.cgi?id=1915831 +Patch10001: libnotify-0.7.9-consistent-ids.patch + +Patch20001: 0001-notify-send-Give-failing-exit-code-if-showing-notifi.patch BuildRequires: docbook-xsl-ns BuildRequires: gdk-pixbuf2-devel @@ -36,7 +42,7 @@ This package contains libraries and header files needed for development of programs using %{name}. %prep -%setup -q +%autosetup -p1 %build %meson @@ -66,6 +72,13 @@ development of programs using %{name}. %doc %{_docdir}/libnotify/spec/ %changelog +* Wed Dec 22 2021 Ray Strode - 0.7.9-8 +- Make notify-send return failure when it fails + Resolves: #2017158 + +* Mon Dec 13 2021 David King - 0.7.9-7 +- Fix inconsistent IDs in specification (#1915831) + * Mon Aug 09 2021 Mohan Boddu - 0.7.9-6 - Rebuilt for IMA sigs, glibc 2.34, aarch64 flags Related: rhbz#1991688