[Pkg-libvirt-commits] [SCM] Libvirt Debian packaging branch, master, updated. debian/0.8.3-3

Guido Günther agx at sigxcpu.org
Fri Oct 8 12:08:32 UTC 2010


The following commit has been merged in the master branch:
commit 4db74514b613ab42d070fa69f61967f009339c32
Author: Guido Günther <agx at sigxcpu.org>
Date:   Wed Oct 6 18:13:44 2010 +0200

    Don't hardcode netcat's -q option.
    
    Thanks: Marc Deslauriers
    Closes: #573172

diff --git a/debian/patches/0005-Autodetect-if-the-remote-nc-command-supports-the-q-o.patch b/debian/patches/0005-Autodetect-if-the-remote-nc-command-supports-the-q-o.patch
new file mode 100644
index 0000000..5c2bdf1
--- /dev/null
+++ b/debian/patches/0005-Autodetect-if-the-remote-nc-command-supports-the-q-o.patch
@@ -0,0 +1,83 @@
+From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx at sigxcpu.org>
+Date: Wed, 6 Oct 2010 18:12:46 +0200
+Subject: [PATCH] Autodetect if the remote nc command supports the -q option
+
+Author: Marc Deslauriers <marc.deslauriers at ubuntu.com>
+Origin: other, based on http://hg.fedorahosted.org/hg/virt-manager/rev/1f781890ea4a
+Origin: other, based on http://hg.fedorahosted.org/hg/virt-manager/rev/f09702cfdb03
+Origin: other, based on http://hg.fedorahosted.org/hg/virt-manager/rev/907ee61e5558
+Origin: other, based on http://hg.fedorahosted.org/hg/virt-manager/rev/16fcbf77e47e
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/517478
+Ubuntu-Bug: https://bugs.launchpad.net/ubuntu/+source/virt-manager/+bug/605172
+Bug: https://bugzilla.redhat.com/show_bug.cgi?id=562176
+Bug: https://bugzilla.redhat.com/show_bug.cgi?id=614420
+---
+ src/remote/remote_driver.c |   47 +++++++++++++++++++++++++++++++++++++------
+ 1 files changed, 40 insertions(+), 7 deletions(-)
+
+diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
+index cb0d8e1..5fab9c1 100644
+--- a/src/remote/remote_driver.c
++++ b/src/remote/remote_driver.c
+@@ -730,7 +730,8 @@ doRemoteOpen (virConnectPtr conn,
+     }
+ 
+     case trans_ssh: {
+-        int j, nr_args = 6;
++        int j, nr_args = 5;
++        virBuffer cmd_netcat = VIR_BUFFER_INITIALIZER;
+ 
+         if (username) nr_args += 2; /* For -l username */
+         if (no_tty) nr_args += 5;   /* For -T -o BatchMode=yes -e none */
+@@ -763,12 +764,44 @@ doRemoteOpen (virConnectPtr conn,
+             cmd_argv[j++] = strdup ("none");
+         }
+         cmd_argv[j++] = strdup (priv->hostname);
+-        cmd_argv[j++] = strdup (netcat ? netcat : "nc");
+-        cmd_argv[j++] = strdup ("-U");
+-        cmd_argv[j++] = strdup (sockname ? sockname :
+-                                (flags & VIR_CONNECT_RO
+-                                 ? LIBVIRTD_PRIV_UNIX_SOCKET_RO
+-                                 : LIBVIRTD_PRIV_UNIX_SOCKET));
++        cmd_argv[j++] = strdup ("sh -c");
++
++	/*
++	 * This ugly thing is a shell script to detect availability of
++	 * the -q option for 'nc': debian and suse based distros need this
++	 * flag to ensure the remote nc will exit on EOF, so it will go away
++	 * when we close the VNC tunnel. If it doesn't go away, subsequent
++	 * VNC connection attempts will hang.
++	 *
++	 * Fedora's 'nc' doesn't have this option, and apparently defaults
++	 * to the desired behavior.
++	 */
++
++        virBufferVSprintf(&cmd_netcat, "'%s -q 2>&1 | grep -q \"requires an argument\";"
++                                       "if [ $? -eq 0 ] ; then"
++                                       "   CMD=\"%s -q 0 -U %s\";"
++                                       "else"
++                                       "   CMD=\"%s -U %s\";"
++                                       "fi;"
++                                       "eval \"$CMD\";'",
++                                       netcat ? netcat : "nc",
++                                       netcat ? netcat : "nc",
++                                       sockname ? sockname :
++                                        (flags & VIR_CONNECT_RO
++                                         ? LIBVIRTD_PRIV_UNIX_SOCKET_RO
++                                         : LIBVIRTD_PRIV_UNIX_SOCKET),
++                                       netcat ? netcat : "nc",
++                                       sockname ? sockname :
++                                        (flags & VIR_CONNECT_RO
++                                         ? LIBVIRTD_PRIV_UNIX_SOCKET_RO
++                                         : LIBVIRTD_PRIV_UNIX_SOCKET));
++
++        if (virBufferError(&cmd_netcat)) {
++            virBufferFreeAndReset(&cmd_netcat);
++            goto out_of_memory;
++        }
++
++        cmd_argv[j++] = virBufferContentAndReset(&cmd_netcat);
+         cmd_argv[j++] = 0;
+         assert (j == nr_args);
+         for (j = 0; j < (nr_args-1); j++)
+-- 
diff --git a/debian/patches/0005-Terminate-nc-on-EOF.patch b/debian/patches/0005-Terminate-nc-on-EOF.patch
deleted file mode 100644
index e566cdc..0000000
--- a/debian/patches/0005-Terminate-nc-on-EOF.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From: Gabor Gombas <gombasg at sztaki.hu>
-Date: Fri, 8 Jan 2010 11:00:07 +0100
-Subject: [PATCH] Terminate nc on EOF
-
-Closes: #564053
----
- src/remote/remote_driver.c |    4 +++-
- 1 files changed, 3 insertions(+), 1 deletions(-)
-
-diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
-index cb0d8e1..9ef2ab3 100644
---- a/src/remote/remote_driver.c
-+++ b/src/remote/remote_driver.c
-@@ -730,7 +730,7 @@ doRemoteOpen (virConnectPtr conn,
-     }
- 
-     case trans_ssh: {
--        int j, nr_args = 6;
-+        int j, nr_args = 8;
- 
-         if (username) nr_args += 2; /* For -l username */
-         if (no_tty) nr_args += 5;   /* For -T -o BatchMode=yes -e none */
-@@ -764,6 +764,8 @@ doRemoteOpen (virConnectPtr conn,
-         }
-         cmd_argv[j++] = strdup (priv->hostname);
-         cmd_argv[j++] = strdup (netcat ? netcat : "nc");
-+        cmd_argv[j++] = strdup ("-q");
-+        cmd_argv[j++] = strdup ("0");
-         cmd_argv[j++] = strdup ("-U");
-         cmd_argv[j++] = strdup (sockname ? sockname :
-                                 (flags & VIR_CONNECT_RO
--- 
diff --git a/debian/patches/series b/debian/patches/series
index 1046874..d75dcc4 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,6 +2,6 @@
 0002-qemu-disable-network.diff.patch
 0003-allow-libvirt-group-to-access-the-socket.patch
 0004-fix-Debian-specific-path-to-hvm-loader.patch
-0005-Terminate-nc-on-EOF.patch
+0005-Autodetect-if-the-remote-nc-command-supports-the-q-o.patch
 0006-patch-qemuMonitorTextGetMigrationStatus-to-intercept.patch
 0007-Fix-block-statistics-with-newer-versions-of-Xen.patch

-- 
Libvirt Debian packaging



More information about the Pkg-libvirt-commits mailing list