From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id CF88713888F for ; Tue, 6 Oct 2015 06:27:56 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 82CFFE07D6; Tue, 6 Oct 2015 06:27:54 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 0D741E07D6 for ; Tue, 6 Oct 2015 06:27:53 +0000 (UTC) Received: from professor-x (S010634bdfa9ecf80.vc.shawcable.net [96.49.31.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dolsen) by smtp.gentoo.org (Postfix) with ESMTPSA id AB18D340836 for ; Tue, 6 Oct 2015 06:27:52 +0000 (UTC) Date: Mon, 5 Oct 2015 23:27:03 -0700 From: Brian Dolbec To: gentoo-catalyst@lists.gentoo.org Subject: Re: [gentoo-catalyst] [PATCH] lint: fix bad env dict handling Message-ID: <20151005232703.613ac61e.dolsen@gentoo.org> In-Reply-To: <1444103282-14476-1-git-send-email-vapier@gentoo.org> References: <1444103282-14476-1-git-send-email-vapier@gentoo.org> Organization: Gentoo Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-catalyst@lists.gentoo.org Reply-to: gentoo-catalyst@lists.gentoo.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Archives-Salt: 29ff0a1d-7cfb-4c55-8cfd-20e0cd680579 X-Archives-Hash: 42efc82409079747fac28d9e8b9276a2 On Mon, 5 Oct 2015 23:48:02 -0400 Mike Frysinger wrote: > By using a kwarg default of {}, the value is retained across multiple > calls (and the linter warns about it). Use the standard "if None" > style to avoid that. > > Also fix the write to the dict passed in by creating a local copy > before we insert BASH_ENV into it. > --- > catalyst/support.py | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/catalyst/support.py b/catalyst/support.py > index b6705c9..78942a7 100644 > --- a/catalyst/support.py > +++ b/catalyst/support.py > @@ -120,11 +120,14 @@ def find_binary(myc): > return None > > > -def cmd(mycmd, myexc="", env={}, debug=False, fail_func=None): > +def cmd(mycmd, myexc="", env=None, debug=False, fail_func=None): > + if env is None: > + env = {} > #print "***** cmd()" > sys.stdout.flush() > args=[BASH_BINARY] > if "BASH_ENV" not in env: > + env = env.copy() > env["BASH_ENV"] = > "/etc/spork/is/not/valid/profile.env" if debug: > args.append("-x") How the hell did I miss that one, I've worked on this function a few times. Please merge :) -- Brian Dolbec