]> code.ossystems Code Review - openembedded-core.git/commitdiff
recipetool: create: prevent attempting to unpack entire DL_DIR
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Tue, 22 Dec 2015 04:02:59 +0000 (17:02 +1300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 22 Dec 2015 16:44:03 +0000 (16:44 +0000)
If you specify a URL ending in /, BitBake's fetcher returns a localpath
of ${DL_DIR}, and if you then try to unpack that it will attempt to copy
the entire DL_DIR contents to the destination - which at least on my
system filled my entire /tmp. Obviously we should fix the fetcher, but
at least detect and stop that from happening here for now.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/lib/scriptutils.py

index 4dd7ef2a0d1792a76d6187056fe8bf754148dbb6..69e76d8ea2603d4e2e761a531690b4a42a46d188 100644 (file)
@@ -86,6 +86,10 @@ def fetch_uri(d, uri, destdir, srcrev=None):
             ud = fetcher.ud[u]
             ud.ignore_checksums = True
         fetcher.download()
+        for u in fetcher.ud:
+            ud = fetcher.ud[u]
+            if ud.localpath.rstrip(os.sep) == localdata.getVar('DL_DIR', True).rstrip(os.sep):
+                raise Exception('Local path is download directory - please check that the URI "%s" is correct' % uri)
         fetcher.unpack(destdir)
         for u in fetcher.ud:
             ud = fetcher.ud[u]