Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MyVoK-0005Fi-AA for mharc-grub-devel@gnu.org; Thu, 15 Oct 2009 15:16:28 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MyVoI-0005FW-7u for grub-devel@gnu.org; Thu, 15 Oct 2009 15:16:26 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MyVoD-0005Ew-Ge for grub-devel@gnu.org; Thu, 15 Oct 2009 15:16:25 -0400 Received: from [199.232.76.173] (port=34938 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MyVoD-0005Et-BV for grub-devel@gnu.org; Thu, 15 Oct 2009 15:16:21 -0400 Received: from smarthost01.mail.zen.net.uk ([212.23.3.140]:40461) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MyVoD-0001tB-3B for grub-devel@gnu.org; Thu, 15 Oct 2009 15:16:21 -0400 Received: from [82.69.40.219] (helo=riva.pelham.vpn.ucam.org) by smarthost01.mail.zen.net.uk with esmtp (Exim 4.63) (envelope-from ) id 1MyVoB-0001S0-Do for grub-devel@gnu.org; Thu, 15 Oct 2009 19:16:19 +0000 Received: from cjwatson by riva.pelham.vpn.ucam.org with local (Exim 3.36 #1 (Debian)) for grub-devel@gnu.org id 1MyVoA-0007PZ-00; Thu, 15 Oct 2009 20:16:18 +0100 Date: Thu, 15 Oct 2009 20:16:18 +0100 From: Colin Watson To: The development of GRUB 2 Message-ID: <20091015191618.GI28534@riva.ucam.org> References: <4AD76CA5.3070102@googlemail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4AD76CA5.3070102@googlemail.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-Originating-Smarthost01-IP: [82.69.40.219] X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: Re: [PATCH] create variables when exporting them X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Oct 2009 19:16:26 -0000 On Thu, Oct 15, 2009 at 08:40:37PM +0200, Andreas Born wrote: > This patch changes grub_env_export to create variables with empty value, > if necessary. > This makes it possible to export variables before actually assigning > them any value and is the way bash behaves. This makes sense to me (although bash is "too big and too slow" and we'll never implement anything close to all of it, this is a pretty cheap way to reduce confusion due to differences), although probably for post-1.97. A couple of nits: > * kern/env.c (grub_env_export): Create inexistent variables > before exporting. "nonexistent" > + if (! var) > + { > + if (grub_env_set (name, "") != GRUB_ERR_NONE) > + return grub_errno; > + var = grub_env_find (name); > + } GNU brace style involves indenting the braces as well, thus: if (! var) { if (grub_env_set (name, "") != GRUB_ERR_NONE) return grub_errno; var = grub_env_find (name); } -- Colin Watson [cjwatson@ubuntu.com]