Public bug reported:

After working around https://bugs.launchpad.net/ubuntu/+source/oem-
config/+bug/1361595, oem-config still does not properly run on server
based installs.

Code that had previously worked under python 2.x (used in 12.04 LTS,
AFAICT) is now too aggressive under python 3.x (used in 14.04 LTS).
This is resulting the the file descriptor for /dev/urandom being closed
prematurely in open_terminal(), due to the following section:

        for i in range(tty):
            if i != 2:
                os.close(i)

However, as reported here: http://bugs.python.org/issue21207, once the
urandom persistent fd is closed it wasn't being reopend.  Given this
report is from April of 2014, I'm pretty sure the version of python
shipped with 14.04 LTS has the same behavior.

Sure enough, if I prevent oem-config from closing the fd for
/dev/urandom, oem-config is finally able to at least run.

The following is how I've solved the problem so far.

        # need to avoid closing the FD for /dev/urandom
        # http://bugs.python.org/issue21207
        urand_inode = os.stat('/dev/urandom').st_ino
        for i in range(tty):
            if i != 2:
                inode = os.fstat(i).st_ino
                if inode != urand_inode:
                    os.close(i)

** Affects: oem-config (Ubuntu)
     Importance: Undecided
         Status: New

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

Title:
  OSError: [Errno 9] Bad file descriptor

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/oem-config/+bug/1362920/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to