From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:46565) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hVCSN-0008MD-Ka for guix-patches@gnu.org; Mon, 27 May 2019 06:02:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hVCSG-0004Mp-FO for guix-patches@gnu.org; Mon, 27 May 2019 06:02:11 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39126) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hVCSC-0004K3-0Z for guix-patches@gnu.org; Mon, 27 May 2019 06:02:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hVCSA-0001rD-0t for guix-patches@gnu.org; Mon, 27 May 2019 06:02:03 -0400 Subject: [bug#35880] [PATCH 7/7] lzlib: 'lzread!' never returns more than it was asked for. Resent-Message-ID: From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20190524134238.22802-1-ludo@gnu.org> <20190524134238.22802-7-ludo@gnu.org> <877eaeo2zr.fsf@ambrevar.xyz> <87zhn9kn3p.fsf@gnu.org> <87r28llyr4.fsf@ambrevar.xyz> <87a7f8kird.fsf@gnu.org> <87a7f8mlfw.fsf@ambrevar.xyz> Date: Mon, 27 May 2019 12:00:54 +0200 In-Reply-To: <87a7f8mlfw.fsf@ambrevar.xyz> (Pierre Neidhardt's message of "Mon, 27 May 2019 09:00:03 +0200") Message-ID: <87pno4z06h.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: Pierre Neidhardt Cc: 35880@debbugs.gnu.org Hi Pierre, Pierre Neidhardt skribis: > It does make sense, but then don't we have the same issue with zlib.scm: Which issue? > (define gzread! > (let ((proc (zlib-procedure int "gzread" (list '* '* unsigned-int)))) > (lambda* (gzfile bv #:optional (start 0) (count (bytevector-length bv= ))) > "Read up to COUNT bytes from GZFILE into BV at offset START. Retur= n the > number of uncompressed bytes actually read; it is zero if COUNT is zero o= r if > the end-of-stream has been reached." > ... > > I initially tried to mimic zlib.scm and this part confused me a lot back = then. There=E2=80=99s a key difference: the =E2=80=98gzread=E2=80=99 etc. API is = high-level and easy to use, but it wants a file descriptor to read from (thus a file port in Scheme land.) That=E2=80=99s enough for =E2=80=98guix publish=E2=80=99, which writes gzip= ped data to files, but that=E2=80=99s not enough for =E2=80=98guix substitute=E2=80=99, which = can read data from non-file ports (e.g., chunked-encoding ports or TLS ports from the HTTP client.) HTH, Ludo=E2=80=99.