From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1avtVx-0005PS-7B for mharc-grub-devel@gnu.org; Thu, 28 Apr 2016 17:30:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50568) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avtVu-0005KB-RT for grub-devel@gnu.org; Thu, 28 Apr 2016 17:30:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1avtVr-0004XY-JU for grub-devel@gnu.org; Thu, 28 Apr 2016 17:30:22 -0400 Received: from eru.sfritsch.de ([188.40.99.202]:54518) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avtVr-0004X4-EF for grub-devel@gnu.org; Thu, 28 Apr 2016 17:30:19 -0400 From: Stefan Fritsch To: grub-devel@gnu.org Subject: gzio/http problem (was: [PATCH] Rewrite and fix grub_bufio_read()) Date: Thu, 28 Apr 2016 23:30:11 +0200 Message-ID: <16066843.M6gESN7E00@k> User-Agent: KMail/4.14.10 (Linux/4.5.0-1-amd64; KDE/4.14.14; x86_64; ; ) In-Reply-To: References: <57224D3F.1080704@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 188.40.99.202 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Apr 2016 21:30:23 -0000 On Thursday 28 April 2016 21:52:27, Stefan Fritsch wrote: > You are right, I was misreading the second part of the code with > the direct read. Now I wonder why the patch helped with our > problem. I will do some more debugging. The real problem seems to be that http sometimes (depending on network timing?) returns short reads but gzio does not check how many bytes have actually been read. The looping in my patch for grub_bufio_read() fixed this by never returning a short read. I guess two things should be fixed: gzio should check the return value of grub_file_read(), and (assuming that other code depends on there not being short reads, too) http should be fixed. Or maybe grub_file_read() should get a loop that ensures that there are no short reads?