]> code.ossystems Code Review - openembedded-core.git/commitdiff
lib/oe/path: add warning comment about oe.path.remove() with wildcarded filenames
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Thu, 22 Dec 2016 02:19:57 +0000 (15:19 +1300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 9 Jan 2017 13:27:00 +0000 (13:27 +0000)
Add a warning in the doc comment for oe.path.remove() about using that
function on paths that may contain wildcards in the actual
file/directory names.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/lib/oe/path.py

index 804ecd5fea96e5709d967bb5a7e9085d1508b6f1..d4685403c5070a70b40fede6de78bf2e4fdaf783 100644 (file)
@@ -92,7 +92,14 @@ def copyhardlinktree(src, dst):
         copytree(src, dst)
 
 def remove(path, recurse=True):
-    """Equivalent to rm -f or rm -rf"""
+    """
+    Equivalent to rm -f or rm -rf
+    NOTE: be careful about passing paths that may contain filenames with
+    wildcards in them (as opposed to passing an actual wildcarded path) -
+    since we use glob.glob() to expand the path. Filenames containing
+    square brackets are particularly problematic since the they may not
+    actually expand to match the original filename.
+    """
     for name in glob.glob(path):
         try:
             os.unlink(name)