From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:40564) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hW01j-00054F-9L for guix-patches@gnu.org; Wed, 29 May 2019 10:58:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hW01i-0004yF-6m for guix-patches@gnu.org; Wed, 29 May 2019 10:58:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46012) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hW01i-0004y2-3s for guix-patches@gnu.org; Wed, 29 May 2019 10:58:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hW01i-0007Rc-0h for guix-patches@gnu.org; Wed, 29 May 2019 10:58:02 -0400 Subject: [bug#35880] [PATCH 1/7] lzlib: Add 'make-lzip-input-port/compressed'. Resent-Message-ID: From: Pierre Neidhardt In-Reply-To: <871s0i1yji.fsf@gnu.org> References: <20190524134238.22802-1-ludo@gnu.org> <87d0k6o3am.fsf@ambrevar.xyz> <87ftp1m1te.fsf@gnu.org> <87blznsxym.fsf@gnu.org> <87ef4jlvbr.fsf@ambrevar.xyz> <87lfyrr554.fsf@gnu.org> <87sgszk3ev.fsf@ambrevar.xyz> <877eab3tjq.fsf@gnu.org> <87k1ebj7a8.fsf@ambrevar.xyz> <871s0i1yji.fsf@gnu.org> Date: Wed, 29 May 2019 16:57:19 +0200 Message-ID: <87a7f5wbow.fsf@ambrevar.xyz> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 35880-done@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s writes: > I=E2=80=99m not sure I follow. I think =E2=80=98make-lzip-input-port/com= pressed=E2=80=99 > corresponds to Example 2 in the manual (info "(lzlib) Examples"), > =E2=80=98make-lzip-output-port=E2=80=99 corresponds to Example 1, and > =E2=80=98make-lzip-input-port=E2=80=99 corresponds to Example 4 (with the= exception that > =E2=80=98lzread!=E2=80=99 doesn=E2=80=99t call =E2=80=98lz-decompress-fin= ished?=E2=80=99, but it has other means > to tell whether we=E2=80=99re done processing input.) Example 4 is: 1) LZ_decompress_open 2) go to step 5 if LZ_decompress_write_size returns 0 3) LZ_decompress_write 4) if no more data to write, call LZ_decompress_finish 5) LZ_decompress_read 5a) optionally, if LZ_decompress_member_finished returns 1, read final values for member with LZ_decompress_data_crc, etc. 6) go back to step 2 until LZ_decompress_finished returns 1 7) LZ_decompress_close In `lzread!', we don't call lz-decompress-finished? nor do we loop on lz-decompress-finished. This only works for decompression of single-member archive, but the documentation does not say that. =2D-8<---------------cut here---------------start------------->8--- (match (get-bytevector-n port (lz-decompress-write-size decoder)) ((? eof-object? eof) eof) (bv (lz-decompress-write decoder bv))) =2D-8<---------------cut here---------------end--------------->8--- In the above if lz-decompress-write-size returns 0, we won't be reading anything (infinite loop?). While I understand this should not happen in practice, the documentation of the library does not give such guarantees. Antonio told me that explicitly. =2D-8<---------------cut here---------------start------------->8--- (match (lz-decompress-read decoder bv start (- count read)) (0 (if (eof-object? (feed-decoder! decoder)) read (loop read start))) =2D-8<---------------cut here---------------end--------------->8--- I'm not sure I understand the above: if we read nothing, then we try again? This might loop forever. What do you think? =2D-=20 Pierre Neidhardt https://ambrevar.xyz/ --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAlzunc8ACgkQm9z0l6S7 zH/cAQf7BzqS51ztbb8c8tRkM6zYlI2t5t3oYsv/FAjD6vb3k/CimQhHOTPD8d3s 3PAybM2rimZTkp4xSh06+L66uRh+t0Vw+UnPJonct9irhq8lFOFiZwDbwXYqEgia I+OpHwNETZSO66ALflO4E5cbFmKdeO1IWJALisOUzHMgmnKRCZUo3qriQFb0IZ4u yYAy4rSt4aBj/EE7GaZdFwLQUM0Ya2i3Hemq+ZW8TtmaD6J09w6ffV+o/l0mjGIK u3KscXc7aVGC9BPxec34qAyvvFh8lPJDpD9ffKXyjqDFQj1NOVzM/WmRHDbAeELt wufjlFt6c+2BnJ1Z7Vw7/tM+FC/JCQ== =LbIL -----END PGP SIGNATURE----- --=-=-=--