[llvm] r313765 - [lit] Reverse path list when updating environment vars.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 20 10:08:20 PDT 2017
Author: zturner
Date: Wed Sep 20 10:08:20 2017
New Revision: 313765
URL: http://llvm.org/viewvc/llvm-project?rev=313765&view=rev
Log:
[lit] Reverse path list when updating environment vars.
Bug pointed out by EricWF. This would construct a path where
items would be added in the wrong order, potentially leading
to using the wrong tools for testing.
Modified:
llvm/trunk/utils/lit/lit/llvm/config.py
Modified: llvm/trunk/utils/lit/lit/llvm/config.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/llvm/config.py?rev=313765&r1=313764&r2=313765&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/llvm/config.py (original)
+++ llvm/trunk/utils/lit/lit/llvm/config.py Wed Sep 20 10:08:20 2017
@@ -106,7 +106,10 @@ class LLVMConfig(object):
current_paths = self.config.environment.get(variable, "")
current_paths = current_paths.split(os.path.pathsep)
paths = [norm(p) for p in current_paths]
- for p in paths_to_add:
+ # If we are passed a list [a b c], then iterating this list forwards
+ # and adding each to the beginning would result in b c a. So we
+ # need to iterate in reverse to end up with the original ordering.
+ for p in reversed(paths_to_add):
# Move it to the front if it already exists, otherwise insert it at the
# beginning.
p = norm(p)
More information about the llvm-commits
mailing list