All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [bug #27710] variable type not exported into new context
       [not found] <20091015-153848.sv74720.97143@savannah.gnu.org>
@ 2009-12-06 22:57 ` Andreas Born
  2009-12-15 18:38   ` Andreas Born
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Born @ 2009-12-06 22:57 UTC (permalink / raw)
  To: GRUB2 Devel

As of r1917 grub_env_context_open still doesn't mark exported variables 
as global in the new context.
Attached patch exports them with grub_env_export in the new context.

Andreas Born schrieb:
> URL:
>   <http://savannah.gnu.org/bugs/?27710>
>
>                  Summary: variable type not exported into new context
>                  Project: GNU GRUB
>             Submitted by: shador
>             Submitted on: Do 15 Okt 2009 15:38:48 GMT
>                 Category: Terminal
>                 Severity: Major
>                 Priority: 5 - Normal
>               Item Group: Software Error
>                   Status: None
>                  Privacy: Public
>              Assigned to: None
>          Originator Name: 
>         Originator Email: 
>              Open/Closed: Open
>          Discussion Lock: Any
>                  Release: 
>                  Release: SVN
>          Reproducibility: Every Time
>          Planned Release: None
>
>     _______________________________________________________
>
> Details:
>
> A variable created and exported afterwards, isn't marked 'export' after a new
> context was created by issuing configfile. Thus if you issue another time
> configfile the variable is unset.
> This means recursive menus deeper than 2 menus are not possible by loading
> another configfile.
>
> Example:
> set blub=blob
> export blub
> configfile <file>
> configfile <file>
> echo $blub
> => nothing, blub was unset after the second configfile (prefix also so
> everything fails).
>
> Workaround:
> In every new context (-> every .cfg file) (re)export the variable (and
> prefix, root).
>
> Attached is a patch which marks variables copied into the new context again
> 'export' preventing breakage of prefix and root.
>
>
>
>     _______________________________________________________
>
> File Attachments:
>
>
> -------------------------------------------------------
> Date: Do 15 Okt 2009 15:38:48 GMT  Name: export-context.diff  Size: 359B  
> By: shador
>
> <http://savannah.gnu.org/bugs/download.php?file_id=18886>
>
>     _______________________________________________________
>
> Reply to this item at:
>
>   <http://savannah.gnu.org/bugs/?27710>
>
> _______________________________________________
>   Nachricht geschickt von/durch Savannah
>   http://savannah.gnu.org/
>
>   




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [bug #27710] variable type not exported into new context
  2009-12-06 22:57 ` [bug #27710] variable type not exported into new context Andreas Born
@ 2009-12-15 18:38   ` Andreas Born
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Born @ 2009-12-15 18:38 UTC (permalink / raw)
  To: GRUB2 Devel

[-- Attachment #1: Type: text/plain, Size: 3618 bytes --]

Seems like I completely forgot the diff here. Sorry, this time it is 
attached.

Changelog:
2009-12-15 Andreas Born  <futur.andy@googlemail.com>

     * kern/env.c (grub_env_context_open): Reapply global flag for 
variables exported to the new context.

This behaviour can be really annoying. If one boots to the grub menu, 
chooses the shell with 'c', loads the menu again and drops to shell 
again (i.e. created 2 new contexts), prefix and root are gone.
Although they are still exported into the first new context, they aren't 
marked again global in that context. Therefore creating another new 
context (from within the first context) doesn't export prefix and root 
from the 1st context to the second context. Of course, that has to 
happen as the global flag is not set in the first context.
I created the new contexts by loading a grub.cfg which doesn't touch 
prefix and root with the configfile command.
The patch changes the behaviour to not only export variables to the new 
context instead they are exported to the new context and then marked as 
global again with grub_env_export.

Hope the issue is understandable like that. Otherwise please ask.

Regards
Andreas

Andreas Born schrieb:
> As of r1917 grub_env_context_open still doesn't mark exported 
> variables as global in the new context.
> Attached patch exports them with grub_env_export in the new context.
>
> Andreas Born schrieb:
>> URL:
>>   <http://savannah.gnu.org/bugs/?27710>
>>
>>                  Summary: variable type not exported into new context
>>                  Project: GNU GRUB
>>             Submitted by: shador
>>             Submitted on: Do 15 Okt 2009 15:38:48 GMT
>>                 Category: Terminal
>>                 Severity: Major
>>                 Priority: 5 - Normal
>>               Item Group: Software Error
>>                   Status: None
>>                  Privacy: Public
>>              Assigned to: None
>>          Originator Name:         Originator Email:              
>> Open/Closed: Open
>>          Discussion Lock: Any
>>                  Release:                  Release: SVN
>>          Reproducibility: Every Time
>>          Planned Release: None
>>
>>     _______________________________________________________
>>
>> Details:
>>
>> A variable created and exported afterwards, isn't marked 'export' 
>> after a new
>> context was created by issuing configfile. Thus if you issue another 
>> time
>> configfile the variable is unset.
>> This means recursive menus deeper than 2 menus are not possible by 
>> loading
>> another configfile.
>>
>> Example:
>> set blub=blob
>> export blub
>> configfile <file>
>> configfile <file>
>> echo $blub
>> => nothing, blub was unset after the second configfile (prefix also so
>> everything fails).
>>
>> Workaround:
>> In every new context (-> every .cfg file) (re)export the variable (and
>> prefix, root).
>>
>> Attached is a patch which marks variables copied into the new context 
>> again
>> 'export' preventing breakage of prefix and root.
>>
>>
>>
>>     _______________________________________________________
>>
>> File Attachments:
>>
>>
>> -------------------------------------------------------
>> Date: Do 15 Okt 2009 15:38:48 GMT  Name: export-context.diff  Size: 
>> 359B  By: shador
>>
>> <http://savannah.gnu.org/bugs/download.php?file_id=18886>
>>
>>     _______________________________________________________
>>
>> Reply to this item at:
>>
>>   <http://savannah.gnu.org/bugs/?27710>
>>
>> _______________________________________________
>>   Nachricht geschickt von/durch Savannah
>>   http://savannah.gnu.org/
>>
>>   
>


[-- Attachment #2: export-context.diff --]
[-- Type: text/x-patch, Size: 325 bytes --]

=== modified file 'kern/env.c'
--- kern/env.c	2009-07-16 22:14:09 +0000
+++ kern/env.c	2009-11-29 00:15:05 +0000
@@ -101,6 +101,7 @@
 		  grub_env_context_close ();
 		  return grub_errno;
 		}
+	      grub_env_export (var->name);
 	      grub_register_variable_hook (var->name, var->read_hook, var->write_hook);
 	    }
 	}

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-12-15 18:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20091015-153848.sv74720.97143@savannah.gnu.org>
2009-12-06 22:57 ` [bug #27710] variable type not exported into new context Andreas Born
2009-12-15 18:38   ` Andreas Born

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.