Hi, On Dec/04/2009, Robert Millan wrote: > On Sun, Nov 29, 2009 at 06:39:36PM +0000, Carles Pina i Estany wrote: > > (first one has a bug but very easy to fix, even thought I would maybe > > refactor this code to implement in other way) > > Can you give more details about this bug and the refactor that would be > needed?
Find attached the simple patch (without refactoring) (it resets grub_errno _before_ grub_env_set, because grub_env_set calls the hooked functions). The refactoring would be in file script/execute.c, function grub_script_execute_cmdline. See the attached file set_refactor.patch for the idea. It's more work/things in Grub but I think that more robust since now will be the same code using set or without using set. Of course, maybe this extra-complexity is not needed. I have not looked into the Grub parser: maybe the extra-best place to implement it it's there, but I'm not familiar with Lex/Yacc/Bison/... . Cheers, -- Carles Pina i Estany http://pinux.info
=== modified file 'script/execute.c' --- script/execute.c 2009-11-23 15:37:33 +0000 +++ script/execute.c 2009-12-04 21:43:28 +0000 @@ -116,10 +116,11 @@ grub_script_execute_cmdline (struct grub /* Create two strings and set the variable. */ *eq = '\0'; eq++; - grub_env_set (assign, eq); /* This was set because the command was not found. */ grub_errno = GRUB_ERR_NONE; + + grub_env_set (assign, eq); } grub_free (assign);
=== modified file 'script/execute.c' --- script/execute.c 2009-11-23 15:37:33 +0000 +++ script/execute.c 2009-12-04 21:51:41 +0000 @@ -113,13 +113,15 @@ grub_script_execute_cmdline (struct grub if (eq) { - /* Create two strings and set the variable. */ - *eq = '\0'; - eq++; - grub_env_set (assign, eq); - - /* This was set because the command was not found. */ - grub_errno = GRUB_ERR_NONE; + // TODO + // New Command Line Function = set + // New arguments = Old Command Line Function concatenate Old arguments + // Call grub_script_execute_cmdline (newCmd) + // + // So if before user typed a=b we call recursively: + // set a=b + // + // Alternatively: Don't need to check for "=" } grub_free (assign);
_______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel