From: Paul Eggleton Date: Thu, 22 Dec 2016 02:19:57 +0000 (+1300) Subject: lib/oe/path: add warning comment about oe.path.remove() with wildcarded filenames X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fff7563799f7ea049c290fc04484f96b69a744ca;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git lib/oe/path: add warning comment about oe.path.remove() with wildcarded filenames 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. (From OE-Core rev: 18cc0965741102bccc62dfb32ed7753cdacbadc7) Signed-off-by: Paul Eggleton Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- diff --git a/meta/lib/oe/path.py b/meta/lib/oe/path.py index 804ecd5fea9..d4685403c50 100644 --- a/meta/lib/oe/path.py +++ b/meta/lib/oe/path.py @@ -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)