From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MyVFp-0006Ae-8C for mharc-grub-devel@gnu.org; Thu, 15 Oct 2009 14:40:49 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MyVFn-0006A6-KU for grub-devel@gnu.org; Thu, 15 Oct 2009 14:40:47 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MyVFi-00068E-Iq for grub-devel@gnu.org; Thu, 15 Oct 2009 14:40:46 -0400 Received: from [199.232.76.173] (port=55998 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MyVFi-000682-4Z for grub-devel@gnu.org; Thu, 15 Oct 2009 14:40:42 -0400 Received: from mail-fx0-f214.google.com ([209.85.220.214]:57532) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MyVFg-000276-Hp for grub-devel@gnu.org; Thu, 15 Oct 2009 14:40:41 -0400 Received: by fxm10 with SMTP id 10so1742435fxm.32 for ; Thu, 15 Oct 2009 11:40:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type; bh=8kVulQsfwDTIBM+ww5xQZlASXtIL40aKhidNhVWUEPM=; b=jjJF6x2Wtcsv8Wq2VLMOsep3nxApM+pzLyr0+mf3MEphGun7hOFEOqrlqhZiLdeS/8 5Y4efzB+ZUYcwD+6ZD5L6QhqqXUjCztH8z/MKG+D0C7EeDb0so2V/8P01ftvdtHoP9gx GfOd8y7ZUYQC+dkkacM2eHR6DdIVzBeVyY4hc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; b=RrFXIa8jL1NjmMNu8UhePBgugbPnOwSeUapuUXkTg5yLQL6KX/7VHQdFjh2nUrBh3F Ocr2U1sI+YhF3ccC0alNnydI7E5617VkhZ/cH35QDzNbS+zqx+YBwTR3lZfkOxsk1rfK kWMlc2vZ6DTA7TP7S6MVS4VmTtmrmHz79nOto= Received: by 10.204.163.65 with SMTP id z1mr321290bkx.145.1255632038926; Thu, 15 Oct 2009 11:40:38 -0700 (PDT) Received: from ?192.168.178.55? (p5B0CEA32.dip.t-dialin.net [91.12.234.50]) by mx.google.com with ESMTPS id 19sm526621fkr.53.2009.10.15.11.40.37 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 15 Oct 2009 11:40:38 -0700 (PDT) Message-ID: <4AD76CA5.3070102@googlemail.com> Date: Thu, 15 Oct 2009 20:40:37 +0200 From: Andreas Born User-Agent: Thunderbird 2.0.0.23 (X11/20090827) MIME-Version: 1.0 To: GRUB2 Devel Content-Type: multipart/mixed; boundary="------------070404010004020109060204" X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [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 18:40:47 -0000 This is a multi-part message in MIME format. --------------070404010004020109060204 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit 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. Thanks Andreas ChangeLog: 2009-10-15 Andreas Born * kern/env.c (grub_env_export): Create inexistent variables before exporting. --------------070404010004020109060204 Content-Type: text/x-patch; name="export-create.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="export-create.diff" Index: kern/env.c =================================================================== --- kern/env.c (Revision 2631) +++ kern/env.c (Arbeitskopie) @@ -170,8 +171,13 @@ struct grub_env_var *var; var = grub_env_find (name); - if (var) - var->type = GRUB_ENV_VAR_GLOBAL; + if (! var) + { + if (grub_env_set (name, "") != GRUB_ERR_NONE) + return grub_errno; + var = grub_env_find (name); + } + var->type = GRUB_ENV_VAR_GLOBAL; return GRUB_ERR_NONE; } --------------070404010004020109060204--