diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2018-01-09 15:43:03 +0000 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2018-01-09 17:48:06 +0000 |
commit | 0a6d74cd036f2aeffafc053cbd1ce3fc60ced16c (patch) | |
tree | b2cdfbd1ac85721a468dab156124bd21fe9f1e8a | |
parent | 37562b10f15de2f31f7d78ed8d82100c4fac8cf1 (diff) | |
download | buildstream-sam/local-source-cachekey-fix.tar.gz |
utils.py: Sort the results of list_relative_paths()sam/local-source-cachekey-fix
This fixes a serious issue in the 'local' source plugin: this source
type generates its unique key from the list of filenames it pulls in
from the local machine, but the list would be unsorted so cache keys
would randomly vary.
Rather than fix this in the specific plugin, we chose to fix the
public utility function that generates the list of filenames to reduce
the chance of this mistake being repeated elsewhere.
-rw-r--r-- | buildstream/utils.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/buildstream/utils.py b/buildstream/utils.py index 2b6c4517c..e8b15bc48 100644 --- a/buildstream/utils.py +++ b/buildstream/utils.py @@ -104,6 +104,8 @@ def list_relative_paths(directory): Relative filenames in `directory` """ for (dirpath, dirnames, filenames) in os.walk(directory): + dirnames.sort() + filenames.sort() relpath = os.path.relpath(dirpath, directory) |