diff options
author | Jürg Billeter <j@bitron.ch> | 2019-02-01 16:21:09 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2019-02-11 05:12:25 +0000 |
commit | 99e1be4580244193149d1f123f6d948b0e0604a9 (patch) | |
tree | 7436d7ceecfabb92134c06b25af5184857bed888 | |
parent | 5e1be71f1816e4782eec50ad36ede227402be9b2 (diff) | |
download | buildstream-99e1be4580244193149d1f123f6d948b0e0604a9.tar.gz |
local.py: Do not follow symlinks in local directories
isdir() follows symlinks on the host, resulting in potential host
contamination. This change reorders the file checks to avoid this issue.
-rw-r--r-- | buildstream/plugins/sources/local.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/buildstream/plugins/sources/local.py b/buildstream/plugins/sources/local.py index 55cdc14d3..ea2f6e013 100644 --- a/buildstream/plugins/sources/local.py +++ b/buildstream/plugins/sources/local.py @@ -133,11 +133,11 @@ def unique_key(filename): # Return some hard coded things for files which # have no content to calculate a key for - if os.path.isdir(filename): - return "0" - elif os.path.islink(filename): + if os.path.islink(filename): # For a symbolic link, use the link target as its unique identifier return os.readlink(filename) + elif os.path.isdir(filename): + return "0" return utils.sha256sum(filename) |