grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: normal/cmdline bug & patch


From: Tomas Ebenlendr
Subject: Re: normal/cmdline bug & patch
Date: Tue, 15 Jun 2004 18:22:13 +0200
User-agent: Mutt/1.5.6i

> Can you please write a changelog entry for your patch next time?  You
> can find some information on how to do that on:

Ok here is another version of the patch with two more bugs fixed:

bug1 ... hist_end does not point to last entry but to first empty.
bug2 ... pos can underflow, but not overflow
bug3 ... correction must act as 'modulo' so adding modulo value is right
    way
bug4 ... if hist_pos == hist_end, we need ot copy nothing, all lines were
    copied.

--- grub2_x/normal/cmdline.c    2004-06-15 15:41:57.000000000 +0200
+++ grub2_patched/normal/cmdline.c      2004-06-15 15:41:22.000000000 +0200
@@ -52,11 +52,11 @@
          int delsize = hist_used - newsize;
          hist_used = newsize;
 
-         for (i = 0; i < delsize; i++)
+         for (i = 1; i <= delsize; i++)
            {
              int pos = hist_end - i;
-             if (pos > hist_size)
-               pos -= hist_size;
+             if (pos < 0)
+               pos += hist_size;
              grub_free (old_hist_lines[pos]);
            }
 
          hist_end -= delsize;
          if (hist_end < 0)
-           hist_end = hist_size - hist_end;
+           hist_end += hist_size;
        }
 
-      if (hist_pos < hist_end)
+      if (hist_pos <= hist_end)
        grub_memmove (hist_lines, old_hist_lines + hist_pos,
                      (hist_end - hist_pos) * sizeof (char *));
       else
--- grub2_x/ChangeLog   2004-06-05 00:20:17.000000000 +0200
+++ grub2_patched/ChangeLog     2004-06-15 18:14:34.000000000 +0200
@@ -1,3 +1,10 @@
+2004-06-15  Tomas Ebenlendr <address@hidden>
+
+        Bugfix of cmdline history (normal mode).
+
+       * normal/commandline.c (grub_set_history): History reallocating
+       was completely bad (about 4 brainos), all fixed.
+
 2004-05-24  Marco Gerards  <address@hidden>
 
        Add support for UFS version 1 and 2.  Add support for the minix

-- 
                                 Tomas 'ebi' Ebenlendr
                                 http://get.to/ebik
                                 PF 2004.45563461344





reply via email to

[Prev in Thread] Current Thread [Next in Thread]