On Jul 8, 2008, at 6:57 PM, Alexey Tourbin wrote:
On Mon, Jul 07, 2008 at 11:44:07PM +0200, Jeff Johnson wrote:
- make gzdio.c standalone.
BTW, I have rsyncable gzdio implemntation (this does not require
patched zlib, one only has to call gzflush() at certain sync points).
It is known to work well. Please review the patches and tell me
whether you want it or not.
http://git.altlinux.org/people/at/packages/rpm.git?
a=commitdiff;h=c761902b
http://git.altlinux.org/people/at/packages/rpm.git?
a=commitdiff;h=f7b5ee1e
http://git.altlinux.org/people/at/packages/rpm.git?
a=commitdiff;h=8d5e355e
http://git.altlinux.org/people/at/packages/rpm.git?
a=commitdiff;h=52b2499a
I've integrated the patches (with some modest stylistic changes).
I am seeing a easily reproducible segfault however.
Here's an example backtrace:
(gdb) bt
#0 0x004498b5 in rpmz_gzerror (file=0xb8e5cdc8, errnum=0xbfdd43f8)
at gzio.c:974
#1 0x00254a03 in gzdWrite (cookie=0xb8e79458,
buf=0xb7f68000 "07070100c596eb000081b4", '0' <repeats 23 times>,
"146cd3b770000061c0000000800000015", '0' <repeats 22 times>,
"1b00000000neon-0.27.0-multilib.patch", count=8192) at gzdio.c:357
#2 0x00e33202 in _IO_cookie_write () from /lib/libc.so.6
#3 0x00e3f167 in _IO_new_do_write () from /lib/libc.so.6
#4 0x00e3eb40 in _IO_new_file_overflow () from /lib/libc.so.6
#5 0x00e3dc55 in _IO_new_file_xsputn () from /lib/libc.so.6
#6 0x00e33cca in fwrite () from /lib/libc.so.6
#7 0x0027f548 in Fwrite (buf=0xb7ac2000, size=1, nmemb=797944,
fd=0xb8e79458)
at rpmio.c:2389
#8 0x0025c98f in iosmStage (iosm=0xb8e5ceb0, stage=IOSM_DWRITE) at
iosm.c:2584
#9 0x0017b561 in fsmStage (fsm=0xb8e5ceb0, stage=IOSM_DWRITE) at
fsm.c:2289
#10 0x00175ba2 in fsmNext (fsm=0xb8e5ceb0, nstage=IOSM_DWRITE) at
fsm.c:431
#11 0x00177c90 in writeFile (fsm=0xb8e5ceb0, writeData=1) at fsm.c:1127
#12 0x00179d5e in fsmStage (fsm=0xb8e5ceb0, stage=IOSM_PROCESS) at
fsm.c:1898
#13 0x00175ba2 in fsmNext (fsm=0xb8e5ceb0, nstage=IOSM_PROCESS) at
fsm.c:431
#14 0x0017927b in fsmStage (fsm=0xb8e5ceb0, stage=IOSM_PKGBUILD) at
fsm.c:1680
#15 0x001766ee in fsmSetup (_fsm=0xb8e5ceb0, goal=IOSM_PKGBUILD,
afmt=0xb8e7e088 "cpio", _ts=0xb8e69638, _fi=0xb8e55660,
cfd=0xb8e79458,
archiveSize=0xbfdd70d8, failedFile=0xbfdd4f10) at fsm.c:717
#16 0x0013e6d9 in cpio_doio (fdo=0xb8e59ba8, h=0xb8e54d00,
csa=0xbfdd70d8,
payload_format=0xb8e7e088 "cpio", fmodeMacro=0xb8e7e098 "w9.gzdio")
at pack.c:59
#17 0x001400e6 in writeRPM (hdrp=0xb8e3519c, pkgidp=0xb8e35198,
fileName=0xb8e5ad58 "/S/FE/devel/neon/neon-0.28.2-3.src.rpm",
csa=0xbfdd70d8, passPhrase=0xb8e34220 "", cookie=0xb8e35184) at
pack.c:723
#18 0x00141779 in packageSources (spec=0xb8e35128) at pack.c:1147
#19 0x00134145 in buildSpec (ts=0xb8e39990, spec=0xb8e35128,
what=223, test=0)
at build.c:382
#20 0xb7f6f4b6 in buildForTarget (ts=0xb8e39990, arg=0xbfdda87a
"neon.spec",
ba=0x15eea0) at ./build.c:239
#21 0xb7f6f77b in build (ts=0xb8e39990, arg=0xbfdda87a "neon.spec",
ba=0x15eea0, rcfile=0x0) at ./build.c:306
#22 0xb7f704df in main (argc=13, argv=0xbfdd9454) at ./rpmqv.c:884
...
(gdb) p *(gz_stream *)file
$1 = {stream = {next_in = 0x0, avail_in = 0, total_in = 0,
next_out = 0x3b0bc2d4 <Address 0x3b0bc2d4 out of bounds>,
avail_out = 2017115124, total_out = 2471728803,
msg = 0x31cb0a35 <Address 0x31cb0a35 out of bounds>, state =
0x77af56c6,
zalloc = 0x6b5e72cc, zfree = 0xb97ef92e, opaque = 0x5d5f6af8,
data_type = -1829790082, adler = 393206709, reserved = 3972913654},
z_err = -1094520068, z_eof = -1833030499, file = 0xa06d6416,
inbuf = 0x4b079149 <Address 0x4b079149 out of bounds>,
outbuf = 0x6c3e78d8 <Address 0x6c3e78d8 out of bounds>, crc =
2186110164,
msg = 0x996c7d33 <Address 0x996c7d33 out of bounds>,
path = 0x967237fd <Address 0x967237fd out of bounds>,
transparent = -1174367243, mode = 115 's', start = 1024994855,
in = 79180392, out = -1623022516, back = 1531621414, last =
1353548484}
So the issue seems to be with the "best effort" return of a partial
write implemented in
your 3rd patch, afaict.
I'll be damned if I can see the flaw however. I've triple checked the
patches and
run under valgrind, and am simply not seeing the problem.
Note that the segfault is with internal zlib, so padding & flushing
is occurring.
I'll try a couple more times to stabilize the patches.
FWIW, patch 4 needs to be done differently, I can add a "cpio hint"
flag using
rpmio/iosm.c very easily, therby generalizing your quite nice patch
(s) to tar
payloads as well as lzma comprssion (which afaik is also gonna need some
--rsyncable hints, but I have not looked closely yet).
I'm all in favor of external zlib through flushing, rather than
internal zlib
through padding, if I can just see the patches work.
Any help appreciated, what's currently checked in on HEAD has the
rsyncable_gzwrite() changes disabled.
73 de Jeff
______________________________________________________________________
RPM Package Manager http://rpm5.org
Developer Communication List rpm-devel@rpm5.org