guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#35880] [PATCH 7/7] lzlib: 'lzread!' never returns more than it was


From: Ludovic Courtès
Subject: [bug#35880] [PATCH 7/7] lzlib: 'lzread!' never returns more than it was asked for.
Date: Mon, 27 May 2019 12:00:54 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)

Hi Pierre,

Pierre Neidhardt <address@hidden> 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.  Return the
> number of uncompressed bytes actually read; it is zero if COUNT is zero or 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’s a key difference: the ‘gzread’ 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’s enough for ‘guix publish’, which writes gzipped data to files,
but that’s not enough for ‘guix substitute’, which can read data from
non-file ports (e.g., chunked-encoding ports or TLS ports from the HTTP
client.)

HTH,
Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]