Patchwork [bitbake-devel] bitbake/ Ensure utils.which() returns full paths

mail settings
Submitter Richard Purdie
Date May 24, 2012, 12:57 p.m.
Message ID <1337864236.8248.111.camel@ted>
Download mbox | patch
Permalink /patch/28609/
State New
Headers show


Richard Purdie - May 24, 2012, 12:57 p.m.
If the path passed to which contains empty elements, it will search
the current working directory for the file which is correct baheviour.

Various pieces of code assume the path returned is a full path though.
This commit ensures we don't return relative paths.

Signed-off-by: Richard Purdie <>


diff --git a/bitbake/lib/bb/ b/bitbake/lib/bb/
index 7a73419..fc389a3 100644
--- a/bitbake/lib/bb/
+++ b/bitbake/lib/bb/
@@ -721,6 +721,8 @@  def which(path, item, direction = 0):
     for p in paths:
         next = os.path.join(p, item)
         if os.path.exists(next):
+            if not os.path.isabs(next):
+                next = os.path.abspath(next)
             return next
     return ""