Bug 59836

Summary: RFE: re-add zlib speedups
Product: [Retired] Red Hat Linux Reporter: Enrico Scholz <rh-bugzilla>
Component: rpmAssignee: Jeff Johnson <jbj>
Status: CLOSED DEFERRED QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-02-13 22:31:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Enrico Scholz 2002-02-13 20:12:53 UTC
Seems to be a not handled case in get_byte():

1. get_byte() will be entered with 's->stream.avail_in == 0'
2. gz_refill_buf(s) will be called
3. gz_refill_buf(s) can return with '0' _and_ 's->stream.avail_in == 0'
4. execution continues in get_byte() and decrements s->stream.avail_in 
   --> contains (uint)(-1) now  !!CONFLICT!!

Probably, zlib/gzio.c:346

|                if (ferror(s->file)) {
|                        s->z_err = Z_ERRNO;
|                        return 1;
|                }

should be

|                if (ferror(s->file)) s->z_err = Z_ERRNO;
|                return 1;

which make step 3. impossible.

Comment 1 Enrico Scholz 2002-02-13 20:42:47 UTC
Last suggestion is not complete; line 337 should be modified also:

            if (s->mmap_pos > s->mmap_end)
                s->stream.avail_in = s->mmap_end - s->mmap_pos + z_bufsize;
            for (n=0; n<s->stream.avail_in; n+=4096)
                ((volatile char *)s->inbuf)[n];
-           return 0;
+           return s->stream.avail_in==0;
        }

Probably, the case 's->mmap_pos <= s->mmap_end' must be handled also, since
's->stream.avail_in' will be 'z_bufsize' then.

Comment 2 Jeff Johnson 2002-02-13 22:31:15 UTC
The analysis sounds convincing, will try the patch soon.

FWIW, I'm very interested in finding packages that don't "work",
as rpm-4.0.4 has some very aggresive patches in it's internal
zlib. Please find some more.

Comment 3 Jeff Johnson 2002-07-01 18:08:15 UTC
Deferred until I get a chance to re-add Ben LaHaises's
mmap(2) patch.