Skip to contentSkip to conversation

Eliminate script line length limit

PATCH In review Vladimir 'phcoder' Serbinenko 2 participants 5 messages Aug 22, 2009 – Aug 24, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Eliminate script line length limit

Making GNU GRUB more GNU ;)

Signature · 4 lines
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
script/sh/function.c +1 -1
index 1e49c70..a3950a8 100644
@@ -99,7 +99,7 @@ grub_script_function_find (char *functionname)
       break;
 
   if (! func)
-    grub_error (GRUB_ERR_UNKNOWN_COMMAND, "unknown command `%s'", functionname);
+    grub_error (GRUB_ERR_UNKNOWN_COMMAND, "unknown command `%.20s'", functionname);
 
   return func;
 }
script/sh/lexer.c +56 -22

134 lines not on this page · raw message

script/sh/script.c +4 -1
index cefafe6..c04a449 100644
@@ -110,10 +110,13 @@ grub_script_arg_add (struct grub_parser_param *state, struct grub_script_arg *ar
 {
   struct grub_script_arg *argpart;
   struct grub_script_arg *ll;
+  int len;
 
   argpart = (struct grub_script_arg *) grub_script_malloc (state, sizeof (*arg));
   argpart->type = type;
-  argpart->str = str;
+  len = grub_strlen (str) + 1;
+  argpart->str = grub_script_malloc (state, len);
+  grub_memcpy (argpart->str, str, len);
   argpart->next = 0;
 
   if (! arg)
#1 lore raw
Quoted 1 line · Vladimir 'phcoder' Serbinenko

Making GNU GRUB more GNU ;)

Good! But please could you use NULL for pointers? :-)

Also, remember to include a ChangeLog entry.

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
#2 lore raw
Quoted 20 lines · Robert Millan
Quoted 1 line · Vladimir 'phcoder' Serbinenko

Making GNU GRUB more GNU ;)

Good!  But please could you use NULL for pointers?  :-)

Also, remember to include a ChangeLog entry.

--
Robert Millan

 The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 4 lines
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
ChangeLog +8 -0
index 1efb882..6d9065e 100644
@@ -1,5 +1,13 @@
 2009-08-24  Vladimir Serbinenko  <[email protected]>
 
+	* script/sh/function.c (grub_script_function_find): Cut error message
+	not to flood terminal.
+	* script/sh/lexer.c (grub_script_yylex): Remove command line length
+	limit.
+	* script/sh/script.c (grub_script_arg_add): Duplicate string.
+
+2009-08-24  Vladimir Serbinenko  <[email protected]>
+
 	Rename *_partition_map to part_*
 
 	* partmap/acorn.c (grub_acorn_partition_map): Set name to 'part_acorn'.
script/sh/function.c +1 -1
index 1e49c70..a3950a8 100644
@@ -99,7 +99,7 @@ grub_script_function_find (char *functionname)
       break;
 
   if (! func)
-    grub_error (GRUB_ERR_UNKNOWN_COMMAND, "unknown command `%s'", functionname);
+    grub_error (GRUB_ERR_UNKNOWN_COMMAND, "unknown command `%.20s'", functionname);
 
   return func;
 }
script/sh/lexer.c +56 -22

134 lines not on this page · raw message

script/sh/script.c +4 -1
index cefafe6..c04a449 100644
@@ -110,10 +110,13 @@ grub_script_arg_add (struct grub_parser_param *state, struct grub_script_arg *ar
 {
   struct grub_script_arg *argpart;
   struct grub_script_arg *ll;
+  int len;
 
   argpart = (struct grub_script_arg *) grub_script_malloc (state, sizeof (*arg));
   argpart->type = type;
-  argpart->str = str;
+  len = grub_strlen (str) + 1;
+  argpart->str = grub_script_malloc (state, len);
+  grub_memcpy (argpart->str, str, len);
   argpart->next = 0;
 
   if (! arg)
#3 lore raw

Review

Quoted 1 line · Vladimir 'phcoder' Serbinenko
(quoted diff) +1 -0
+	     but extends automaticlly when needed.  */

Typo :-)

Other than this, it looks fine. Thanks!

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
#4 lore raw
Quoted 7 lines · Robert Millan
Quoted 1 line · Vladimir 'phcoder' Serbinenko

+          but extends automaticlly when needed.  */

Typo :-)

Other than this, it looks fine.  Thanks!

Fixed and comitted

Quoted 13 lines

--
Robert Millan

 The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 4 lines
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git