<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    I am not being able to apply it due the following error:<br>
    <br>
    [alinefm@alinefm-TP440 kimchi]$ git am -3
    /home/alinefm/mail-patches/\[Kimchi-devel\]\ \[PATCH\]\ \[Kimchi\
    1_1\]\ Fix\ issue\ #1170\:\ ERROR\:KCHVM0090E\:\ Unable\ to\ create\
    a\ password-less\ libvirt\ connection\ to\ the\ remote\ libvirt\
    daemon.eml<br>
    Applying: Fix issue #1170: ERROR:KCHVM0090E: Unable to create a
    password-less libvirt connection to the remote libvirt daemon<br>
    error: corrupt patch at line 11<br>
    error: could not build fake ancestor<br>
    Patch failed at 0001 Fix issue #1170: ERROR:KCHVM0090E: Unable to
    create a password-less libvirt connection to the remote libvirt
    daemon<br>
    The copy of the patch that failed is found in:
    /home/alinefm/wok/.git/modules/src/wok/plugins/kimchi/rebase-apply/patch<br>
    When you have resolved this problem, run "git am --continue".<br>
    If you prefer to skip this patch, run "git am --skip" instead.<br>
    To restore the original branch and stop patching, run "git am
    --abort".<br>
    [alinefm@alinefm-TP440 kimchi]$ vi
    /home/alinefm/mail-patches/\[Kimchi-devel\]\ \[PATCH\]\ \[Kimchi\
    1_1\]\ Fix\ issue\ #1170\:\ ERROR\:KCHVM0090E\:\ Unable\ to\ create\
    a\ password-less\ libvirt\ connection\ to\ the\ remote\ libvirt\
    daemon.eml <br>
    [alinefm@alinefm-TP440 kimchi]$ git am --abort <br>
    <br>
    <br>
    Seems the patch gets corrupted in some way. <br>
    <br>
    Also, looking again to the patch, maybe it is simpler to just remove
    the sdtout parameter from Popen.<br>
    <br>
    <div class="moz-cite-prefix">On 10/31/2017 04:06 AM, Fu.Lin wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:d12967eb-a86d-4f09-ab57-54c81044233d@suse.com">
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <p><tt>Long ago, I submitted an issue: <a
            class="moz-txt-link-freetext"
            href="https://github.com/kimchi-project/kimchi/issues/1170"
            moz-do-not-send="true">https://github.com/kimchi-project/kimchi/issues/1170</a>
          ...</tt></p>
      <p><tt>Test by following script:</tt></p>
      <blockquote>
        <p><tt>import subprocess<br>
            import os<br>
            import time<br>
            <br>
            def _check_remote_libvirt_conn(remote_host,<br>
                    user='root', transport='ssh'):<br>
            <br>
                FNULL = open(os.devnull, 'w')<br>
                dest_uri = 'qemu+%s://%s@%s/system' % (transport, user,
            remote_host)<br>
                cmd = ['virsh', '-c', dest_uri, 'list']<br>
                proc = subprocess.Popen(cmd, stdout=FNULL, stderr=FNULL,<br>
                        shell=True, preexec_fn=os.setsid)<br>
                timeout = 0<br>
                while proc.poll() is None:<br>
                    time.sleep(1)<br>
                    timeout += 1<br>
                    if timeout == 5:<br>
                        print("killed")<br>
                        os.killpg(os.getpgid(proc.pid), signal.SIGTERM)<br>
            <br>
            if __name__ == '__main__':<br>
                _check_remote_libvirt_conn('localhost')</tt></p>
      </blockquote>
      <p><tt>`proc` is timeout every time although the connection is
          normal tested by `virsh -c &lt;uri&gt;` list <br>
        </tt></p>
      <p><tt><br>
        </tt></p>
      <p><tt>The following is the reason of changing(From Python
          Document 2.7.14):<br>
        </tt></p>
      <p><tt> Do not use stdout=PIPE or stderr=PIPE with this function
          as <font color="#330099">that can deadlock</font> based on
          the child process output volume. Use Popen with the
          communicate() method when you need pipes.</tt></p>
      <p><tt> Using shell=True can be <font color="#330099">a security
            hazard</font>. See the warning under Frequently Used
          Arguments for details.<br>
        </tt></p>
      <p><tt>At the same time, if not change, it does not work.<br>
        </tt></p>
      <p><tt><br>
        </tt></p>
      <p><tt>diff --git a/model/vms.py b/model/vms.py</tt><tt><br>
        </tt><tt>index 6da4f3b..92e771f 100644</tt><tt><br>
        </tt><tt>--- a/model/vms.py</tt><tt><br>
        </tt><tt>+++ b/model/vms.py</tt><tt><br>
        </tt><tt>@@ -1885,10 +1885,11 @@ class VMModel(object):</tt><tt><br>
        </tt><tt>     def _check_remote_libvirt_conn(self, remote_host,</tt><tt><br>
        </tt><tt>                                    user='root',
          transport='ssh'):</tt><tt><br>
        </tt><tt> </tt><tt><br>
        </tt><tt>+        FNULL = open(os.devnull, 'w')</tt><tt><br>
        </tt><tt>         dest_uri = 'qemu+%s://%s@%s/system' %
          (transport, user, remote_host)</tt><tt><br>
        </tt><tt>         cmd = ['virsh', '-c', dest_uri, 'list']</tt><tt><br>
        </tt><tt>-        proc = subprocess.Popen(cmd,
          stdout=subprocess.PIPE,</tt><tt><br>
        </tt><tt>-                                shell=True,
          preexec_fn=os.setsid)</tt><tt><br>
        </tt><tt>+        proc = subprocess.Popen(cmd, stdout=FNULL,
          stderr=FNULL,</tt><tt><br>
        </tt><tt>+                                shell=False,
          preexec_fn=os.setsid)</tt><tt><br>
        </tt><tt>         timeout = 0</tt><tt><br>
        </tt><tt>         while proc.poll() is None:</tt><tt><br>
        </tt><tt>             time.sleep(1)</tt><br>
        <br>
      </p>
      <pre class="moz-signature" cols="72">-- 
Regards
River (Fu.Lin)</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Kimchi-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Kimchi-devel@ovirt.org">Kimchi-devel@ovirt.org</a>
<a class="moz-txt-link-freetext" href="http://lists.ovirt.org/mailman/listinfo/kimchi-devel">http://lists.ovirt.org/mailman/listinfo/kimchi-devel</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>