Skip to contentSkip to conversation

fetch2/wget: Fix horrible temp file handling

PATCH New Richard Purdie 1 participant 1 message Dec 23, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fetch2/wget: Fix horrible temp file handling

Hardcoding a temp directory is bad practice and leads to races between the tests. There is no longer any good reason for doing this, drop it and ensure the files get cleaned up correctly.

bitbake/lib/bb/fetch2/wget.py +1 -2
index 2e6da48..b081b76 100644
@@ -174,7 +174,7 @@ class Wget(FetchMethod):
         """
         Run fetch checkstatus to get directory information
         """
-        f = tempfile.NamedTemporaryFile(dir="/tmp/s/", delete=False)
+        f = tempfile.NamedTemporaryFile()
 
         agent = "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101027 Ubuntu/9.10 (karmic) Firefox/3.6.12"
         fetchcmd = self.basecmd
@@ -186,7 +186,6 @@ class Wget(FetchMethod):
             fetchresult = ""
 
         f.close()
-        # os.unlink(f.name)
         return fetchresult
 
     def _check_latest_dir(self, url, versionstring, ud, d):