grub-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] normal/cmdline.c : history contains empty lines


From: Vincent Pelletier
Subject: Re: [PATCH] normal/cmdline.c : history contains empty lines
Date: Wed, 29 Dec 2004 20:49:38 +0100
User-agent: Mozilla Thunderbird 0.9 (X11/20041124)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Marco Gerards a ?crit :
| Your patch was kinda hard to comprehend, especially because you
| rewrote grub_history_add.  And unfortunately it caused a segfault
| here. :/
|
| The main problem was in the logic of the history code.  I should be
| terribly ashamed for doing it wrong like this in the first place.  I
| made a fix to change the logic there, instead of in grub_history_add.
| In the meanwhile I made it work just like bash, like Okuji requested.
|
| Vincent, does this patch solve your problem?  I will commit it soon.
|
| Thanks,
| Marco
|
| 2004-12-29  Marco Gerards  <address@hidden>
|
|       * normal/cmdline.c (grub_cmdline_get): Redone logic so no empty
|       lines are inserted and make it work like readline.  Reported by
|       Vincent Pelletier <address@hidden>.

Nice for the grub_history_replace, I missed that function and was trying
to rewrite it (I was redesigning the patch according to Okuji's requests).
I don't understand how the changes I made on grub_history_add could made
it segfault, as I only checks for null pointer and empty string (to
prevent adding an empty line or - ironically - to prevent it from
segfaulting when duplicating an invalid buffer). The empty string could
be checked using a buf[0]==0 instead of calling grub_strlen as I did
(faster, but maybe less portable in case of wide chars).

grub_history_add should be moved after the while loop too.

The use of "empty_line" was only a dirty hack, I should have 0-ed the
first char of hist instead.

Vincent Pelletier
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB0wpSFEQoKRQyjtURAsekAJ0QEuqGVGEDwa5J14t9tCoejHFUiwCgnVGl
XqsCAjSJpxbDY2C0PeC8BKE=
=d/Hc
-----END PGP SIGNATURE-----




reply via email to

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