From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.33) id 1Cjk0M-0000h0-B3 for mharc-grub-devel@gnu.org; Wed, 29 Dec 2004 15:01:10 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1Cjk0F-0000fq-52 for grub-devel@gnu.org; Wed, 29 Dec 2004 15:01:03 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1Cjk0B-0000e2-DS for grub-devel@gnu.org; Wed, 29 Dec 2004 15:00:59 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Cjk0B-0000dz-BT for grub-devel@gnu.org; Wed, 29 Dec 2004 15:00:59 -0500 Received: from [217.12.11.36] (helo=smtp005.mail.ukl.yahoo.com) by monty-python.gnu.org with smtp (Exim 4.34) id 1Cjjp6-00034c-MA for grub-devel@gnu.org; Wed, 29 Dec 2004 14:49:32 -0500 Received: from unknown (HELO ?192.168.0.2?) (subdino2004@83.194.34.31 with plain) by smtp005.mail.ukl.yahoo.com with SMTP; 29 Dec 2004 19:49:31 -0000 Message-ID: <41D30A52.40602@yahoo.fr> Date: Wed, 29 Dec 2004 20:49:38 +0100 From: Vincent Pelletier User-Agent: Mozilla Thunderbird 0.9 (X11/20041124) X-Accept-Language: fr, en MIME-Version: 1.0 To: The development of GRUB 2 References: <41BE9159.7010500@yahoo.fr> <87wtv0j3zy.fsf@marco.marco-g.com> In-Reply-To: <87wtv0j3zy.fsf@marco.marco-g.com> X-Enigmail-Version: 0.89.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PATCH] normal/cmdline.c : history contains empty lines X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Dec 2004 20:01:03 -0000 -----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 | | * normal/cmdline.c (grub_cmdline_get): Redone logic so no empty | lines are inserted and make it work like readline. Reported by | Vincent Pelletier . 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-----