All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vincent Pelletier <subdino2004@yahoo.fr>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] normal/cmdline.c : history contains empty lines
Date: Wed, 29 Dec 2004 20:49:38 +0100	[thread overview]
Message-ID: <41D30A52.40602@yahoo.fr> (raw)
In-Reply-To: <87wtv0j3zy.fsf@marco.marco-g.com>

-----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  <metgerards@student.han.nl>
|
| 	* normal/cmdline.c (grub_cmdline_get): Redone logic so no empty
| 	lines are inserted and make it work like readline.  Reported by
| 	Vincent Pelletier <subdino2004@yahoo.fr>.

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	other threads:[~2004-12-29 20:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-14  7:08 [PATCH] normal/cmdline.c : history contains empty lines Vincent Pelletier
2004-12-19 15:15 ` Yoshinori K. Okuji
2004-12-19 15:46   ` Vincent Pelletier
2004-12-19 15:59     ` Yoshinori K. Okuji
2004-12-29 19:31 ` Marco Gerards
2004-12-29 19:49   ` Vincent Pelletier [this message]
2004-12-29 21:06     ` Marco Gerards

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41D30A52.40602@yahoo.fr \
    --to=subdino2004@yahoo.fr \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.