[oe-commits] Jader H. Silva : Kernel bbclass "too many open files" bugfix

GIT User account git at amethyst.openembedded.net
Thu Mar 12 16:27:31 UTC 2009


Module: openembedded.git
Branch: hrw/poky-merge/add-rpm-packages-support
Commit: 6d1ac1d90b8f0ff4614a90904d7e3c22ea15441a
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=6d1ac1d90b8f0ff4614a90904d7e3c22ea15441a

Author: Jader H. Silva <jader at 2mi.com.br>
Date:   Thu Mar 12 10:10:12 2009 -0300

Kernel bbclass "too many open files" bugfix

tempfile.mkstemp() is used to create a temporary file. This function
return a tuple with an OS file descriptor and a filename. Filename is
stored in "tmpfile" but descriptor is not stored anywhere, but it is
still open because it's only an integer to python so it is not closed at
the end of the function.

For each iteration in which this function is called, a new OS file
descriptor is opened, but not closed. The solution is to store the file
descriptor and close it.

---

 classes/kernel.bbclass |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/classes/kernel.bbclass b/classes/kernel.bbclass
index 86f00da..4c1dbda 100644
--- a/classes/kernel.bbclass
+++ b/classes/kernel.bbclass
@@ -295,12 +295,14 @@ python populate_packages_prepend () {
 	def extract_modinfo(file):
 		import tempfile, os, re
 		tempfile.tempdir = bb.data.getVar("WORKDIR", d, 1)
-		tmpfile = tempfile.mkstemp()[1]
+		tf = tempfile.mkstemp()
+		tmpfile = tf[1]
 		cmd = "PATH=\"%s\" %sobjcopy -j .modinfo -O binary %s %s" % (bb.data.getVar("PATH", d, 1), bb.data.getVar("HOST_PREFIX", d, 1) or "", file, tmpfile)
 		os.system(cmd)
 		f = open(tmpfile)
 		l = f.read().split("\000")
 		f.close()
+		os.close(tf[0])
 		os.unlink(tmpfile)
 		exp = re.compile("([^=]+)=(.*)")
 		vals = {}





More information about the Openembedded-commits mailing list