~nova-coresec/ubuntu/maverick/libvirt/nova-ppa

« back to all changes in this revision

Viewing changes to debian/patches/9009-autodetect-nc-params.patch

  • Committer: Bazaar Package Importer
  • Author(s): Marc Deslauriers
  • Date: 2010-08-25 12:41:25 UTC
  • Revision ID: james.westby@ubuntu.com-20100825124125-nb0hjue2cku30yw8
Tags: 0.8.3-1ubuntu8
debian/patches/9009-autodetect-nc-params.patch: updated to fix
connecting to a remote server when using zsh or tcsh. (LP: #605172)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
Description: autodetect if the remote nc command supports the -q option
2
2
Author: Marc Deslauriers <marc.deslauriers@ubuntu.com>
3
3
Origin: other, based on http://hg.fedorahosted.org/hg/virt-manager/rev/1f781890ea4a
 
4
Origin: other, based on http://hg.fedorahosted.org/hg/virt-manager/rev/f09702cfdb03
 
5
Origin: other, based on http://hg.fedorahosted.org/hg/virt-manager/rev/907ee61e5558
 
6
Origin: other, based on http://hg.fedorahosted.org/hg/virt-manager/rev/16fcbf77e47e
4
7
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/517478
 
8
Ubuntu-Bug: https://bugs.launchpad.net/ubuntu/+source/virt-manager/+bug/605172
5
9
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=562176
 
10
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=614420
6
11
 
7
12
Index: libvirt-0.8.3/src/remote/remote_driver.c
8
13
===================================================================
9
 
--- libvirt-0.8.3.orig/src/remote/remote_driver.c       2010-08-11 16:32:56.000000000 -0500
10
 
+++ libvirt-0.8.3/src/remote/remote_driver.c    2010-08-11 17:12:01.000000000 -0500
 
14
--- libvirt-0.8.3.orig/src/remote/remote_driver.c       2010-08-25 12:32:54.000000000 -0400
 
15
+++ libvirt-0.8.3/src/remote/remote_driver.c    2010-08-25 12:39:59.000000000 -0400
11
16
@@ -730,7 +730,8 @@
12
17
     }
13
18
 
14
19
     case trans_ssh: {
15
20
-        int j, nr_args = 6;
16
 
+        int j, nr_args = 4;
 
21
+        int j, nr_args = 5;
17
22
+        virBuffer cmd_netcat = VIR_BUFFER_INITIALIZER;
18
23
 
19
24
         if (username) nr_args += 2; /* For -l username */
20
25
         if (no_tty) nr_args += 5;   /* For -T -o BatchMode=yes -e none */
21
 
@@ -763,12 +764,37 @@
 
26
@@ -763,12 +764,44 @@
22
27
             cmd_argv[j++] = strdup ("none");
23
28
         }
24
29
         cmd_argv[j++] = strdup (priv->hostname);
28
33
-                                (flags & VIR_CONNECT_RO
29
34
-                                 ? LIBVIRTD_PRIV_UNIX_SOCKET_RO
30
35
-                                 : LIBVIRTD_PRIV_UNIX_SOCKET));
 
36
+        cmd_argv[j++] = strdup ("sh -c");
31
37
+
32
38
+       /*
33
39
+        * This ugly thing is a shell script to detect availability of
40
46
+        * to the desired behavior.
41
47
+        */
42
48
+
43
 
+        virBufferVSprintf(&cmd_netcat, "%s -q 2>&1 | grep -q 'requires an argument';"
 
49
+        virBufferVSprintf(&cmd_netcat, "'%s -q 2>&1 | grep -q \"requires an argument\";"
44
50
+                                       "if [ $? -eq 0 ] ; then"
45
 
+                                       "   CMD='-q 0';"
 
51
+                                       "   CMD=\"%s -q 0 -U %s\";"
46
52
+                                       "else"
47
 
+                                       "   CMD='';"
48
 
+                                       "fi;%s $CMD -U %s",
49
 
+                                       netcat ? netcat : "nc",
 
53
+                                       "   CMD=\"%s -U %s\";"
 
54
+                                       "fi;"
 
55
+                                       "eval \"$CMD\";'",
 
56
+                                       netcat ? netcat : "nc",
 
57
+                                       netcat ? netcat : "nc",
 
58
+                                       sockname ? sockname :
 
59
+                                        (flags & VIR_CONNECT_RO
 
60
+                                         ? LIBVIRTD_PRIV_UNIX_SOCKET_RO
 
61
+                                         : LIBVIRTD_PRIV_UNIX_SOCKET),
50
62
+                                       netcat ? netcat : "nc",
51
63
+                                       sockname ? sockname :
52
64
+                                        (flags & VIR_CONNECT_RO