From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1S4BB5-0000MZ-0z for mharc-grub-devel@gnu.org; Sun, 04 Mar 2012 08:08:43 -0500 Received: from eggs.gnu.org ([208.118.235.92]:41488) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S4BB2-0000MS-Jm for grub-devel@gnu.org; Sun, 04 Mar 2012 08:08:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S4BB0-0003vZ-Vi for grub-devel@gnu.org; Sun, 04 Mar 2012 08:08:40 -0500 Received: from wp191.webpack.hosteurope.de ([80.237.132.198]:60877) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S4BB0-0003vL-O4 for grub-devel@gnu.org; Sun, 04 Mar 2012 08:08:38 -0500 Received: from p54ba7451.dip.t-dialin.net ([84.186.116.81] helo=neptun.omega.ssw.de); authenticated by wp191.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) id 1S4BAy-0008Vv-MC; Sun, 04 Mar 2012 14:08:36 +0100 Received: from localhost (localhost [127.0.0.1]) by neptun.omega.ssw.de (Postfix) with ESMTP id A1A56E180A8 for ; Sun, 4 Mar 2012 14:08:35 +0100 (CET) X-Virus-Scanned: amavisd-new at omega.ssw.de Received: from neptun.omega.ssw.de ([127.0.0.1]) by localhost (neptun.omega.ssw.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hDl+oShwLPRK for ; Sun, 4 Mar 2012 14:08:24 +0100 (CET) Received: from [192.168.3.100] (ANVOIT-2.fritz.box [192.168.2.21]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by neptun.omega.ssw.de (Postfix) with ESMTP id 3CE05E180A7 for ; Sun, 4 Mar 2012 14:08:24 +0100 (CET) Message-ID: <4F536941.8070805@anvo-it.de> Date: Sun, 04 Mar 2012 14:08:17 +0100 From: Andreas Vogel User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: The development of GNU GRUB Subject: [PATCH] Making exported variables really global Content-Type: multipart/mixed; boundary="------------060209020808010700070603" X-bounce-key: webpack.hosteurope.de; andreas.vogel@anvo-it.de; 1330866518; e4f79ae6; X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.237.132.198 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Mar 2012 13:08:42 -0000 This is a multi-part message in MIME format. --------------060209020808010700070603 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Hi all, This tiny patch makes exported variables really global. Right now exported variables are set in the context of a submenu when running it. But any changes to those vars are lost when leaving the submenu. This patch sets and exports all vars in the calling context for the submenu which are exported in the context of the submenu. This feature is needed in order to have submenus implementing something like setting boot options like boot params, language setttings and the like using environment variables. Any comments? If it's OK any chance to be included? Andreas --------------060209020808010700070603 Content-Type: text/plain; name="08-global_environ_vars.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="08-global_environ_vars.patch" === modified file 'grub-core/normal/context.c' --- grub-core/normal/context.c 2012-03-01 21:43:03 +0000 +++ grub-core/normal/context.c 2012-03-04 13:51:28 +0000 @@ -126,6 +126,20 @@ for (p = grub_current_context->vars[i]; p; p = q) { + if (p->global) + { + /* Set and export all global variables inside + the calling/previous context. */ + struct grub_env_context *tmp_context = grub_current_context; + grub_current_context = grub_current_context->prev; + if (grub_env_set (p->name, p->value) == GRUB_ERR_NONE) + { + grub_env_export (p->name); + grub_register_variable_hook (p->name, p->read_hook, p->write_hook); + } + grub_current_context = tmp_context; + } + q = p->next; grub_free (p->name); grub_free (p->value); --------------060209020808010700070603--