wafsamba: let TO_LIST(mylist) return a copy of mylist
authorStefan Metzmacher <metze@samba.org>
Wed, 7 Jan 2015 08:41:02 +0000 (09:41 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 8 Jan 2015 22:38:06 +0000 (23:38 +0100)
In most cases we have TO_LIST(mystring) which returns an independent
list.

newlist = TO_LIST(mylist) returned just a reference to mylist.
Which means newlist.append("end") would also modify mylist.

TO_LIST() should always return an independent list.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
buildtools/wafsamba/samba_utils.py

index 0b0bb483781ae5341c6574b4da80b3be111dc383..9ac10666f391771de9bbbcb20d21c9eceee46f70 100644 (file)
@@ -214,7 +214,8 @@ def TO_LIST(str, delimiter=None):
     if str is None:
         return []
     if isinstance(str, list):
-        return str
+        # we need to return a new independent list...
+        return list(str)
     if len(str) == 0:
         return []
     lst = str.split(delimiter)