From: Linus Torvalds <torvalds@linux-foundation.org>
To: Junio C Hamano <junkio@cox.net>
Cc: Pavel Roskin <proski@gnu.org>, git@vger.kernel.org
Subject: Re: git 1.5.1-rc1 doesn't like empty files
Date: Mon, 19 Mar 2007 22:49:53 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.64.0703192245490.6730@woody.linux-foundation.org> (raw)
In-Reply-To: <7vslc0bhz7.fsf@assigned-by-dhcp.cox.net>
On Mon, 19 Mar 2007, Junio C Hamano wrote:
>
> If the error message above is linewrapped by e-mail, I think it
> is coming from here:
I think I found it.
The thing is, if the output buffer is empty, we should *still* actually
use the zlib routines to *unpack* that empty output buffer.
But we had a test that said "only unpack if we still expect more output".
So we wouldn't use up all the zlib stream, because we felt that we didn't
need it, because we already had all the bytes we wanted. And it was
"true": we did have all the output data. We just needed to also eat all
the input data!
We've had this bug before - thinking that we don't need to inflate()
anything because we already had it all..
Linus
---
sha1_file.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sha1_file.c b/sha1_file.c
index b0b2177..c0efed3 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1030,7 +1030,7 @@ static void *unpack_sha1_rest(z_stream *stream, void *buffer, unsigned long size
n = size;
memcpy(buf, (char *) buffer + bytes, n);
bytes = n;
- if (bytes < size) {
+ if (bytes <= size) {
stream->next_out = buf + bytes;
stream->avail_out = size - bytes;
while (status == Z_OK)
next prev parent reply other threads:[~2007-03-20 5:50 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-20 3:30 git 1.5.1-rc1 doesn't like empty files Pavel Roskin
2007-03-20 4:24 ` Nicolas Vilz
2007-03-20 4:54 ` Linus Torvalds
2007-03-20 5:08 ` Pavel Roskin
2007-03-20 5:41 ` Linus Torvalds
2007-03-20 5:50 ` Pavel Roskin
2007-03-20 5:56 ` Shawn O. Pearce
2007-03-20 7:04 ` Alexander Litvinov
2007-03-20 8:43 ` Andy Parkins
2007-03-20 8:49 ` Junio C Hamano
2007-03-20 9:26 ` Andy Parkins
2007-03-20 15:45 ` Linus Torvalds
2007-03-20 5:29 ` Junio C Hamano
2007-03-20 5:47 ` Pavel Roskin
2007-03-20 5:49 ` Linus Torvalds [this message]
2007-03-20 6:00 ` Junio C Hamano
2007-03-20 6:05 ` Junio C Hamano
2007-03-20 15:46 ` Linus Torvalds
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=Pine.LNX.4.64.0703192245490.6730@woody.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
--cc=proski@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).