There is a nasty race condition in the code, which is easily fixed:

--- /usr/share/pyshared/VMBuilder/util.py.orig  2010-06-10 17:20:58.000000000 
+0000
+++ /usr/share/pyshared/VMBuilder/util.py       2014-06-19 10:57:09.723017475 
+0000
@@ -108,9 +108,12 @@
     mystdout = NonBlockingFile(proc.stdout, logfunc=logging.debug)
     mystderr = NonBlockingFile(proc.stderr, logfunc=(ignore_fail and 
logging.debug or logging.info))

-    while not (mystdout.closed and mystderr.closed):
+    while True:
+        fdset = [x.file for x in [mystdout, mystderr] if not x.closed]
+        if not fdset:
+            break
         # Block until either of them has something to offer
-        fds = select.select([x.file for x in [mystdout, mystderr] if not 
x.closed], [], [])[0]
+        fds = select.select(fdset, [], [])[0]
         for fp in [mystderr, mystdout]:
             if fp.file in fds:
                 fp.process_input()

Unfortunately that doesn't fix the problem :-(

Adding debugging shows that mystdout remains open, but does not show
ready to read from select().

Oddly, it seems that mystderr.closed becomes true almost immediately
after starting debootstrap.

2014-06-19 11:16:11,884 DEBUG   : Calling bootstrap method in context plugin 
VMBuilder.plugins.ubuntu.distro.
2014-06-19 11:16:11,884 DEBUG   : ['/usr/sbin/debootstrap', '--arch=i386', 
'trusty', '/tmp/tmpBQAxhc', 
'http://apt.ws.nsrc.org:3142/archive.ubuntu.com/ubuntu']
*** Starting ['/usr/sbin/debootstrap', '--arch=i386', 'trusty', 
'/tmp/tmpBQAxhc', 'http://apt.ws.nsrc.org:3142/archive.ubuntu.com/ubuntu'] ***
mystdout=<VMBuilder.util.NonBlockingFile object at 0x7fcade825550>, closed=False
mystderr=<VMBuilder.util.NonBlockingFile object at 0x7fcade825610>, closed=False
fdset=[<open file '<fdopen>', mode 'rb' at 0x7fcadea726f0>, <open file 
'<fdopen>', mode 'rb' at 0x7fcadea72780>]
selecting...
fds=[<open file '<fdopen>', mode 'rb' at 0x7fcadea72780>]
mystdout=<VMBuilder.util.NonBlockingFile object at 0x7fcade825550>, closed=False
mystderr=<VMBuilder.util.NonBlockingFile object at 0x7fcade825610>, closed=True
fdset=[<open file '<fdopen>', mode 'rb' at 0x7fcadea726f0>]
selecting...
fds=[<open file '<fdopen>', mode 'rb' at 0x7fcadea726f0>]

It could be true that debootstrap closes stderr immediately of course.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1287943

Title:
  vm-builder needs trusty suite

To manage notifications about this bug go to:
https://bugs.launchpad.net/vmbuilder/+bug/1287943/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to