Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MTfqQ-0004V4-TD for mharc-grub-devel@gnu.org; Wed, 22 Jul 2009 13:43:10 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MTfqO-0004Tr-5I for grub-devel@gnu.org; Wed, 22 Jul 2009 13:43:08 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MTfqJ-0004RM-5x for grub-devel@gnu.org; Wed, 22 Jul 2009 13:43:07 -0400 Received: from [199.232.76.173] (port=36221 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MTfqI-0004RH-Vr for grub-devel@gnu.org; Wed, 22 Jul 2009 13:43:03 -0400 Received: from mail-gx0-f219.google.com ([209.85.217.219]:33770) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MTfqI-0003b3-If for grub-devel@gnu.org; Wed, 22 Jul 2009 13:43:02 -0400 Received: by gxk19 with SMTP id 19so582053gxk.18 for ; Wed, 22 Jul 2009 10:43:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:received:message-id :from:to:in-reply-to:content-type:content-transfer-encoding :mime-version:subject:date:references:x-mailer; bh=54DFTlP7uBFC1A15kRB5UVvrKf9ulWkQHeJFJXqI6kA=; b=ll7sfOCkfkAercdXHjIvubKLrCVCUdKR2kAcHHXBGNeDgZM5Jau7AiKijxpFHuLClo jUQM+4ZuzJoJEDpvvg9WwuFstw/8WN6mLW7+vREgYlUa7MnvmQ98UPi8i40GU4Fs3kHW emuzxqOmPol7gCgTvOPejaUJGDXNc1iLw2Lgg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer; b=U91UMRNPHDFGZjuu+QCrZM6sW9lQQEOkstBW+41dGpdn2WuoZ/KW/c5uu1YfANTs4u gZ7eymMQ75mz425cAXE+WOzqLcD0rQs1DXI8Iq6QLROJ4fH+frQBE6ew/nu1Fu2fL4PQ eI+75zcbvl8Wecs2cq5o8ApDgHZh0HAAIf9s4= Received: by 10.90.29.17 with SMTP id c17mr1016569agc.26.1248284580978; Wed, 22 Jul 2009 10:43:00 -0700 (PDT) Received: from mail.definitelynotsafe.com (cpe-66-75-249-204.san.res.rr.com [66.75.249.204]) by mx.google.com with ESMTPS id 30sm2619871agc.19.2009.07.22.10.43.00 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 22 Jul 2009 10:43:00 -0700 (PDT) Sender: Joe Auricchio Received: from [10.24.0.125] (unknown [10.24.0.1]) (Authenticated sender: jauricch) by mail.definitelynotsafe.com (Postfix) with ESMTPSA id 5B47E17498 for ; Wed, 22 Jul 2009 10:42:18 -0700 (PDT) Message-Id: <1F7F9766-ABCD-4190-AA2D-C028D6348094@gmail.com> From: Joe Auricchio To: The development of GRUB 2 In-Reply-To: <20090722172709.GF8706@thorin> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v935.3) Date: Wed, 22 Jul 2009 10:42:54 -0700 References: <8FB98151-B0A2-4308-A065-15607AE9E8D8@gmail.com> <20090718185800.GJ8867@thorin> <0CC61931-97E9-4B53-8B86-37129AE84218@gmail.com> <20090722172709.GF8706@thorin> X-Mailer: Apple Mail (2.935.3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: [PATCH] Clear out gfxterm's virtual text_buffer - fixes junk at end of 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, 22 Jul 2009 17:43:08 -0000 On 22 Jul, 2009, at 10:27 , Robert Millan wrote: > On Sat, Jul 18, 2009 at 03:39:00PM -0700, Joe Auricchio wrote: >> >> On 18 Jul, 2009, at 11:58 , Robert Millan wrote: >>> On Sat, Jul 18, 2009 at 12:15:04AM -0700, Joe Auricchio wrote: >>>> >>>> This fixes a 100% reproducible and very annoying bug I've found: >>>> Switch >>>> to gfxterm and until your clear the screen or scroll, the last >>>> position >>>> of every line has a random junk character in random foreground and >>>> background color. I believe the root cause is that the >>>> virtual_screen's >>>> text_buffer is uninitialized; as the cursor reaches a new position, >>>> the >>>> uninitialized junk data is drawn to the screen. Really, the entire >>>> screen >>>> is junk, but it's never marked dirty so it's never drawn. So let's >>>> just >>>> clear out the whole text_buffer when we set up the screen. >>> >>> But grub_virtual_screen_free() already set the whole structure to >>> 0 at >>> the >>> beginning of grub_virtual_screen_setup(). >>> >>> Does a zero-filled screen result in garbage, or is something else >>> overwriting >>> it? >> >> grub_virtual_screen_free sets all of virtual_screen to 0, but not >> virtual_screen.text_buffer. text_buffer just gets grub_freed. Later >> in >> grub_virtual_screen_setup, a new text_buffer is grub_malloced. It's >> this >> new text_buffer that my patch clears out. > > So perhaps this can be solved simpler by replacing grub_malloc with > grub_zalloc ? I saw the zalloc commit and thought the same thing! :D I'll test it. But fg_color and bg_color must be set to the screen's current colors, which may not be zero. I just discovered that - this patch to grub_virtual_screen_setup() - scroll_up() line 579 /* Clear last line in text buffer. */, and - grub_virtual_screen_cls() do the same thing. An opportunity to refactor? I'll look into this. -joe