@@ -355,7 +355,11 @@ def canonicalize(paths, sep=','):
# prefixes in sting compares later on, where the slashes then are important.
canonical_paths = []
for path in (paths or '').split(sep):
- if '$' not in path:
+ # Skip empty tokens as well as unexpanded bitbake variables: an
+ # empty path would otherwise reach os.path.realpath(''), which
+ # returns the current working directory, so canonicalize('') or
+ # canonicalize(None) would wrongly produce the cwd instead of ''.
+ if path and '$' not in path:
trailing_slash = path.endswith('/') and '/' or ''
canonical_paths.append(os.path.realpath(path) + trailing_slash)
canonicalize() splits its input on the separator and, for every token that does not contain an unexpanded bitbake variable, appends os.path.realpath(path). It never guarded against an empty token, and os.path.realpath('') returns the current working directory. So canonicalize('') and canonicalize(None) produced the cwd instead of an empty result, and a stray separator such as 'a,,b' injected a spurious cwd entry between the real paths. Skip empty tokens alongside the '$' tokens the loop already skips, so empty input canonicalizes to '' and redundant separators no longer introduce phantom cwd entries. AI-Generated: codex/claude-opus 4.8 (xhigh) Signed-off-by: Trevor Woerner <twoerner@gmail.com> --- src/wic/oe/path.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)