[udisks/f16] Add patch to neuter the annoying systemd behavior where stdout/stderr is sent to the system logs (#7

David Zeuthen davidz at fedoraproject.org
Tue Oct 18 16:28:27 UTC 2011


commit a88c1035d97b24d229bd268162d7bb1c7141b84e
Author: David Zeuthen <davidz at redhat.com>
Date:   Tue Oct 18 12:28:12 2011 -0400

    Add patch to neuter the annoying systemd behavior where stdout/stderr
    is sent to the system logs (#743344)
    
    Signed-off-by: David Zeuthen <davidz at redhat.com>

 udisks-1.0.4-neuter-stdout-and-stderr.patch |   74 +++++++++++++++++++++++++++
 udisks.spec                                 |    9 +++-
 2 files changed, 82 insertions(+), 1 deletions(-)
---
diff --git a/udisks-1.0.4-neuter-stdout-and-stderr.patch b/udisks-1.0.4-neuter-stdout-and-stderr.patch
new file mode 100644
index 0000000..95cceb9
--- /dev/null
+++ b/udisks-1.0.4-neuter-stdout-and-stderr.patch
@@ -0,0 +1,74 @@
+From 072654b3ea2591e05cfbe80c06a00858e63f1f1a Mon Sep 17 00:00:00 2001
+From: David Zeuthen <davidz at redhat.com>
+Date: Tue, 18 Oct 2011 12:19:22 -0400
+Subject: [PATCH] udisks-daemon: Add --no-debug option and use this for D-Bus
+ activation
+
+Signed-off-by: David Zeuthen <davidz at redhat.com>
+---
+ data/org.freedesktop.UDisks.service.in |    2 +-
+ src/main.c                             |   28 ++++++++++++++++++++++++----
+ 2 files changed, 25 insertions(+), 5 deletions(-)
+
+diff --git a/data/org.freedesktop.UDisks.service.in b/data/org.freedesktop.UDisks.service.in
+index b3606a6..bc3542a 100644
+--- a/data/org.freedesktop.UDisks.service.in
++++ b/data/org.freedesktop.UDisks.service.in
+@@ -1,5 +1,5 @@
+ [D-BUS Service]
+ Name=org.freedesktop.UDisks
+-Exec=@libexecdir@/udisks-daemon
++Exec=@libexecdir@/udisks-daemon --no-debug
+ User=root
+ 
+diff --git a/src/main.c b/src/main.c
+index 318db27..6e220b1 100644
+--- a/src/main.c
++++ b/src/main.c
+@@ -141,12 +141,13 @@ main (int argc,
+   static char *helper_dir = NULL;
+   char *path;
+   int ret;
+-  static gboolean replace;
++  static gboolean replace = FALSE;
++  static gboolean no_debug = FALSE;
+   static GOptionEntry entries[] =
+     {
+-      { "replace", 0, 0, G_OPTION_ARG_NONE, &replace, "Replace existing daemon", NULL },
+-      { "helper-dir", 0, G_OPTION_FLAG_FILENAME, G_OPTION_ARG_STRING,
+-	  &helper_dir, "Directory for helper tools",  NULL },
++      { "no-debug", 'n', 0, G_OPTION_ARG_NONE, &no_debug, "Don't print debug information", NULL },
++      { "replace", 'r', 0, G_OPTION_ARG_NONE, &replace, "Replace existing daemon", NULL },
++      { "helper-dir", 0, 0, G_OPTION_ARG_FILENAME, &helper_dir, "Directory for helper tools",  NULL },
+       { NULL } };
+ 
+   PROFILE ("main(): start");
+@@ -181,6 +182,25 @@ main (int argc,
+   g_option_context_parse (context, &argc, &argv, NULL);
+   g_option_context_free (context);
+ 
++  /* If --no-debug is requested don't clutter stdout/stderr etc.
++   */
++  if (no_debug)
++    {
++      gint dev_null_fd;
++      dev_null_fd = open ("/dev/null", O_RDWR);
++      if (dev_null_fd >= 0)
++        {
++          dup2 (dev_null_fd, STDIN_FILENO);
++          dup2 (dev_null_fd, STDOUT_FILENO);
++          dup2 (dev_null_fd, STDERR_FILENO);
++          close (dev_null_fd);
++        }
++      else
++        {
++          g_warning ("Error opening /dev/null: %m");
++        }
++    }
++
+   /* run with a controlled path */
+   if (helper_dir != NULL)
+       path = g_strdup_printf ("%s:" PACKAGE_LIBEXEC_DIR ":/sbin:/bin:/usr/sbin:/usr/bin", helper_dir);
+-- 
+1.7.6.4
+
diff --git a/udisks.spec b/udisks.spec
index ba966da..5ff940e 100644
--- a/udisks.spec
+++ b/udisks.spec
@@ -13,7 +13,7 @@
 Summary: Storage Management Service
 Name: udisks
 Version: 1.0.4
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: GPLv2+
 Group: System Environment/Libraries
 URL: http://www.freedesktop.org/wiki/Software/udisks
@@ -63,6 +63,8 @@ Conflicts: kernel < 2.6.26
 Obsoletes: DeviceKit-disks <= 009
 Provides: DeviceKit-disks = 010
 
+Patch0: udisks-1.0.4-neuter-stdout-and-stderr.patch
+
 %description
 udisks provides a daemon, D-Bus API and command line tools
 for managing disks and storage devices.
@@ -82,6 +84,7 @@ D-Bus interface definitions and documentation for udisks.
 
 %prep
 %setup -q
+%patch0 -p1
 
 # https://bugzilla.redhat.com/show_bug.cgi?id=673544#c15
 rm -f src/*-glue.h tools/*-glue.h
@@ -144,6 +147,10 @@ chmod 0644 $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/udisks-bash-completion.sh
 
 # Note: please don't forget the %{?dist} in the changelog. Thanks
 %changelog
+* Tue Oct 18 2011 David Zeuthen <davidz at redhat.com> - 1.0.4-2%{?dist}
+- Add patch to neuter the annoying systemd behavior where stdout/stderr
+  is sent to the system logs (#743344)
+
 * Fri Aug 26 2011 David Zeuthen <davidz at redhat.com> - 1.0.4-1%{?dist}
 - Update to release 1.0.4 and update BR + files to reflect that lvm2 is no
   longer enabled given recommendations from upstream (lvm2 support in


More information about the scm-commits mailing list