From 715d857174ceca82b85d6c8c7df520047ba7fb0c Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Mon, 17 Aug 2015 12:12:16 +0100 Subject: bitbake: Fix default function parameter assignment to a list With python you should not assign a list as the default value of a function parameter - because a list is mutable, the result will be that the first time a value is passed it will actually modify the default. Reference: http://docs.python-guide.org/en/latest/writing/gotchas/#mutable-default-arguments (Bitbake rev: 7859f7388f2e3f675d0e1527cfde18625f36f637) Signed-off-by: Paul Eggleton Signed-off-by: Richard Purdie --- bitbake/lib/bb/process.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'bitbake/lib/bb/process.py') diff --git a/bitbake/lib/bb/process.py b/bitbake/lib/bb/process.py index 7c797852ed..1c07f2d9b7 100644 --- a/bitbake/lib/bb/process.py +++ b/bitbake/lib/bb/process.py @@ -128,10 +128,13 @@ def _logged_communicate(pipe, log, input, extrafiles): pipe.stderr.close() return ''.join(outdata), ''.join(errdata) -def run(cmd, input=None, log=None, extrafiles=[], **options): +def run(cmd, input=None, log=None, extrafiles=None, **options): """Convenience function to run a command and return its output, raising an exception when the command fails""" + if not extrafiles: + extrafiles = [] + if isinstance(cmd, basestring) and not "shell" in options: options["shell"] = True -- cgit v1.2.3-54-g00ecf